summaryrefslogtreecommitdiffstats
path: root/image/decoders/nsPNGDecoder.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-11-21 13:34:01 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-11-21 13:34:01 +0100
commit3417e581ce76662131e8089de19b05af20a7fe19 (patch)
tree82022858bd64d6ca4b1023d0317355b621d8b0aa /image/decoders/nsPNGDecoder.cpp
parent622098073e132995994fac4d61e3629d08ee1801 (diff)
downloadUXP-3417e581ce76662131e8089de19b05af20a7fe19.tar
UXP-3417e581ce76662131e8089de19b05af20a7fe19.tar.gz
UXP-3417e581ce76662131e8089de19b05af20a7fe19.tar.lz
UXP-3417e581ce76662131e8089de19b05af20a7fe19.tar.xz
UXP-3417e581ce76662131e8089de19b05af20a7fe19.zip
Bug 1462355 - Part 1c. Make individual image decoders to use updated Decoder/SurfacePipe methods.
Extend this change to nsWebPDecoder.cpp
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