summaryrefslogtreecommitdiffstats
path: root/image/decoders/nsGIFDecoder2.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-11-28 23:10:30 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-11-28 23:10:30 +0100
commit088c3cf890cc2d96f2093e2116612cbf65bfaeea (patch)
treeb4d3c68155f2de43432dd00c167d3029732be146 /image/decoders/nsGIFDecoder2.cpp
parentec3829bf7266ebec111f41268c6c491356576df1 (diff)
parentfe11e14d3cfc2900facf152257acda87280b6cdc (diff)
downloadUXP-088c3cf890cc2d96f2093e2116612cbf65bfaeea.tar
UXP-088c3cf890cc2d96f2093e2116612cbf65bfaeea.tar.gz
UXP-088c3cf890cc2d96f2093e2116612cbf65bfaeea.tar.lz
UXP-088c3cf890cc2d96f2093e2116612cbf65bfaeea.tar.xz
UXP-088c3cf890cc2d96f2093e2116612cbf65bfaeea.zip
Merge branch 'master' into Sync-weave
Diffstat (limited to 'image/decoders/nsGIFDecoder2.cpp')
-rw-r--r--image/decoders/nsGIFDecoder2.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/image/decoders/nsGIFDecoder2.cpp b/image/decoders/nsGIFDecoder2.cpp
index 7955438e4..6f2be1fa1 100644
--- a/image/decoders/nsGIFDecoder2.cpp
+++ b/image/decoders/nsGIFDecoder2.cpp
@@ -187,6 +187,14 @@ nsGIFDecoder2::BeginImageFrame(const IntRect& aFrameRect,
// Make sure there's no animation if we're downscaling.
MOZ_ASSERT_IF(Size() != OutputSize(), !GetImageMetadata().HasAnimation());
+ AnimationParams animParams {
+ aFrameRect,
+ FrameTimeout::FromRawMilliseconds(mGIFStruct.delay_time),
+ uint32_t(mGIFStruct.images_decoded),
+ BlendMethod::OVER,
+ DisposalMethod(mGIFStruct.disposal_method)
+ };
+
SurfacePipeFlags pipeFlags = aIsInterlaced
? SurfacePipeFlags::DEINTERLACE
: SurfacePipeFlags();
@@ -198,17 +206,24 @@ nsGIFDecoder2::BeginImageFrame(const IntRect& aFrameRect,
// The first frame is always decoded into an RGB surface.
pipe =
- SurfacePipeFactory::CreateSurfacePipe(this, mGIFStruct.images_decoded,
- Size(), OutputSize(),
- aFrameRect, format, pipeFlags);
+ SurfacePipeFactory::CreateSurfacePipe(this, Size(), OutputSize(),
+ aFrameRect, format,
+ Some(animParams), 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.
+ //
+ // We should never use paletted surfaces with a draw target directly, so
+ // the only practical difference between B8G8R8A8 and B8G8R8X8 is the
+ // cleared pixel value if we get truncated. We want 0 in that case to
+ // ensure it is an acceptable value for the color map as was the case
+ // historically.
MOZ_ASSERT(Size() == OutputSize());
pipe =
- SurfacePipeFactory::CreatePalettedSurfacePipe(this, mGIFStruct.images_decoded,
- Size(), aFrameRect, format,
- aDepth, pipeFlags);
+ SurfacePipeFactory::CreatePalettedSurfacePipe(this, Size(), aFrameRect,
+ SurfaceFormat::B8G8R8A8,
+ aDepth, Some(animParams),
+ pipeFlags);
}
mCurrentFrameIndex = mGIFStruct.images_decoded;
@@ -249,9 +264,7 @@ nsGIFDecoder2::EndImageFrame()
mGIFStruct.images_decoded++;
// Tell the superclass we finished a frame
- PostFrameStop(opacity,
- DisposalMethod(mGIFStruct.disposal_method),
- FrameTimeout::FromRawMilliseconds(mGIFStruct.delay_time));
+ PostFrameStop(opacity);
// Reset the transparent pixel
if (mOldColor) {