Bug 1355763 - Only premult if there's something to premult.
MozReview-Commit-ID: LKd2tWWxGbI
--- a/dom/canvas/ImageBitmap.cpp
+++ b/dom/canvas/ImageBitmap.cpp
@@ -619,18 +619,19 @@ ImageBitmap::PrepareForDrawTarget(gfx::D
// Make mCropRect match new surface we've cropped to
mPictureRect.MoveTo(0, 0);
}
// Pre-multiply alpha here.
// Ignore this step if the source surface does not have alpha channel; this
// kind of source surfaces might come form layers::PlanarYCbCrImage.
- MOZ_ASSERT(IsOpaque(mSurface->GetFormat()) == (mAlphaType == gfxAlphaType::Opaque));
- if (mAlphaType == gfxAlphaType::NonPremult) {
+ if (mAlphaType == gfxAlphaType::NonPremult &&
+ !IsOpaque(mSurface->GetFormat()))
+ {
MOZ_ASSERT(mSurface->GetFormat() == SurfaceFormat::R8G8B8A8 ||
mSurface->GetFormat() == SurfaceFormat::B8G8R8A8 ||
mSurface->GetFormat() == SurfaceFormat::A8R8G8B8);
RefPtr<DataSourceSurface> dstSurface = mSurface->GetDataSurface();
MOZ_ASSERT(dstSurface);
RefPtr<DataSourceSurface> srcSurface;