Bug 890179. r=seth a=abillings
authorJoe Drew <joe@drew.ca>
Thu, 04 Jul 2013 15:58:26 -0400
changeset 148741 f257dd1c65cab594eb62d5091e12d958038e5dc2
parent 148740 5f5646dc9d94b77c3dff3333d80c9371dbb6ef77
child 148742 5f6979e4afaa6da06adda67dd2cff772c0781017
push id368
push userbbajaj@mozilla.com
push dateMon, 09 Sep 2013 22:57:58 +0000
treeherdermozilla-release@5a4f47ae1217 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth, abillings
bugs890179
milestone24.0a2
Bug 890179. r=seth a=abillings
image/decoders/nsGIFDecoder2.cpp
image/decoders/nsPNGDecoder.cpp
--- a/image/decoders/nsGIFDecoder2.cpp
+++ b/image/decoders/nsGIFDecoder2.cpp
@@ -172,20 +172,21 @@ void nsGIFDecoder2::BeginImageFrame(uint
   if (mGIFStruct.images_decoded) {
     // Image data is stored with original depth and palette
     NeedNewFrame(mGIFStruct.images_decoded, mGIFStruct.x_offset,
                  mGIFStruct.y_offset, mGIFStruct.width, mGIFStruct.height,
                  format, aDepth);
   }
 
   // Our first full frame is automatically created by the image decoding
-  // infrastructure. Just use it as long as we're not creating a subframe.
-  else if (mGIFStruct.x_offset != 0 || mGIFStruct.y_offset != 0 ||
-           int32_t(mGIFStruct.width) != mImageMetadata.GetWidth() ||
-           int32_t(mGIFStruct.height) != mImageMetadata.GetHeight()) {
+  // infrastructure. Just use it as long as it matches up.
+  else if (!GetCurrentFrame()->GetRect().IsEqualEdges(nsIntRect(mGIFStruct.x_offset,
+                                                                mGIFStruct.y_offset,
+                                                                mGIFStruct.width,
+                                                                mGIFStruct.height))) {
     // Regardless of depth of input, image is decoded into 24bit RGB
     NeedNewFrame(mGIFStruct.images_decoded, mGIFStruct.x_offset,
                  mGIFStruct.y_offset, mGIFStruct.width, mGIFStruct.height,
                  format);
   } else {
     // Our preallocated frame matches up, with the possible exception of alpha.
     if (format == gfxASurface::ImageFormatRGB24) {
       GetCurrentFrame()->SetHasNoAlpha();
--- a/image/decoders/nsPNGDecoder.cpp
+++ b/image/decoders/nsPNGDecoder.cpp
@@ -136,21 +136,20 @@ nsPNGDecoder::~nsPNGDecoder()
 }
 
 // CreateFrame() is used for both simple and animated images
 void nsPNGDecoder::CreateFrame(png_uint_32 x_offset, png_uint_32 y_offset,
                                int32_t width, int32_t height,
                                gfxASurface::gfxImageFormat format)
 {
   // Our first full frame is automatically created by the image decoding
-  // infrastructure. Just use it as long as we're not creating a subframe.
+  // infrastructure. Just use it as long as it matches up.
   MOZ_ASSERT(HasSize());
   if (mNumFrames != 0 ||
-      x_offset != 0 || y_offset != 0 ||
-      width != mImageMetadata.GetWidth() || height != mImageMetadata.GetHeight()) {
+      !GetCurrentFrame()->GetRect().IsEqualEdges(nsIntRect(x_offset, y_offset, width, height))) {
     NeedNewFrame(mNumFrames, x_offset, y_offset, width, height, format);
   } else if (mNumFrames == 0) {
     // Our preallocated frame matches up, with the possible exception of alpha.
     if (format == gfxASurface::ImageFormatRGB24) {
       GetCurrentFrame()->SetHasNoAlpha();
     }
   }