From 3417e581ce76662131e8089de19b05af20a7fe19 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 21 Nov 2018 13:34:01 +0100 Subject: Bug 1462355 - Part 1c. Make individual image decoders to use updated Decoder/SurfacePipe methods. Extend this change to nsWebPDecoder.cpp --- image/decoders/nsPNGDecoder.cpp | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'image/decoders/nsPNGDecoder.cpp') 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 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 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 -- cgit v1.2.3