diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-11-28 23:10:30 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-11-28 23:10:30 +0100 |
commit | 088c3cf890cc2d96f2093e2116612cbf65bfaeea (patch) | |
tree | b4d3c68155f2de43432dd00c167d3029732be146 /image/decoders/nsPNGDecoder.cpp | |
parent | ec3829bf7266ebec111f41268c6c491356576df1 (diff) | |
parent | fe11e14d3cfc2900facf152257acda87280b6cdc (diff) | |
download | UXP-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/nsPNGDecoder.cpp')
-rw-r--r-- | image/decoders/nsPNGDecoder.cpp | 41 |
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 |