mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Backed out changeset 560042809ee7 (bug 1119774)
This commit is contained in:
parent
5111b3dc4b
commit
f0998d414e
@ -638,12 +638,12 @@ nsICODecoder::NeedsNewFrame() const
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsICODecoder::AllocateFrame(const nsIntSize& aTargetSize /* = nsIntSize() */)
|
||||
nsICODecoder::AllocateFrame()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (mContainedDecoder) {
|
||||
rv = mContainedDecoder->AllocateFrame(aTargetSize);
|
||||
rv = mContainedDecoder->AllocateFrame();
|
||||
mCurrentFrame = mContainedDecoder->GetCurrentFrameRef();
|
||||
mProgress |= mContainedDecoder->TakeProgress();
|
||||
mInvalidRect.Union(mContainedDecoder->TakeInvalidRect());
|
||||
@ -652,7 +652,7 @@ nsICODecoder::AllocateFrame(const nsIntSize& aTargetSize /* = nsIntSize() */)
|
||||
|
||||
// Grab a strong ref that we'll later hand over to the contained decoder. This
|
||||
// lets us avoid creating a RawAccessFrameRef off-main-thread.
|
||||
rv = Decoder::AllocateFrame(aTargetSize);
|
||||
rv = Decoder::AllocateFrame();
|
||||
mRefForContainedDecoder = GetCurrentFrameRef();
|
||||
return rv;
|
||||
}
|
||||
|
@ -40,8 +40,7 @@ public:
|
||||
|
||||
virtual void WriteInternal(const char* aBuffer, uint32_t aCount) MOZ_OVERRIDE;
|
||||
virtual void FinishInternal() MOZ_OVERRIDE;
|
||||
virtual nsresult AllocateFrame(const nsIntSize& aTargetSize
|
||||
/* = nsIntSize() */) MOZ_OVERRIDE;
|
||||
virtual nsresult AllocateFrame() MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual bool NeedsNewFrame() const MOZ_OVERRIDE;
|
||||
|
@ -328,18 +328,11 @@ Decoder::FinishSharedDecoder()
|
||||
}
|
||||
|
||||
nsresult
|
||||
Decoder::AllocateFrame(const nsIntSize& aTargetSize /* = nsIntSize() */)
|
||||
Decoder::AllocateFrame()
|
||||
{
|
||||
MOZ_ASSERT(mNeedsNewFrame);
|
||||
|
||||
nsIntSize targetSize = aTargetSize;
|
||||
if (targetSize == nsIntSize()) {
|
||||
MOZ_ASSERT(HasSize());
|
||||
targetSize = mImageMetadata.GetSize();
|
||||
}
|
||||
|
||||
mCurrentFrame = EnsureFrame(mNewFrameData.mFrameNum,
|
||||
targetSize,
|
||||
mNewFrameData.mFrameRect,
|
||||
mDecodeFlags,
|
||||
mNewFrameData.mFormat,
|
||||
@ -373,7 +366,6 @@ Decoder::AllocateFrame(const nsIntSize& aTargetSize /* = nsIntSize() */)
|
||||
|
||||
RawAccessFrameRef
|
||||
Decoder::EnsureFrame(uint32_t aFrameNum,
|
||||
const nsIntSize& aTargetSize,
|
||||
const nsIntRect& aFrameRect,
|
||||
uint32_t aDecodeFlags,
|
||||
SurfaceFormat aFormat,
|
||||
@ -391,8 +383,8 @@ Decoder::EnsureFrame(uint32_t aFrameNum,
|
||||
|
||||
// Adding a frame that doesn't already exist. This is the normal case.
|
||||
if (aFrameNum == mFrameCount) {
|
||||
return InternalAddFrame(aFrameNum, aTargetSize, aFrameRect, aDecodeFlags,
|
||||
aFormat, aPaletteDepth, aPreviousFrame);
|
||||
return InternalAddFrame(aFrameNum, aFrameRect, aDecodeFlags, aFormat,
|
||||
aPaletteDepth, aPreviousFrame);
|
||||
}
|
||||
|
||||
// We're replacing a frame. It must be the first frame; there's no reason to
|
||||
@ -435,7 +427,6 @@ Decoder::EnsureFrame(uint32_t aFrameNum,
|
||||
|
||||
RawAccessFrameRef
|
||||
Decoder::InternalAddFrame(uint32_t aFrameNum,
|
||||
const nsIntSize& aTargetSize,
|
||||
const nsIntRect& aFrameRect,
|
||||
uint32_t aDecodeFlags,
|
||||
SurfaceFormat aFormat,
|
||||
@ -447,13 +438,15 @@ Decoder::InternalAddFrame(uint32_t aFrameNum,
|
||||
return RawAccessFrameRef();
|
||||
}
|
||||
|
||||
if (aTargetSize.width <= 0 || aTargetSize.height <= 0 ||
|
||||
MOZ_ASSERT(mImageMetadata.HasSize());
|
||||
nsIntSize imageSize(mImageMetadata.GetWidth(), mImageMetadata.GetHeight());
|
||||
if (imageSize.width <= 0 || imageSize.height <= 0 ||
|
||||
aFrameRect.width <= 0 || aFrameRect.height <= 0) {
|
||||
NS_WARNING("Trying to add frame with zero or negative size");
|
||||
return RawAccessFrameRef();
|
||||
}
|
||||
|
||||
if (!SurfaceCache::CanHold(aTargetSize.ToIntSize())) {
|
||||
if (!SurfaceCache::CanHold(imageSize.ToIntSize())) {
|
||||
NS_WARNING("Trying to add frame that's too large for the SurfaceCache");
|
||||
return RawAccessFrameRef();
|
||||
}
|
||||
@ -461,7 +454,7 @@ Decoder::InternalAddFrame(uint32_t aFrameNum,
|
||||
nsRefPtr<imgFrame> frame = new imgFrame();
|
||||
bool nonPremult =
|
||||
aDecodeFlags & imgIContainer::FLAG_DECODE_NO_PREMULTIPLY_ALPHA;
|
||||
if (NS_FAILED(frame->InitForDecoder(aTargetSize, aFrameRect, aFormat,
|
||||
if (NS_FAILED(frame->InitForDecoder(imageSize, aFrameRect, aFormat,
|
||||
aPaletteDepth, nonPremult))) {
|
||||
NS_WARNING("imgFrame::Init should succeed");
|
||||
return RawAccessFrameRef();
|
||||
@ -475,7 +468,7 @@ Decoder::InternalAddFrame(uint32_t aFrameNum,
|
||||
|
||||
InsertOutcome outcome =
|
||||
SurfaceCache::Insert(frame, ImageKey(mImage.get()),
|
||||
RasterSurfaceKey(aTargetSize.ToIntSize(),
|
||||
RasterSurfaceKey(imageSize.ToIntSize(),
|
||||
aDecodeFlags,
|
||||
aFrameNum),
|
||||
Lifetime::Persistent);
|
||||
@ -611,7 +604,7 @@ Decoder::PostFrameStop(Opacity aFrameOpacity /* = Opacity::TRANSPARENT */,
|
||||
}
|
||||
|
||||
void
|
||||
Decoder::PostInvalidation(const nsIntRect& aRect)
|
||||
Decoder::PostInvalidation(nsIntRect& aRect)
|
||||
{
|
||||
// We should be mid-frame
|
||||
NS_ABORT_IF_FALSE(mInFrame, "Can't invalidate when not mid-frame!");
|
||||
|
@ -277,7 +277,7 @@ public:
|
||||
|
||||
// Try to allocate a frame as described in mNewFrameData and return the
|
||||
// status code from that attempt. Clears mNewFrameData.
|
||||
virtual nsresult AllocateFrame(const nsIntSize& aTargetSize = nsIntSize());
|
||||
virtual nsresult AllocateFrame();
|
||||
|
||||
already_AddRefed<imgFrame> GetCurrentFrame()
|
||||
{
|
||||
@ -352,7 +352,7 @@ protected:
|
||||
|
||||
// Called by the decoders when they have a region to invalidate. We may not
|
||||
// actually pass these invalidations on right away.
|
||||
void PostInvalidation(const nsIntRect& aRect);
|
||||
void PostInvalidation(nsIntRect& aRect);
|
||||
|
||||
// Called by the decoders when they have successfully decoded the image. This
|
||||
// may occur as the result of the decoder getting to the appropriate point in
|
||||
@ -379,14 +379,9 @@ protected:
|
||||
* It is not possible to create sparse frame arrays; you can only append
|
||||
* frames to the current frame array, or if there is only one frame in the
|
||||
* array, replace that frame.
|
||||
* @aTargetSize specifies the target size we're decoding to. If we're not
|
||||
* downscaling during decode, this will always be the same as the image's
|
||||
* intrinsic size.
|
||||
*
|
||||
* If a non-paletted frame is desired, pass 0 for aPaletteDepth.
|
||||
*/
|
||||
RawAccessFrameRef EnsureFrame(uint32_t aFrameNum,
|
||||
const nsIntSize& aTargetSize,
|
||||
const nsIntRect& aFrameRect,
|
||||
uint32_t aDecodeFlags,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
@ -394,7 +389,6 @@ protected:
|
||||
imgFrame* aPreviousFrame);
|
||||
|
||||
RawAccessFrameRef InternalAddFrame(uint32_t aFrameNum,
|
||||
const nsIntSize& aTargetSize,
|
||||
const nsIntRect& aFrameRect,
|
||||
uint32_t aDecodeFlags,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
|
@ -51,7 +51,6 @@ public:
|
||||
bool HasSize() const { return mSize.isSome(); }
|
||||
bool HasOrientation() const { return mOrientation.isSome(); }
|
||||
|
||||
nsIntSize GetSize() const { return *mSize; }
|
||||
int32_t GetWidth() const { return mSize->width; }
|
||||
int32_t GetHeight() const { return mSize->height; }
|
||||
Orientation GetOrientation() const { return *mOrientation; }
|
||||
|
@ -1334,12 +1334,10 @@ RasterImage::CreateDecoder(const Maybe<nsIntSize>& aSize, uint32_t aFlags)
|
||||
// We already have the size; tell the decoder so it can preallocate a
|
||||
// frame. By default, we create an ARGB frame with no offset. If decoders
|
||||
// need a different type, they need to ask for it themselves.
|
||||
// XXX(seth): Note that we call SetSize() and NeedNewFrame() with the
|
||||
// image's intrinsic size, but AllocateFrame with our target size.
|
||||
decoder->SetSize(mSize, mOrientation);
|
||||
decoder->NeedNewFrame(0, 0, 0, aSize->width, aSize->height,
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
decoder->AllocateFrame(*aSize);
|
||||
decoder->AllocateFrame();
|
||||
}
|
||||
decoder->SetIterator(mSourceBuffer->Iterator());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user