Bug 836155 - Replace GetCurrentFrameRect() with FrameRect(aWhichFrame). r=joe

This commit is contained in:
Seth Fowler 2013-02-04 16:06:14 -08:00
Родитель 41916bc9e5
Коммит 0762d9279f
6 изменённых файлов: 29 добавлений и 26 удалений

Просмотреть файл

@ -65,10 +65,9 @@ public:
virtual imgStatusTracker& GetStatusTracker() = 0;
/**
* The rectangle defining the location and size of the currently displayed
* frame.
* The rectangle defining the location and size of the given frame.
*/
virtual void GetCurrentFrameRect(nsIntRect& aRect) = 0;
virtual nsIntRect FrameRect(uint32_t aWhichFrame) = 0;
/**
* The size, in bytes, occupied by the significant data portions of the image.

Просмотреть файл

@ -905,24 +905,29 @@ RasterImage::FrameIsOpaque(uint32_t aWhichFrame)
framerect.IsEqualInterior(nsIntRect(0, 0, mSize.width, mSize.height));
}
void
RasterImage::GetCurrentFrameRect(nsIntRect& aRect)
nsIntRect
RasterImage::FrameRect(uint32_t aWhichFrame)
{
// Get the current frame
imgFrame* curframe = GetCurrentImgFrame();
if (aWhichFrame > FRAME_MAX_VALUE) {
NS_WARNING("aWhichFrame outside valid range!");
return nsIntRect();
}
// If we have the frame, use that rectangle
if (curframe) {
aRect = curframe->GetRect();
} else {
// If the frame doesn't exist, we pass the empty rectangle. It's not clear
// Get the requested frame.
imgFrame* frame = aWhichFrame == FRAME_FIRST ? GetImgFrame(0)
: GetCurrentImgFrame();
// If we have the frame, use that rectangle.
if (frame) {
return frame->GetRect();
}
// If the frame doesn't exist, we return the empty rectangle. It's not clear
// whether this is appropriate in general, but at the moment the only
// consumer of this method is imgStatusTracker (when it wants to figure out
// dirty rectangles to send out batched observer updates). This should
// probably be revisited when we fix bug 503973.
aRect.MoveTo(0, 0);
aRect.SizeTo(0, 0);
}
return nsIntRect();
}
uint32_t

Просмотреть файл

@ -160,7 +160,7 @@ public:
nsresult Init(imgDecoderObserver* aObserver,
const char* aMimeType,
uint32_t aFlags);
virtual void GetCurrentFrameRect(nsIntRect& aRect) MOZ_OVERRIDE;
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
// Raster-specific methods
static NS_METHOD WriteToRasterImage(nsIInputStream* aIn, void* aClosure,

Просмотреть файл

@ -213,10 +213,10 @@ VectorImage::Init(imgDecoderObserver* aObserver,
return NS_OK;
}
void
VectorImage::GetCurrentFrameRect(nsIntRect& aRect)
nsIntRect
VectorImage::FrameRect(uint32_t aWhichFrame)
{
aRect = nsIntRect::GetMaxSizedIntRect();
return nsIntRect::GetMaxSizedIntRect();
}
size_t

Просмотреть файл

@ -40,7 +40,7 @@ public:
nsresult Init(imgDecoderObserver* aObserver,
const char* aMimeType,
uint32_t aFlags);
virtual void GetCurrentFrameRect(nsIntRect& aRect) MOZ_OVERRIDE;
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
virtual size_t HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const;
virtual size_t HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const;

Просмотреть файл

@ -371,8 +371,7 @@ imgStatusTracker::SyncNotify(imgRequestProxy* proxy)
// OnDataAvailable
// XXX - Should only send partial rects here, but that needs to
// wait until we fix up the observer interface
nsIntRect r;
mImage->GetCurrentFrameRect(r);
nsIntRect r(mImage->FrameRect(imgIContainer::FRAME_CURRENT));
// If there's any content in this frame at all (always true for
// vector images, true for raster images that have decoded at