Bug 1187464: Part 1. We can get the wrong texture source type, so deal with it. r?mstange draft
authorMilan Sreckovic <milan@mozilla.com>
Fri, 22 Jan 2016 13:32:28 -0500
changeset 324403 4fd58c5512430d86ab5d9e60e54e61a8886e6a12
parent 322694 b67316254602a63bf4e568198a5c7d3288a9db27
child 513373 cc2f25a272e991ab94f0f8c141df4a1c5c4cf166
push id9898
push usermsreckovic@mozilla.com
push dateFri, 22 Jan 2016 18:46:51 +0000
reviewersmstange
bugs1187464
milestone46.0a1
Bug 1187464: Part 1. We can get the wrong texture source type, so deal with it. r?mstange
gfx/2d/Logging.h
gfx/layers/basic/BasicCompositor.cpp
--- a/gfx/2d/Logging.h
+++ b/gfx/2d/Logging.h
@@ -126,16 +126,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 =