Bug 1187464: Part 1. We can get the wrong texture source type, so deal with it. r?mstange
--- 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 =