Bug 1120141. Don't use surface with alpha for first frames of all pngs. r=edwin
authorTimothy Nikkel <tnikkel@gmail.com>
Wed, 24 Feb 2016 09:56:03 -0600
changeset 285338 b3d204d5c6b730c12d5d63c6b29815b7a35f4e81
parent 285337 ee07c6a974bccea9ccf6b3bdcf4874b79308b188
child 285339 8b1a92589f261739d31465457b2bea65f5a16518
push id72327
push usertnikkel@gmail.com
push dateWed, 24 Feb 2016 15:56:12 +0000
treeherdermozilla-inbound@b3d204d5c6b7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin
bugs1120141
milestone47.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 1120141. Don't use surface with alpha for first frames of all pngs. r=edwin It was a hack, not needed anymore.
image/decoders/nsPNGDecoder.cpp
--- a/image/decoders/nsPNGDecoder.cpp
+++ b/image/decoders/nsPNGDecoder.cpp
@@ -145,33 +145,26 @@ nsPNGDecoder::CreateFrame(png_uint_32 aX
                           gfx::SurfaceFormat aFormat)
 {
   MOZ_ASSERT(HasSize());
   MOZ_ASSERT(!IsMetadataDecode());
 
   IntRect frameRect(aXOffset, aYOffset, aWidth, aHeight);
   CheckForTransparency(aFormat, frameRect);
 
-  // XXX(seth): Some tests depend on the first frame of PNGs being B8G8R8A8.
-  // This is something we should fix.
-  gfx::SurfaceFormat format = aFormat;
-  if (mNumFrames == 0) {
-    format = gfx::SurfaceFormat::B8G8R8A8;
-  }
-
   // Make sure there's no animation or padding if we're downscaling.
   MOZ_ASSERT_IF(mDownscaler, !GetImageMetadata().HasAnimation());
   MOZ_ASSERT_IF(mDownscaler,
                 IntRect(IntPoint(), GetSize()).IsEqualEdges(frameRect));
 
   IntSize targetSize = mDownscaler ? mDownscaler->TargetSize()
                                    : GetSize();
   IntRect targetFrameRect = mDownscaler ? IntRect(IntPoint(), targetSize)
                                         : frameRect;
-  nsresult rv = AllocateFrame(mNumFrames, targetSize, targetFrameRect, format);
+  nsresult rv = AllocateFrame(mNumFrames, targetSize, targetFrameRect, aFormat);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   mFrameRect = frameRect;
 
   MOZ_LOG(sPNGDecoderAccountingLog, LogLevel::Debug,
          ("PNGDecoderAccounting: nsPNGDecoder::CreateFrame -- created "