Bug 1207355 (Part 7) - Only trigger intrinsic size decode in FinalizeDecoder() if StartDecoding() was called. r=tn
☠☠ backed out by b4c323832f31 ☠ ☠
authorSeth Fowler <mark.seth.fowler@gmail.com>
Wed, 28 Oct 2015 16:40:43 -0700
changeset 270126 9dd950b837fb0759ac94e33506b0ca375b19d893
parent 270125 e941e0e106a1f501424cb08f304455cb1cf9d8b2
child 270127 aafd6db2fbb452350c42a1d839ce96ec6e183b53
push id29599
push usercbook@mozilla.com
push dateThu, 29 Oct 2015 10:49:48 +0000
treeherdermozilla-central@67a788db9f07 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1207355
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1207355 (Part 7) - Only trigger intrinsic size decode in FinalizeDecoder() if StartDecoding() was called. r=tn
image/RasterImage.cpp
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -314,16 +314,19 @@ RasterImage::LookupFrame(uint32_t aFrame
   // If we're opaque, we don't need to care about premultiplied alpha, because
   // that can only matter for frames with transparency.
   if (IsOpaque()) {
     aFlags &= ~FLAG_DECODE_NO_PREMULTIPLY_ALPHA;
   }
 
   IntSize requestedSize = CanDownscaleDuringDecode(aSize, aFlags)
                         ? aSize : mSize;
+  if (requestedSize.IsEmpty()) {
+    return DrawableFrameRef();  // Can't decode to a surface of zero size.
+  }
 
   LookupResult result = LookupFrameInternal(aFrameNum, requestedSize, aFlags);
 
   if (!result && !mHasSize) {
     // We can't request a decode without knowing our intrinsic size. Give up.
     return DrawableFrameRef();
   }
 
@@ -1170,30 +1173,38 @@ RasterImage::RequestDecode()
 {
   return RequestDecodeForSize(mSize, DECODE_FLAGS_DEFAULT);
 }
 
 
 NS_IMETHODIMP
 RasterImage::StartDecoding()
 {
+  if (mError) {
+    return NS_ERROR_FAILURE;
+  }
+
+  if (!mHasSize) {
+    mWantFullDecode = true;
+    return NS_OK;
+  }
+
   return RequestDecodeForSize(mSize, FLAG_SYNC_DECODE_IF_FAST);
 }
 
 NS_IMETHODIMP
 RasterImage::RequestDecodeForSize(const IntSize& aSize, uint32_t aFlags)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mError) {
     return NS_ERROR_FAILURE;
   }
 
   if (!mHasSize) {
-    mWantFullDecode = true;
     return NS_OK;
   }
 
   // Decide whether to sync decode images we can decode quickly. Here we are
   // explicitly trading off flashing for responsiveness in the case that we're
   // redecoding an image (see bug 845147).
   bool shouldSyncDecodeIfFast =
     !mHasBeenDecoded && (aFlags & FLAG_SYNC_DECODE_IF_FAST);