Bug 952354 - Draw non-premultiplied alpha raster image frames if the frame is opaque. r=jrmuizel

--HG--
extra : rebase_source : 62956f725b3a4765a7617a37bf79b4be2e37c739
This commit is contained in:
Seth Fowler 2014-03-04 17:59:03 -08:00
parent 05be99d38f
commit f46941cf7a

View File

@ -2616,8 +2616,16 @@ RasterImage::Draw(gfxContext *aContext,
NS_ENSURE_ARG_POINTER(aContext);
// We can only draw with the default decode flags
if (mFrameDecodeFlags != DECODE_FLAGS_DEFAULT) {
// We can only draw without discarding and redecoding in these cases:
// * We have the default decode flags.
// * We have exactly FLAG_DECODE_NO_PREMULTIPLY_ALPHA and the current frame
// is opaque.
bool haveDefaultFlags = (mFrameDecodeFlags == DECODE_FLAGS_DEFAULT);
bool haveSafeAlphaFlags =
(mFrameDecodeFlags == FLAG_DECODE_NO_PREMULTIPLY_ALPHA) &&
FrameIsOpaque(FRAME_CURRENT);
if (!(haveDefaultFlags || haveSafeAlphaFlags)) {
if (!CanForciblyDiscardAndRedecode())
return NS_ERROR_NOT_AVAILABLE;
ForceDiscard();