summaryrefslogtreecommitdiffstats
path: root/image/decoders/nsPNGDecoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'image/decoders/nsPNGDecoder.cpp')
-rw-r--r--image/decoders/nsPNGDecoder.cpp41
1 files changed, 23 insertions, 18 deletions
diff --git a/image/decoders/nsPNGDecoder.cpp b/image/decoders/nsPNGDecoder.cpp
index 9596ae7d6..1f19c41bc 100644
--- a/image/decoders/nsPNGDecoder.cpp
+++ b/image/decoders/nsPNGDecoder.cpp
@@ -208,6 +208,25 @@ nsPNGDecoder::CreateFrame(const FrameInfo& aFrameInfo)
MOZ_ASSERT_IF(Size() != OutputSize(),
transparency != TransparencyType::eFrameRect);
+ Maybe<AnimationParams> animParams;
+#ifdef PNG_APNG_SUPPORTED
+ if (png_get_valid(mPNG, mInfo, PNG_INFO_acTL)) {
+ mAnimInfo = AnimFrameInfo(mPNG, mInfo);
+
+ if (mAnimInfo.mDispose == DisposalMethod::CLEAR) {
+ // We may have to display the background under this image during
+ // animation playback, so we regard it as transparent.
+ PostHasTransparency();
+ }
+
+ animParams.emplace(AnimationParams {
+ aFrameInfo.mFrameRect,
+ FrameTimeout::FromRawMilliseconds(mAnimInfo.mTimeout),
+ mNumFrames, mAnimInfo.mBlend, mAnimInfo.mDispose
+ });
+ }
+#endif
+
// If this image is interlaced, we can display better quality intermediate
// results to the user by post processing them with ADAM7InterpolatingFilter.
SurfacePipeFlags pipeFlags = aFrameInfo.mIsInterlaced
@@ -220,9 +239,9 @@ nsPNGDecoder::CreateFrame(const FrameInfo& aFrameInfo)
}
Maybe<SurfacePipe> pipe =
- SurfacePipeFactory::CreateSurfacePipe(this, mNumFrames, Size(),
- OutputSize(), aFrameInfo.mFrameRect,
- format, pipeFlags);
+ SurfacePipeFactory::CreateSurfacePipe(this, Size(), OutputSize(),
+ aFrameInfo.mFrameRect, format,
+ animParams, pipeFlags);
if (!pipe) {
mPipe = SurfacePipe();
@@ -239,18 +258,6 @@ nsPNGDecoder::CreateFrame(const FrameInfo& aFrameInfo)
"image frame with %dx%d pixels for decoder %p",
mFrameRect.width, mFrameRect.height, this));
-#ifdef PNG_APNG_SUPPORTED
- if (png_get_valid(mPNG, mInfo, PNG_INFO_acTL)) {
- mAnimInfo = AnimFrameInfo(mPNG, mInfo);
-
- if (mAnimInfo.mDispose == DisposalMethod::CLEAR) {
- // We may have to display the background under this image during
- // animation playback, so we regard it as transparent.
- PostHasTransparency();
- }
- }
-#endif
-
return NS_OK;
}
@@ -269,9 +276,7 @@ nsPNGDecoder::EndImageFrame()
opacity = Opacity::FULLY_OPAQUE;
}
- PostFrameStop(opacity, mAnimInfo.mDispose,
- FrameTimeout::FromRawMilliseconds(mAnimInfo.mTimeout),
- mAnimInfo.mBlend, Some(mFrameRect));
+ PostFrameStop(opacity);
}
nsresult