From 6c65f4629d68b8d6e4a2eb5245d487b16b40d2a3 Mon Sep 17 00:00:00 2001 From: Seth Fowler Date: Thu, 29 Oct 2015 16:37:42 -0700 Subject: [PATCH] Bug 1207355 (Part 5) - Request decodes intelligently in MultipartImage. r=tn --- image/MultipartImage.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/image/MultipartImage.cpp b/image/MultipartImage.cpp index 4950e7699c8..4eb34bf716f 100644 --- a/image/MultipartImage.cpp +++ b/image/MultipartImage.cpp @@ -70,6 +70,16 @@ public: return; } + // Retrieve the image's intrinsic size. + int32_t width = 0; + int32_t height = 0; + mImage->GetWidth(&width); + mImage->GetHeight(&height); + + // Request decoding at the intrinsic size. + mImage->RequestDecodeForSize(IntSize(width, height), + imgIContainer::DECODE_FLAGS_DEFAULT); + // If there's already an error, we may never get a FRAME_COMPLETE // notification, so go ahead and notify our owner right away. RefPtr tracker = mImage->GetProgressTracker(); @@ -125,7 +135,6 @@ MultipartImage::Init() RefPtr firstPartTracker = InnerImage()->GetProgressTracker(); firstPartTracker->AddObserver(this); - InnerImage()->RequestDecode(); InnerImage()->IncrementAnimationConsumers(); } @@ -154,7 +163,6 @@ MultipartImage::BeginTransitionToPart(Image* aNextPart) // Start observing the next part; we'll complete the transition when // NextPartObserver calls FinishTransition. mNextPartObserver->BeginObserving(mNextPart); - mNextPart->RequestDecode(); mNextPart->IncrementAnimationConsumers(); }