Bug 1187464 - Part 1. We can get the wrong texture source type, so deal with it. Carry r=mstange
authorMilan Sreckovic <milan@mozilla.com>
Mon, 08 Feb 2016 11:56:00 +0100
changeset 331588 acb9cdf6473e8c8ac961f56b0ec9453b42718a0d
parent 331587 d785dba19c59553f7d885a9caafe63b862934383
child 331589 688a04c23fef8d658e9de7ba2192154b79eb5a1f
push id11020
push userjolesen@mozilla.com
push dateWed, 17 Feb 2016 18:16:38 +0000
reviewersmstange
bugs1187464
milestone47.0a1
Bug 1187464 - Part 1. We can get the wrong texture source type, so deal with it. Carry r=mstange
gfx/2d/Logging.h
gfx/layers/basic/BasicCompositor.cpp
--- a/gfx/2d/Logging.h
+++ b/gfx/2d/Logging.h
@@ -125,16 +125,17 @@ enum class LogReason : int {
   FilterInputFormat,
   FilterNodeD2D1Target,
   FilterNodeD2D1Backend,
   SourceSurfaceIncompatible,
   GlyphAllocFailedCairo,
   GlyphAllocFailedCG,
   InvalidRect,
   CannotDraw3D, // 20
+  IncompatibleBasicTexturedEffect,
   // End
   MustBeLessThanThis = 101,
 };
 
 struct BasicLogger
 {
   // For efficiency, this method exists and copies the logic of the
   // OutputMessage below.  If making any changes here, also make it
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -425,37 +425,40 @@ BasicCompositor::DrawQuad(const gfx::Rec
       }
       break;
     }
     case EffectTypes::RGB: {
       TexturedEffect* texturedEffect =
           static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
       TextureSourceBasic* source = texturedEffect->mTexture->AsSourceBasic();
 
-      if (texturedEffect->mPremultiplied) {
+      if (source && texturedEffect->mPremultiplied) {
           DrawSurfaceWithTextureCoords(dest, aRect,
                                        source->GetSurface(dest),
                                        texturedEffect->mTextureCoords,
                                        texturedEffect->mFilter,
                                        DrawOptions(aOpacity, blendMode),
                                        sourceMask, &maskTransform);
-      } else {
+      } else if (source) {
           RefPtr<DataSourceSurface> srcData = source->GetSurface(dest)->GetDataSurface();
 
           // Yes, we re-create the premultiplied data every time.
           // This might be better with a cache, eventually.
           RefPtr<DataSourceSurface> premultData = gfxUtils::CreatePremultipliedDataSurface(srcData);
 
           DrawSurfaceWithTextureCoords(dest, aRect,
                                        premultData,
                                        texturedEffect->mTextureCoords,
                                        texturedEffect->mFilter,
                                        DrawOptions(aOpacity, blendMode),
                                        sourceMask, &maskTransform);
+      } else {
+        gfxDevCrash(LogReason::IncompatibleBasicTexturedEffect) << "Bad for basic";
       }
+
       break;
     }
     case EffectTypes::YCBCR: {
       NS_RUNTIMEABORT("Can't (easily) support component alpha with BasicCompositor!");
       break;
     }
     case EffectTypes::RENDER_TARGET: {
       EffectRenderTarget* effectRenderTarget =