Bug 1100725 (Part 2) - Consume all the contained decoder's invalidations in nsICODecoder. r=tn
authorSeth Fowler <seth@mozilla.com>
Tue, 18 Nov 2014 01:48:48 -0800
changeset 240529 09a58fd3c8c6b301a5c75417dc5c74ee9d179e56
parent 240528 7c1a12019ef03d2ecb5826bd0a5e49b910e3dd69
child 240530 5c28ff9fa6873d8991d68e25791778a18c1b4f18
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1100725
milestone36.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 1100725 (Part 2) - Consume all the contained decoder's invalidations in nsICODecoder. r=tn
image/decoders/nsICODecoder.cpp
image/src/Decoder.h
--- a/image/decoders/nsICODecoder.cpp
+++ b/image/decoders/nsICODecoder.cpp
@@ -79,16 +79,17 @@ nsICODecoder::FinishInternal()
   // We shouldn't be called in error cases
   NS_ABORT_IF_FALSE(!HasError(), "Shouldn't call FinishInternal after error!");
 
   // Finish the internally used decoder as well
   if (mContainedDecoder) {
     mContainedDecoder->FinishSharedDecoder();
     mDecodeDone = mContainedDecoder->GetDecodeDone();
     mProgress |= mContainedDecoder->GetProgress();
+    mInvalidRect.Union(mContainedDecoder->TakeInvalidRect());
   }
 }
 
 // Returns a buffer filled with the bitmap file header in little endian:
 // Signature 2 bytes 'BM'
 // FileSize      4 bytes File size in bytes
 // reserved      4 bytes unused (=0)
 // DataOffset    4 bytes File offset to Raster Data
@@ -592,16 +593,17 @@ nsICODecoder::WriteInternal(const char* 
 }
 
 bool
 nsICODecoder::WriteToContainedDecoder(const char* aBuffer, uint32_t aCount,
                                       DecodeStrategy aStrategy)
 {
   mContainedDecoder->Write(aBuffer, aCount, aStrategy);
   mProgress |= mContainedDecoder->GetProgress();
+  mInvalidRect.Union(mContainedDecoder->TakeInvalidRect());
   if (mContainedDecoder->HasDataError()) {
     mDataError = mContainedDecoder->HasDataError();
   }
   if (mContainedDecoder->HasDecoderError()) {
     PostDecoderError(mContainedDecoder->GetDecoderError());
   }
   return !HasError();
 }
@@ -637,16 +639,17 @@ nsICODecoder::NeedsNewFrame() const
 
 nsresult
 nsICODecoder::AllocateFrame()
 {
   if (mContainedDecoder) {
     nsresult rv = mContainedDecoder->AllocateFrame();
     mCurrentFrame = mContainedDecoder->GetCurrentFrame();
     mProgress |= mContainedDecoder->GetProgress();
+    mInvalidRect.Union(mContainedDecoder->TakeInvalidRect());
     return rv;
   }
 
   return Decoder::AllocateFrame();
 }
 
 } // namespace image
 } // namespace mozilla
--- a/image/src/Decoder.h
+++ b/image/src/Decoder.h
@@ -225,33 +225,32 @@ protected:
 
   /*
    * Member variables.
    *
    */
   RasterImage &mImage;
   nsRefPtr<imgFrame> mCurrentFrame;
   ImageMetadata mImageMetadata;
+  nsIntRect mInvalidRect; // Tracks an invalidation region in the current frame.
   Progress mProgress;
 
   uint8_t* mImageData;       // Pointer to image data in either Cairo or 8bit format
   uint32_t mImageDataLength;
   uint32_t* mColormap;       // Current colormap to be used in Cairo format
   uint32_t mColormapSize;
 
   uint32_t mDecodeFlags;
   size_t mBytesDecoded;
   bool mDecodeDone;
   bool mDataError;
 
 private:
   uint32_t mFrameCount; // Number of frames, including anything in-progress
 
-  nsIntRect mInvalidRect; // Tracks an invalidation region in the current frame.
-
   nsresult mFailCode;
 
   struct NewFrameData
   {
     NewFrameData()
     {}
 
     NewFrameData(uint32_t num, uint32_t offsetx, uint32_t offsety,