@@ -698,28 +698,14 @@ NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
698698RasterImage::GetFrame (uint32_t aWhichFrame,
699699 uint32_t aFlags)
700700{
701- return GetFrameInternal (mSize , aWhichFrame, aFlags).second ().forget ();
702- }
703-
704- NS_IMETHODIMP_ (already_AddRefed<SourceSurface>)
705- RasterImage::GetFrameAtSize (const IntSize& aSize,
706- uint32_t aWhichFrame,
707- uint32_t aFlags)
708- {
709- return GetFrameInternal (aSize, aWhichFrame, aFlags).second ().forget ();
701+ return GetFrameInternal (aWhichFrame, aFlags).second ().forget ();
710702}
711703
712704Pair<DrawResult, RefPtr<SourceSurface>>
713- RasterImage::GetFrameInternal (const IntSize& aSize,
714- uint32_t aWhichFrame,
715- uint32_t aFlags)
705+ RasterImage::GetFrameInternal (uint32_t aWhichFrame, uint32_t aFlags)
716706{
717707 MOZ_ASSERT (aWhichFrame <= FRAME_MAX_VALUE );
718708
719- if (aSize.IsEmpty ()) {
720- return MakePair (DrawResult::BAD_ARGS , RefPtr<SourceSurface>());
721- }
722-
723709 if (aWhichFrame > FRAME_MAX_VALUE ) {
724710 return MakePair (DrawResult::BAD_ARGS , RefPtr<SourceSurface>());
725711 }
@@ -732,7 +718,7 @@ RasterImage::GetFrameInternal(const IntSize& aSize,
732718 // not waiting for the data to be loaded from the network or not passing
733719 // FLAG_SYNC_DECODE
734720 DrawableFrameRef frameRef =
735- LookupFrame (GetRequestedFrameIndex (aWhichFrame), aSize , aFlags);
721+ LookupFrame (GetRequestedFrameIndex (aWhichFrame), mSize , aFlags);
736722 if (!frameRef) {
737723 // The OS threw this frame away and we couldn't redecode it.
738724 return MakePair (DrawResult::TEMPORARY_ERROR , RefPtr<SourceSurface>());
@@ -741,15 +727,15 @@ RasterImage::GetFrameInternal(const IntSize& aSize,
741727 // If this frame covers the entire image, we can just reuse its existing
742728 // surface.
743729 RefPtr<SourceSurface> frameSurf;
744- if (!frameRef->NeedsPadding () &&
745- frameRef->GetSize () == aSize) {
730+ IntRect frameRect = frameRef->GetRect ();
731+ if (frameRect.x == 0 && frameRect.y == 0 &&
732+ frameRect.width == mSize .width &&
733+ frameRect.height == mSize .height ) {
746734 frameSurf = frameRef->GetSurface ();
747735 }
748736
749737 // The image doesn't have a usable surface because it's been optimized away or
750- // because it's a partial update frame from an animation. Create one. (In this
751- // case we fall back to returning a surface at our intrinsic size, even if a
752- // different size was originally specified.)
738+ // because it's a partial update frame from an animation. Create one.
753739 if (!frameSurf) {
754740 frameSurf = CopyFrame (aWhichFrame, aFlags);
755741 }
@@ -770,7 +756,7 @@ RasterImage::GetCurrentImage(ImageContainer* aContainer, uint32_t aFlags)
770756 DrawResult drawResult;
771757 RefPtr<SourceSurface> surface;
772758 Tie (drawResult, surface) =
773- GetFrameInternal (mSize , FRAME_CURRENT , aFlags | FLAG_ASYNC_NOTIFY );
759+ GetFrameInternal (FRAME_CURRENT , aFlags | FLAG_ASYNC_NOTIFY );
774760 if (!surface) {
775761 // The OS threw out some or all of our buffer. We'll need to wait for the
776762 // redecode (which was automatically triggered by GetFrame) to complete.
0 commit comments