Bug 1290759 - Convert frame number check in Decoder::AllocateFrame() into an assert. r=edwin
authorSeth Fowler <mark.seth.fowler@gmail.com>
Sun, 31 Jul 2016 14:41:10 -0700
changeset 307583 9d668735beb37a324c6b17337cfacf0b181849d4
parent 307582 7d45b49f61d5026ac5ad5f0c36509a018dea3926
child 307586 8351f6e097ebecc28be5b1e8314d4fbed3fb2528
push id80138
push userseth.bugzilla@blackhail.net
push dateTue, 02 Aug 2016 00:40:12 +0000
treeherdermozilla-inbound@9d668735beb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin
bugs1290759
milestone50.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 1290759 - Convert frame number check in Decoder::AllocateFrame() into an assert. r=edwin
image/Decoder.cpp
--- a/image/Decoder.cpp
+++ b/image/Decoder.cpp
@@ -266,24 +266,26 @@ Decoder::AllocateFrame(uint32_t aFrameNu
                                         aFormat, aPaletteDepth,
                                         mCurrentFrame.get());
 
   if (mCurrentFrame) {
     // Gather the raw pointers the decoders will use.
     mCurrentFrame->GetImageData(&mImageData, &mImageDataLength);
     mCurrentFrame->GetPaletteData(&mColormap, &mColormapSize);
 
-    if (aFrameNum + 1 == mFrameCount) {
-      // If we're past the first frame, PostIsAnimated() should've been called.
-      MOZ_ASSERT_IF(mFrameCount > 1, HasAnimation());
+    // We should now be on |aFrameNum|. (Note that we're comparing the frame
+    // number, which is zero-based, with the frame count, which is one-based.)
+    MOZ_ASSERT(aFrameNum + 1 == mFrameCount);
 
-      // Update our state to reflect the new frame
-      MOZ_ASSERT(!mInFrame, "Starting new frame but not done with old one!");
-      mInFrame = true;
-    }
+    // If we're past the first frame, PostIsAnimated() should've been called.
+    MOZ_ASSERT_IF(mFrameCount > 1, HasAnimation());
+
+    // Update our state to reflect the new frame.
+    MOZ_ASSERT(!mInFrame, "Starting new frame but not done with old one!");
+    mInFrame = true;
   }
 
   return mCurrentFrame ? NS_OK : NS_ERROR_FAILURE;
 }
 
 RawAccessFrameRef
 Decoder::AllocateFrameInternal(uint32_t aFrameNum,
                                const nsIntSize& aTargetSize,