From d65b91dd1fd7a2d1568447a7793a9f39eea4b3d5 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sun, 1 Apr 2012 16:31:21 -0500 Subject: [PATCH] Bug 740841. If the image is not decoded already in RasterImage::GetFrame we will ignore the passed in decode flags. r=joe --- image/src/RasterImage.cpp | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index 78266ebaa62a..a0fd4dd71961 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -880,23 +880,21 @@ RasterImage::GetFrame(PRUint32 aWhichFrame, nsresult rv = NS_OK; - if (mDecoded) { - // If we have decoded data, and it is not a perfect match for what we are - // looking for, we must discard to be able to generate the proper data. - PRUint32 desiredDecodeFlags = aFlags & DECODE_FLAGS_MASK; - if (desiredDecodeFlags != mFrameDecodeFlags) { - // if we can't discard, then we're screwed; we have no way - // to re-decode. Similarly if we aren't allowed to do a sync - // decode. - if (!(aFlags & FLAG_SYNC_DECODE)) - return NS_ERROR_NOT_AVAILABLE; - if (!CanForciblyDiscard() || mDecoder || mAnim) - return NS_ERROR_NOT_AVAILABLE; - - ForceDiscard(); - - mFrameDecodeFlags = desiredDecodeFlags; - } + // If we have decoded data, and it is not a perfect match for what we are + // looking for, we must discard to be able to generate the proper data. + PRUint32 desiredDecodeFlags = aFlags & DECODE_FLAGS_MASK; + if (desiredDecodeFlags != mFrameDecodeFlags) { + // if we can't discard, then we're screwed; we have no way + // to re-decode. Similarly if we aren't allowed to do a sync + // decode. + if (!(aFlags & FLAG_SYNC_DECODE)) + return NS_ERROR_NOT_AVAILABLE; + if (!CanForciblyDiscard() || mDecoder || mAnim) + return NS_ERROR_NOT_AVAILABLE; + + ForceDiscard(); + + mFrameDecodeFlags = desiredDecodeFlags; } // If the caller requested a synchronous decode, do it