Bug 803349 - Restore NS_DECL_IMGICONTAINER to VectorImage / RasterImage. r=joe

This commit is contained in:
Seth Fowler 2012-10-19 13:27:11 -07:00
parent b57068badb
commit 0a022d333f
5 changed files with 38 additions and 60 deletions

View File

@ -101,24 +101,20 @@ Image::DecrementAnimationConsumers()
EvaluateAnimation();
}
//******************************************************************************
/* attribute unsigned short animationMode; */
NS_IMETHODIMP
Image::GetAnimationMode(uint16_t* aAnimationMode)
nsresult
Image::GetAnimationModeInternal(uint16_t* aAnimationMode)
{
if (mError)
return NS_ERROR_FAILURE;
NS_ENSURE_ARG_POINTER(aAnimationMode);
*aAnimationMode = mAnimationMode;
return NS_OK;
}
//******************************************************************************
/* attribute unsigned short animationMode; */
NS_IMETHODIMP
Image::SetAnimationMode(uint16_t aAnimationMode)
nsresult
Image::SetAnimationModeInternal(uint16_t aAnimationMode)
{
if (mError)
return NS_ERROR_FAILURE;
@ -127,7 +123,7 @@ Image::SetAnimationMode(uint16_t aAnimationMode)
aAnimationMode == kDontAnimMode ||
aAnimationMode == kLoopOnceAnimMode,
"Wrong Animation Mode is being set!");
mAnimationMode = aAnimationMode;
EvaluateAnimation();

View File

@ -15,10 +15,6 @@ namespace image {
class Image : public imgIContainer
{
public:
// From NS_DECL_IMGICONTAINER:
NS_IMETHOD GetAnimationMode(uint16_t *aAnimationMode);
NS_IMETHOD SetAnimationMode(uint16_t aAnimationMode);
imgStatusTracker& GetStatusTracker() { return *mStatusTracker; }
/**
@ -102,6 +98,11 @@ public:
protected:
Image(imgStatusTracker* aStatusTracker);
// Shared functionality for implementors of imgIContainer. Every
// implementation of attribute animationMode should forward here.
nsresult GetAnimationModeInternal(uint16_t *aAnimationMode);
nsresult SetAnimationModeInternal(uint16_t aAnimationMode);
/**
* Decides whether animation should or should not be happening,
* and makes sure the right thing is being done.

View File

@ -147,33 +147,11 @@ class RasterImage : public Image
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPROPERTIES
NS_DECL_IMGICONTAINER
#ifdef DEBUG
NS_DECL_IMGICONTAINERDEBUG
#endif
// BEGIN NS_DECL_IMGICONTAINER (minus GetAnimationMode/SetAnimationMode)
// ** Don't edit this chunk except to mirror changes in imgIContainer.idl **
NS_IMETHOD GetWidth(int32_t *aWidth);
NS_IMETHOD GetHeight(int32_t *aHeight);
NS_IMETHOD GetType(uint16_t *aType);
NS_IMETHOD_(uint16_t) GetType(void);
NS_IMETHOD GetAnimated(bool *aAnimated);
NS_IMETHOD GetCurrentFrameIsOpaque(bool *aCurrentFrameIsOpaque);
NS_IMETHOD GetFrame(uint32_t aWhichFrame, uint32_t aFlags, gfxASurface **_retval);
NS_IMETHOD GetImageContainer(mozilla::layers::ImageContainer **_retval);
NS_IMETHOD CopyFrame(uint32_t aWhichFrame, uint32_t aFlags, gfxImageSurface **_retval);
NS_IMETHOD ExtractFrame(uint32_t aWhichFrame, const nsIntRect & aRect, uint32_t aFlags, imgIContainer **_retval);
NS_IMETHOD Draw(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter, const gfxMatrix & aUserSpaceToImageSpace, const gfxRect & aFill, const nsIntRect & aSubimage, const nsIntSize & aViewportSize, uint32_t aFlags);
NS_IMETHOD_(nsIFrame *) GetRootLayoutFrame(void);
NS_IMETHOD RequestDecode();
NS_IMETHOD StartDecoding();
NS_IMETHOD LockImage(void);
NS_IMETHOD UnlockImage(void);
NS_IMETHOD RequestDiscard(void);
NS_IMETHOD ResetAnimation(void);
NS_IMETHOD_(void) RequestRefresh(const mozilla::TimeStamp& aTime);
// END NS_DECL_IMGICONTAINER
RasterImage(imgStatusTracker* aStatusTracker = nullptr);
virtual ~RasterImage();
@ -752,6 +730,14 @@ protected:
bool ShouldAnimate();
};
inline NS_IMETHODIMP RasterImage::GetAnimationMode(uint16_t *aAnimationMode) {
return GetAnimationModeInternal(aAnimationMode);
}
inline NS_IMETHODIMP RasterImage::SetAnimationMode(uint16_t aAnimationMode) {
return SetAnimationModeInternal(aAnimationMode);
}
// Asynchronous Decode Requestor
//
// We use this class when someone calls requestDecode() from within a decode

View File

@ -381,6 +381,15 @@ VectorImage::GetFrame(uint32_t aWhichFrame,
return rv;
}
//******************************************************************************
/* [noscript] ImageContainer getImageContainer(); */
NS_IMETHODIMP
VectorImage::GetImageContainer(mozilla::layers::ImageContainer** _retval)
{
*_retval = nullptr;
return NS_OK;
}
//******************************************************************************
/* [noscript] gfxImageSurface copyFrame(in uint32_t aWhichFrame,
* in uint32_t aFlags); */

View File

@ -30,29 +30,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER
// BEGIN NS_DECL_IMGICONTAINER (minus GetAnimationMode/SetAnimationMode)
// ** Don't edit this chunk except to mirror changes in imgIContainer.idl **
NS_IMETHOD GetWidth(int32_t *aWidth);
NS_IMETHOD GetHeight(int32_t *aHeight);
NS_IMETHOD GetType(uint16_t *aType);
NS_IMETHOD_(uint16_t) GetType(void);
NS_IMETHOD GetAnimated(bool *aAnimated);
NS_IMETHOD GetCurrentFrameIsOpaque(bool *aCurrentFrameIsOpaque);
NS_IMETHOD GetFrame(uint32_t aWhichFrame, uint32_t aFlags, gfxASurface **_retval);
NS_IMETHOD GetImageContainer(mozilla::layers::ImageContainer **_retval) { *_retval = NULL; return NS_OK; }
NS_IMETHOD CopyFrame(uint32_t aWhichFrame, uint32_t aFlags, gfxImageSurface **_retval);
NS_IMETHOD ExtractFrame(uint32_t aWhichFrame, const nsIntRect & aRect, uint32_t aFlags, imgIContainer **_retval);
NS_IMETHOD Draw(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter, const gfxMatrix & aUserSpaceToImageSpace, const gfxRect & aFill, const nsIntRect & aSubimage, const nsIntSize & aViewportSize, uint32_t aFlags);
NS_IMETHOD_(nsIFrame *) GetRootLayoutFrame(void);
NS_IMETHOD RequestDecode();
NS_IMETHOD StartDecoding();
NS_IMETHOD LockImage(void);
NS_IMETHOD UnlockImage(void);
NS_IMETHOD RequestDiscard(void);
NS_IMETHOD ResetAnimation(void);
NS_IMETHOD_(void) RequestRefresh(const mozilla::TimeStamp& aTime);
// END NS_DECL_IMGICONTAINER
NS_DECL_IMGICONTAINER
VectorImage(imgStatusTracker* aStatusTracker = nullptr);
virtual ~VectorImage();
@ -101,6 +79,14 @@ private:
// created via ExtractFrame?
};
inline NS_IMETHODIMP VectorImage::GetAnimationMode(uint16_t *aAnimationMode) {
return GetAnimationModeInternal(aAnimationMode);
}
inline NS_IMETHODIMP VectorImage::SetAnimationMode(uint16_t aAnimationMode) {
return SetAnimationModeInternal(aAnimationMode);
}
} // namespace image
} // namespace mozilla