Bug 587800: Move GetCurrentFrameIndex & GetNumFrames from Image to RasterImage. r=bholley a=blocking

This commit is contained in:
Daniel Holbert 2010-08-23 15:44:07 -07:00
parent 3e6fd6e245
commit 03b9bef68e
3 changed files with 15 additions and 15 deletions

View File

@ -89,17 +89,6 @@ public:
*/
virtual void GetCurrentFrameRect(nsIntRect& aRect) = 0;
/**
* The index of the current frame that would be drawn if the image was to be
* drawn now.
*/
virtual PRUint32 GetCurrentFrameIndex() = 0;
/**
* The total number of frames in this image.
*/
virtual PRUint32 GetNumFrames() = 0;
/**
* The size, in bytes, occupied by the significant data portions of the image.
* This includes both compressed source data and decoded frames.

View File

@ -167,8 +167,6 @@ public:
const char* aMimeType,
PRUint32 aFlags);
void GetCurrentFrameRect(nsIntRect& aRect);
PRUint32 GetCurrentFrameIndex();
PRUint32 GetNumFrames();
PRUint32 GetDataSize();
// Raster-specific methods
@ -177,6 +175,13 @@ public:
PRUint32 aToOffset, PRUint32 aCount,
PRUint32* aWriteCount);
/* The index of the current frame that would be drawn if the image was to be
* drawn now. */
PRUint32 GetCurrentFrameIndex();
/* The total number of frames in this image. */
PRUint32 GetNumFrames();
PRUint32 GetDecodedDataSize();
PRUint32 GetSourceDataSize();

View File

@ -44,6 +44,7 @@
#include "imgRequestProxy.h"
#include "Image.h"
#include "ImageLogging.h"
#include "RasterImage.h"
using namespace mozilla::imagelib;
@ -222,9 +223,14 @@ imgStatusTracker::SyncNotify(imgRequestProxy* proxy)
if (mState & stateDecodeStarted)
proxy->OnStartDecode();
PRInt16 imageType = mImage->GetType();
// Send frame messages (OnStartFrame, OnDataAvailable, OnStopFrame)
if (mImage->GetNumFrames() > 0) {
PRUint32 frame = mImage->GetCurrentFrameIndex();
if (imageType == imgIContainer::TYPE_VECTOR ||
static_cast<RasterImage*>(mImage)->GetNumFrames() > 0) {
PRUint32 frame = (imageType == imgIContainer::TYPE_VECTOR) ?
0 : static_cast<RasterImage*>(mImage)->GetCurrentFrameIndex();
proxy->OnStartFrame(frame);
// OnDataAvailable