Bug 1182147: Ensure ImageHost does not attempt to call DrawQuad with an effect unsupported by the compositor. r=nical a=sylvestre
authorBas Schouten <bschouten@mozilla.com>
Fri, 04 Sep 2015 18:31:52 +0000
changeset 289277 28ee9c1ce2c61a0d3cea4e94ff40d21a5ab1d71f
parent 289276 4c1390cd396a9644267e7d72625637dd3eae44d8
child 289278 7484c6088282abb5aec8e99fcd0710c46f81b8cb
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical, sylvestre
bugs1182147
milestone42.0a2
Bug 1182147: Ensure ImageHost does not attempt to call DrawQuad with an effect unsupported by the compositor. r=nical a=sylvestre
gfx/layers/basic/BasicCompositor.cpp
gfx/layers/composite/ImageHost.cpp
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -143,17 +143,17 @@ BasicCompositor::CreateDataTextureSource
 {
   RefPtr<DataTextureSource> result = new DataTextureSourceBasic();
   return result.forget();
 }
 
 bool
 BasicCompositor::SupportsEffect(EffectTypes aEffect)
 {
-  return static_cast<EffectTypes>(aEffect) != EffectTypes::YCBCR;
+  return aEffect != EffectTypes::YCBCR && aEffect != EffectTypes::COMPONENT_ALPHA;
 }
 
 static void
 DrawSurfaceWithTextureCoords(DrawTarget *aDest,
                              const gfx::Rect& aDestRect,
                              SourceSurface *aSource,
                              const gfx::Rect& aTextureCoords,
                              gfx::Filter aFilter,
--- a/gfx/layers/composite/ImageHost.cpp
+++ b/gfx/layers/composite/ImageHost.cpp
@@ -304,16 +304,20 @@ ImageHost::Composite(LayerComposite* aLa
     RefPtr<TexturedEffect> effect =
         CreateTexturedEffect(img->mFrontBuffer->GetFormat(),
             img->mTextureSource.get(), aFilter, isAlphaPremultiplied,
             GetRenderState());
     if (!effect) {
       return;
     }
 
+    if (!GetCompositor()->SupportsEffect(effect->mType)) {
+      return;
+    }
+
     if (mLastFrameID != img->mFrameID || mLastProducerID != img->mProducerID) {
       if (mImageContainer) {
         aLayer->GetLayerManager()->
             AppendImageCompositeNotification(ImageCompositeNotification(
                 mImageContainer, nullptr,
                 img->mTimeStamp, GetCompositor()->GetCompositionTime(),
                 img->mFrameID, img->mProducerID));
       }