Bug 1291054 (Part 3) - Rename Decoder::GetSize() to Decoder::Size() to be consistent with the style guide. r=edwin
authorSeth Fowler <mark.seth.fowler@gmail.com>
Fri, 29 Jul 2016 14:11:19 -0700
changeset 349119 a2f8694f12c890db95ccfecd929a201d03ddb99d
parent 349118 5c5ceb44358d1839180ad7220d3c233c0bd25c09
child 349120 21260281d5013a679b80f1fe7103c1337347a736
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin
bugs1291054
milestone51.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 1291054 (Part 3) - Rename Decoder::GetSize() to Decoder::Size() to be consistent with the style guide. r=edwin
image/Decoder.cpp
image/Decoder.h
image/decoders/nsBMPDecoder.cpp
image/decoders/nsGIFDecoder2.cpp
image/decoders/nsICODecoder.cpp
image/decoders/nsIconDecoder.cpp
image/decoders/nsJPEGDecoder.cpp
image/decoders/nsPNGDecoder.cpp
image/test/gtest/TestDecoders.cpp
image/test/gtest/TestMetadata.cpp
--- a/image/Decoder.cpp
+++ b/image/Decoder.cpp
@@ -448,17 +448,17 @@ Decoder::PostFrameStop(Opacity aFrameOpa
   mProgress |= FLAG_FRAME_COMPLETE;
 
   mLoopLength += aTimeout;
 
   // If we're not sending partial invalidations, then we send an invalidation
   // here when the first frame is complete.
   if (!ShouldSendPartialInvalidations() && mFrameCount == 1) {
     mInvalidRect.UnionRect(mInvalidRect,
-                           gfx::IntRect(gfx::IntPoint(0, 0), GetSize()));
+                           IntRect(IntPoint(), Size()));
   }
 }
 
 void
 Decoder::PostInvalidation(const nsIntRect& aRect,
                           const Maybe<nsIntRect>& aRectAtTargetSize
                             /* = Nothing() */)
 {
--- a/image/Decoder.h
+++ b/image/Decoder.h
@@ -261,33 +261,33 @@ public:
   /// @return true if we know the intrinsic size of the image we're decoding.
   bool HasSize() const { return mImageMetadata.HasSize(); }
 
   /**
    * @return the intrinsic size of the image we're decoding.
    *
    * Illegal to call if HasSize() returns false.
    */
-  gfx::IntSize GetSize() const
+  gfx::IntSize Size() const
   {
     MOZ_ASSERT(HasSize());
     return mImageMetadata.GetSize();
   }
 
   /**
    * @return the output size of this decoder. If this is different than the
    * intrinsic size, then the image will be downscaled during the decoding
    * process.
    *
    * Illegal to call if HasSize() returns false.
    */
   gfx::IntSize OutputSize() const
   {
     return mDownscaler ? mDownscaler->TargetSize()
-                       : GetSize();
+                       : Size();
   }
 
   virtual Telemetry::ID SpeedHistogram();
 
   ImageMetadata& GetImageMetadata() { return mImageMetadata; }
 
   /**
    * @return a weak pointer to the image associated with this decoder. Illegal
@@ -406,18 +406,17 @@ protected:
   nsresult AllocateFrame(uint32_t aFrameNum,
                          const nsIntSize& aTargetSize,
                          const nsIntRect& aFrameRect,
                          gfx::SurfaceFormat aFormat,
                          uint8_t aPaletteDepth = 0);
 
   /// Helper method for decoders which only have 'basic' frame allocation needs.
   nsresult AllocateBasicFrame() {
-    nsIntSize size = GetSize();
-    return AllocateFrame(0, size, nsIntRect(nsIntPoint(), size),
+    return AllocateFrame(0, Size(), gfx::IntRect(gfx::IntPoint(), Size()),
                          gfx::SurfaceFormat::B8G8R8A8);
   }
 
 private:
   /// Report that an error was encountered while decoding.
   void PostError();
 
   /**
--- a/image/decoders/nsBMPDecoder.cpp
+++ b/image/decoders/nsBMPDecoder.cpp
@@ -681,17 +681,17 @@ nsBMPDecoder::ReadBitfields(const char* 
     return Transition::TerminateFailure();
   }
   MOZ_ASSERT(mImageData, "Should have a buffer now");
 
   if (mDownscaler) {
     // BMPs store their rows in reverse order, so the downscaler needs to
     // reverse them again when writing its output. Unless the height is
     // negative!
-    rv = mDownscaler->BeginFrame(GetSize(), Nothing(),
+    rv = mDownscaler->BeginFrame(Size(), Nothing(),
                                  mImageData, mMayHaveTransparency,
                                  /* aFlipVertically = */ mH.mHeight >= 0);
     if (NS_FAILED(rv)) {
       return Transition::TerminateFailure();
     }
   }
 
   return Transition::To(State::COLOR_TABLE, mNumColors * mBytesPerColor);
--- a/image/decoders/nsGIFDecoder2.cpp
+++ b/image/decoders/nsGIFDecoder2.cpp
@@ -194,25 +194,25 @@ nsGIFDecoder2::BeginImageFrame(const Int
   Maybe<SurfacePipe> pipe;
   if (mGIFStruct.images_decoded == 0) {
     // The first frame may be displayed progressively.
     pipeFlags |= SurfacePipeFlags::PROGRESSIVE_DISPLAY;
 
     // The first frame is always decoded into an RGB surface.
     pipe =
       SurfacePipeFactory::CreateSurfacePipe(this, mGIFStruct.images_decoded,
-                                            GetSize(), OutputSize(),
+                                            Size(), OutputSize(),
                                             aFrameRect, format, pipeFlags);
   } else {
     // This is an animation frame (and not the first). To minimize the memory
     // usage of animations, the image data is stored in paletted form.
     MOZ_ASSERT(!mDownscaler);
     pipe =
       SurfacePipeFactory::CreatePalettedSurfacePipe(this, mGIFStruct.images_decoded,
-                                                    GetSize(), aFrameRect, format,
+                                                    Size(), aFrameRect, format,
                                                     aDepth, pipeFlags);
   }
 
   mCurrentFrameIndex = mGIFStruct.images_decoded;
 
   if (!pipe) {
     mPipe = SurfacePipe();
     return NS_ERROR_FAILURE;
--- a/image/decoders/nsICODecoder.cpp
+++ b/image/decoders/nsICODecoder.cpp
@@ -577,17 +577,17 @@ nsICODecoder::FinishMask()
 }
 
 LexerTransition<ICOState>
 nsICODecoder::FinishResource()
 {
   // Make sure the actual size of the resource matches the size in the directory
   // entry. If not, we consider the image corrupt.
   if (mContainedDecoder->HasSize() &&
-      mContainedDecoder->GetSize() != GetRealSize()) {
+      mContainedDecoder->Size() != GetRealSize()) {
     return Transition::TerminateFailure();
   }
 
   return Transition::TerminateSuccess();
 }
 
 LexerResult
 nsICODecoder::DoDecode(SourceBufferIterator& aIterator, IResumable* aOnResume)
--- a/image/decoders/nsIconDecoder.cpp
+++ b/image/decoders/nsIconDecoder.cpp
@@ -65,18 +65,18 @@ nsIconDecoder::ReadHeader(const char* aD
 
   // If we're doing a metadata decode, we're done.
   if (IsMetadataDecode()) {
     return Transition::TerminateSuccess();
   }
 
   MOZ_ASSERT(!mImageData, "Already have a buffer allocated?");
   Maybe<SurfacePipe> pipe =
-    SurfacePipeFactory::CreateSurfacePipe(this, 0, GetSize(), OutputSize(),
-                                          IntRect(IntPoint(), GetSize()),
+    SurfacePipeFactory::CreateSurfacePipe(this, 0, Size(), OutputSize(),
+                                          IntRect(IntPoint(), Size()),
                                           SurfaceFormat::B8G8R8A8,
                                           SurfacePipeFlags());
   if (!pipe) {
     return Transition::TerminateFailure();
   }
 
   mPipe = Move(*pipe);
 
--- a/image/decoders/nsJPEGDecoder.cpp
+++ b/image/decoders/nsJPEGDecoder.cpp
@@ -396,17 +396,17 @@ nsJPEGDecoder::ReadJPEGData(const char* 
       MOZ_LOG(sJPEGDecoderAccountingLog, LogLevel::Debug,
              ("} (could not initialize image frame)"));
       return Transition::TerminateFailure();
     }
 
     MOZ_ASSERT(mImageData, "Should have a buffer now");
 
     if (mDownscaler) {
-      nsresult rv = mDownscaler->BeginFrame(GetSize(), Nothing(),
+      nsresult rv = mDownscaler->BeginFrame(Size(), Nothing(),
                                             mImageData,
                                             /* aHasAlpha = */ false);
       if (NS_FAILED(rv)) {
         mState = JPEG_ERROR;
         return Transition::TerminateFailure();
       }
     }
 
--- a/image/decoders/nsPNGDecoder.cpp
+++ b/image/decoders/nsPNGDecoder.cpp
@@ -146,17 +146,17 @@ nsPNGDecoder::~nsPNGDecoder()
 nsPNGDecoder::TransparencyType
 nsPNGDecoder::GetTransparencyType(SurfaceFormat aFormat,
                                   const IntRect& aFrameRect)
 {
   // Check if the image has a transparent color in its palette.
   if (aFormat == SurfaceFormat::B8G8R8A8) {
     return TransparencyType::eAlpha;
   }
-  if (!IntRect(IntPoint(), GetSize()).IsEqualEdges(aFrameRect)) {
+  if (!IntRect(IntPoint(), Size()).IsEqualEdges(aFrameRect)) {
     MOZ_ASSERT(HasAnimation());
     return TransparencyType::eFrameRect;
   }
 
   return TransparencyType::eNone;
 }
 
 void
@@ -208,17 +208,17 @@ nsPNGDecoder::CreateFrame(const FrameInf
                              : SurfacePipeFlags();
 
   if (mNumFrames == 0) {
     // The first frame may be displayed progressively.
     pipeFlags |= SurfacePipeFlags::PROGRESSIVE_DISPLAY;
   }
 
   Maybe<SurfacePipe> pipe =
-    SurfacePipeFactory::CreateSurfacePipe(this, mNumFrames, GetSize(),
+    SurfacePipeFactory::CreateSurfacePipe(this, mNumFrames, Size(),
                                           OutputSize(), aFrameInfo.mFrameRect,
                                           format, pipeFlags);
 
   if (!pipe) {
     mPipe = SurfacePipe();
     return NS_ERROR_FAILURE;
   }
 
--- a/image/test/gtest/TestDecoders.cpp
+++ b/image/test/gtest/TestDecoders.cpp
@@ -50,17 +50,17 @@ CheckDecoderState(const ImageTestCase& a
   EXPECT_TRUE(bool(progress & FLAG_DECODE_COMPLETE));
   EXPECT_TRUE(bool(progress & FLAG_FRAME_COMPLETE));
   EXPECT_EQ(bool(aTestCase.mFlags & TEST_CASE_IS_TRANSPARENT),
             bool(progress & FLAG_HAS_TRANSPARENCY));
   EXPECT_EQ(bool(aTestCase.mFlags & TEST_CASE_IS_ANIMATED),
             bool(progress & FLAG_IS_ANIMATED));
 
   // The decoder should get the correct size.
-  IntSize size = aDecoder->GetSize();
+  IntSize size = aDecoder->Size();
   EXPECT_EQ(aTestCase.mSize.width, size.width);
   EXPECT_EQ(aTestCase.mSize.height, size.height);
 
   // Get the current frame, which is always the first frame of the image
   // because CreateAnonymousDecoder() forces a first-frame-only decode.
   RawAccessFrameRef currentFrame = aDecoder->GetCurrentFrameRef();
   RefPtr<SourceSurface> surface = currentFrame->GetSurface();
 
--- a/image/test/gtest/TestMetadata.cpp
+++ b/image/test/gtest/TestMetadata.cpp
@@ -83,17 +83,17 @@ CheckMetadata(const ImageTestCase& aTest
     return;
   }
 
   EXPECT_TRUE(decoder->GetDecodeDone() && !decoder->HasError());
 
   // Check that we got the expected metadata.
   EXPECT_TRUE(metadataProgress & FLAG_SIZE_AVAILABLE);
 
-  IntSize metadataSize = decoder->GetSize();
+  IntSize metadataSize = decoder->Size();
   EXPECT_EQ(aTestCase.mSize.width, metadataSize.width);
   EXPECT_EQ(aTestCase.mSize.height, metadataSize.height);
 
   bool expectTransparency = aBMPWithinICO == BMPWithinICO::YES
                           ? true
                           : bool(aTestCase.mFlags & TEST_CASE_IS_TRANSPARENT);
   EXPECT_EQ(expectTransparency, bool(metadataProgress & FLAG_HAS_TRANSPARENCY));
 
@@ -117,17 +117,17 @@ CheckMetadata(const ImageTestCase& aTest
   EXPECT_TRUE(decoder->GetDecodeDone() && !decoder->HasError());
   Progress fullProgress = decoder->TakeProgress();
 
   // If the metadata decoder set a progress bit, the full decoder should also
   // have set the same bit.
   EXPECT_EQ(fullProgress, metadataProgress | fullProgress);
 
   // The full decoder and the metadata decoder should agree on the image's size.
-  IntSize fullSize = decoder->GetSize();
+  IntSize fullSize = decoder->Size();
   EXPECT_EQ(metadataSize.width, fullSize.width);
   EXPECT_EQ(metadataSize.height, fullSize.height);
 
   // We should not discover transparency during the full decode that we didn't
   // discover during the metadata decode, unless the image is animated.
   EXPECT_TRUE(!(fullProgress & FLAG_HAS_TRANSPARENCY) ||
               (metadataProgress & FLAG_HAS_TRANSPARENCY) ||
               (fullProgress & FLAG_IS_ANIMATED));