Bug 1116719 - Remove Image::FrameRect. r=tn

This commit is contained in:
Seth Fowler 2015-01-07 01:40:23 -08:00
parent 9d88e055e0
commit 9d237b161e
16 changed files with 8 additions and 111 deletions

View File

@ -165,16 +165,6 @@ ClippedImage::ShouldClip()
NS_IMPL_ISUPPORTS_INHERITED0(ClippedImage, ImageWrapper)
nsIntRect
ClippedImage::FrameRect(uint32_t aWhichFrame)
{
if (!ShouldClip()) {
return InnerImage()->FrameRect(aWhichFrame);
}
return nsIntRect(0, 0, mClip.width, mClip.height);
}
NS_IMETHODIMP
ClippedImage::GetWidth(int32_t* aWidth)
{

View File

@ -31,8 +31,6 @@ class ClippedImage : public ImageWrapper
public:
NS_DECL_ISUPPORTS_INHERITED
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
NS_IMETHOD GetWidth(int32_t* aWidth) MOZ_OVERRIDE;
NS_IMETHOD GetHeight(int32_t* aHeight) MOZ_OVERRIDE;
NS_IMETHOD GetIntrinsicSize(nsSize* aSize) MOZ_OVERRIDE;

View File

@ -36,13 +36,6 @@ DynamicImage::GetProgressTracker()
return nullptr;
}
nsIntRect
DynamicImage::FrameRect(uint32_t aWhichFrame)
{
gfxIntSize size(mDrawable->Size());
return nsIntRect(0, 0, size.width, size.height);
}
size_t
DynamicImage::SizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const
{

View File

@ -34,7 +34,6 @@ public:
virtual nsresult Init(const char* aMimeType, uint32_t aFlags) MOZ_OVERRIDE;
virtual already_AddRefed<ProgressTracker> GetProgressTracker() MOZ_OVERRIDE;
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
virtual size_t SizeOfSourceWithComputedFallback(
MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfDecoded(gfxMemoryLocation aLocation,

View File

@ -13,12 +13,6 @@ namespace image {
NS_IMPL_ISUPPORTS_INHERITED0(FrozenImage, ImageWrapper)
nsIntRect
FrozenImage::FrameRect(uint32_t /* aWhichFrame - ignored */)
{
return InnerImage()->FrameRect(FRAME_FIRST);
}
void
FrozenImage::IncrementAnimationConsumers()
{

View File

@ -31,7 +31,6 @@ class FrozenImage : public ImageWrapper
public:
NS_DECL_ISUPPORTS_INHERITED
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
virtual void IncrementAnimationConsumers() MOZ_OVERRIDE;
virtual void DecrementAnimationConsumers() MOZ_OVERRIDE;

View File

@ -70,11 +70,6 @@ public:
virtual already_AddRefed<ProgressTracker> GetProgressTracker() = 0;
virtual void SetProgressTracker(ProgressTracker* aProgressTracker) {}
/**
* The rectangle defining the location and size of the given frame.
*/
virtual nsIntRect FrameRect(uint32_t aWhichFrame) = 0;
/**
* The size, in bytes, occupied by the compressed source data of the image.
* If MallocSizeOf does not work on this platform, uses a fallback approach to

View File

@ -33,12 +33,6 @@ ImageWrapper::GetProgressTracker()
return mInnerImage->GetProgressTracker();
}
nsIntRect
ImageWrapper::FrameRect(uint32_t aWhichFrame)
{
return mInnerImage->FrameRect(aWhichFrame);
}
size_t
ImageWrapper::SizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const
{

View File

@ -25,7 +25,6 @@ public:
virtual nsresult Init(const char* aMimeType, uint32_t aFlags) MOZ_OVERRIDE;
virtual already_AddRefed<ProgressTracker> GetProgressTracker() MOZ_OVERRIDE;
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
virtual size_t
SizeOfSourceWithComputedFallback( MallocSizeOf aMallocSizeOf) const

View File

@ -26,29 +26,6 @@ namespace image {
NS_IMPL_ISUPPORTS_INHERITED0(OrientedImage, ImageWrapper)
nsIntRect
OrientedImage::FrameRect(uint32_t aWhichFrame)
{
nsresult rv;
// Retrieve the frame rect of the inner image.
nsIntRect innerRect = InnerImage()->FrameRect(aWhichFrame);
if (mOrientation.IsIdentity()) {
return innerRect;
}
// Get the underlying image's dimensions.
nsIntSize size;
rv = InnerImage()->GetWidth(&size.width);
NS_ENSURE_SUCCESS(rv, innerRect);
rv = InnerImage()->GetHeight(&size.height);
NS_ENSURE_SUCCESS(rv, innerRect);
// Transform the frame rect.
gfxRect finalRect = OrientationMatrix(size).TransformBounds(innerRect);
return nsIntRect(finalRect.x, finalRect.y, finalRect.width, finalRect.height);
}
NS_IMETHODIMP
OrientedImage::GetWidth(int32_t* aWidth)
{

View File

@ -28,8 +28,6 @@ class OrientedImage : public ImageWrapper
public:
NS_DECL_ISUPPORTS_INHERITED
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
NS_IMETHOD GetWidth(int32_t* aWidth) MOZ_OVERRIDE;
NS_IMETHOD GetHeight(int32_t* aHeight) MOZ_OVERRIDE;
NS_IMETHOD GetIntrinsicSize(nsSize* aSize) MOZ_OVERRIDE;

View File

@ -387,16 +387,18 @@ ProgressTracker::SyncNotify(IProgressObserver* aObserver)
"ProgressTracker::SyncNotify", "uri", spec.get());
#endif
nsIntRect r;
nsIntRect rect;
if (mImage) {
// XXX - Should only send partial rects here, but that needs to
// wait until we fix up the observer interface
r = mImage->FrameRect(imgIContainer::FRAME_CURRENT);
if (NS_FAILED(mImage->GetWidth(&rect.width)) ||
NS_FAILED(mImage->GetHeight(&rect.height))) {
// Either the image has no intrinsic size, or it has an error.
rect = nsIntRect::GetMaxSizedIntRect();
}
}
ObserverArray array;
array.AppendElement(aObserver);
SyncNotifyInternal(array, !!mImage, mProgress, r);
SyncNotifyInternal(array, !!mImage, mProgress, rect);
}
void

View File

@ -650,40 +650,6 @@ RasterImage::IsOpaque()
return !(progress & FLAG_HAS_TRANSPARENCY);
}
nsIntRect
RasterImage::FrameRect(uint32_t aWhichFrame)
{
if (aWhichFrame > FRAME_MAX_VALUE) {
NS_WARNING("aWhichFrame outside valid range!");
return nsIntRect();
}
if (!mHasFirstFrame) {
return nsIntRect();
}
if (GetNumFrames() == 1) {
return nsIntRect(0, 0, mSize.width, mSize.height);
}
// We must be animated, so get the requested frame from our FrameBlender.
MOZ_ASSERT(mFrameBlender, "We should be animated here");
nsRefPtr<imgFrame> frame =
mFrameBlender->RawGetFrame(GetRequestedFrameIndex(aWhichFrame));
// 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 ProgressTracker (when it wants to figure out
// dirty rectangles to send out batched observer updates). This should
// probably be revisited when we fix bug 503973.
return nsIntRect();
}
void
RasterImage::OnSurfaceDiscarded()
{

View File

@ -159,7 +159,7 @@ public:
// Methods inherited from Image
nsresult Init(const char* aMimeType,
uint32_t aFlags) MOZ_OVERRIDE;
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
virtual void OnSurfaceDiscarded() MOZ_OVERRIDE;
// Raster-specific methods

View File

@ -359,12 +359,6 @@ VectorImage::Init(const char* aMimeType,
return NS_OK;
}
nsIntRect
VectorImage::FrameRect(uint32_t aWhichFrame)
{
return nsIntRect::GetMaxSizedIntRect();
}
size_t
VectorImage::SizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const
{

View File

@ -40,7 +40,6 @@ public:
// Methods inherited from Image
nsresult Init(const char* aMimeType,
uint32_t aFlags) MOZ_OVERRIDE;
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
virtual size_t SizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfDecoded(gfxMemoryLocation aLocation,