Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 08de069

Browse files
committed
Backed out 8 changesets (bug 1201796, bug 1196066) for mulet gij(28) failures CLOSED TREE
Backed out changeset 159d5d2946d3 (bug 1201796) Backed out changeset 958988218976 (bug 1201796) Backed out changeset 494e7553d641 (bug 1201796) Backed out changeset d58149411b7d (bug 1201796) Backed out changeset 35bd769b49f8 (bug 1196066) Backed out changeset e4f3d4279b4c (bug 1196066) Backed out changeset ca467297fa07 (bug 1196066) Backed out changeset b4851ce6637d (bug 1196066) --HG-- rename : image/test/crashtests/invalid_ico_height.ico => image/test/reftest/ico/ico-bmp-corrupted/invalid_ico_height.ico rename : image/test/crashtests/invalid_ico_width.ico => image/test/reftest/ico/ico-bmp-corrupted/invalid_ico_width.ico extra : rebase_source : 5232674f1cf0ef4d7f70568f627547c0151a801f
1 parent 53b6eb3 commit 08de069

35 files changed

Lines changed: 478 additions & 1274 deletions

image/ClippedImage.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,6 @@ ClippedImage::GetFrame(uint32_t aWhichFrame,
220220
return GetFrameInternal(mClip.Size(), Nothing(), aWhichFrame, aFlags);
221221
}
222222

223-
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
224-
ClippedImage::GetFrameAtSize(const IntSize& aSize,
225-
uint32_t aWhichFrame,
226-
uint32_t aFlags)
227-
{
228-
// XXX(seth): It'd be nice to support downscale-during-decode for this case,
229-
// but right now we just fall back to the intrinsic size.
230-
return GetFrame(aWhichFrame, aFlags);
231-
}
232-
233223
already_AddRefed<SourceSurface>
234224
ClippedImage::GetFrameInternal(const nsIntSize& aSize,
235225
const Maybe<SVGImageContext>& aSVGContext,

image/ClippedImage.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ class ClippedImage : public ImageWrapper
3737
NS_IMETHOD GetIntrinsicRatio(nsSize* aRatio) override;
3838
NS_IMETHOD_(already_AddRefed<SourceSurface>)
3939
GetFrame(uint32_t aWhichFrame, uint32_t aFlags) override;
40-
NS_IMETHOD_(already_AddRefed<SourceSurface>)
41-
GetFrameAtSize(const gfx::IntSize& aSize,
42-
uint32_t aWhichFrame,
43-
uint32_t aFlags) override;
4440
NS_IMETHOD_(bool) IsImageContainerAvailable(layers::LayerManager* aManager,
4541
uint32_t aFlags) override;
4642
NS_IMETHOD_(already_AddRefed<layers::ImageContainer>)

image/DynamicImage.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,26 +168,18 @@ DynamicImage::GetFrame(uint32_t aWhichFrame,
168168
uint32_t aFlags)
169169
{
170170
gfxIntSize size(mDrawable->Size());
171-
return GetFrameAtSize(IntSize(size.width, size.height),
172-
aWhichFrame,
173-
aFlags);
174-
}
175171

176-
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
177-
DynamicImage::GetFrameAtSize(const IntSize& aSize,
178-
uint32_t aWhichFrame,
179-
uint32_t aFlags)
180-
{
181172
RefPtr<DrawTarget> dt = gfxPlatform::GetPlatform()->
182-
CreateOffscreenContentDrawTarget(aSize, SurfaceFormat::B8G8R8A8);
173+
CreateOffscreenContentDrawTarget(IntSize(size.width, size.height),
174+
SurfaceFormat::B8G8R8A8);
183175
if (!dt) {
184176
gfxWarning() <<
185177
"DynamicImage::GetFrame failed in CreateOffscreenContentDrawTarget";
186178
return nullptr;
187179
}
188180
nsRefPtr<gfxContext> context = new gfxContext(dt);
189181

190-
auto result = Draw(context, aSize, ImageRegion::Create(aSize),
182+
auto result = Draw(context, size, ImageRegion::Create(size),
191183
aWhichFrame, GraphicsFilter::FILTER_NEAREST,
192184
Nothing(), aFlags);
193185

image/FrozenImage.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ FrozenImage::GetFrame(uint32_t aWhichFrame,
4444
return InnerImage()->GetFrame(FRAME_FIRST, aFlags);
4545
}
4646

47-
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
48-
FrozenImage::GetFrameAtSize(const IntSize& aSize,
49-
uint32_t aWhichFrame,
50-
uint32_t aFlags)
51-
{
52-
return InnerImage()->GetFrameAtSize(aSize, FRAME_FIRST, aFlags);
53-
}
54-
5547
NS_IMETHODIMP_(bool)
5648
FrozenImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
5749
{

image/FrozenImage.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ class FrozenImage : public ImageWrapper
3737
NS_IMETHOD GetAnimated(bool* aAnimated) override;
3838
NS_IMETHOD_(already_AddRefed<SourceSurface>)
3939
GetFrame(uint32_t aWhichFrame, uint32_t aFlags) override;
40-
NS_IMETHOD_(already_AddRefed<SourceSurface>)
41-
GetFrameAtSize(const gfx::IntSize& aSize,
42-
uint32_t aWhichFrame,
43-
uint32_t aFlags) override;
4440
NS_IMETHOD_(bool) IsImageContainerAvailable(layers::LayerManager* aManager,
4541
uint32_t aFlags) override;
4642
NS_IMETHOD_(already_AddRefed<layers::ImageContainer>)

image/ImageFactory.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ ShouldDownscaleDuringDecode(const nsCString& aMimeType)
3838
DecoderType type = DecoderFactory::GetDecoderType(aMimeType.get());
3939
return type == DecoderType::JPEG ||
4040
type == DecoderType::ICON ||
41-
type == DecoderType::ICO ||
4241
type == DecoderType::PNG ||
4342
type == DecoderType::BMP ||
4443
type == DecoderType::GIF;
@@ -143,13 +142,7 @@ ImageFactory::CreateAnonymousImage(const nsCString& aMimeType)
143142
newTracker->SetImage(newImage);
144143
newImage->SetProgressTracker(newTracker);
145144

146-
uint32_t imageFlags = Image::INIT_FLAG_SYNC_LOAD;
147-
if (gfxPrefs::ImageDownscaleDuringDecodeEnabled() &&
148-
ShouldDownscaleDuringDecode(aMimeType)) {
149-
imageFlags |= Image::INIT_FLAG_DOWNSCALE_DURING_DECODE;
150-
}
151-
152-
rv = newImage->Init(aMimeType.get(), imageFlags);
145+
rv = newImage->Init(aMimeType.get(), Image::INIT_FLAG_SYNC_LOAD);
153146
if (NS_FAILED(rv)) {
154147
return BadImage("RasterImage::Init failed", newImage);
155148
}

image/ImageWrapper.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,6 @@ ImageWrapper::GetFrame(uint32_t aWhichFrame,
174174
return mInnerImage->GetFrame(aWhichFrame, aFlags);
175175
}
176176

177-
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
178-
ImageWrapper::GetFrameAtSize(const IntSize& aSize,
179-
uint32_t aWhichFrame,
180-
uint32_t aFlags)
181-
{
182-
return mInnerImage->GetFrameAtSize(aSize, aWhichFrame, aFlags);
183-
}
184-
185177
NS_IMETHODIMP_(bool)
186178
ImageWrapper::IsOpaque()
187179
{

image/OrientedImage.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,6 @@ OrientedImage::GetFrame(uint32_t aWhichFrame,
122122
return target->Snapshot();
123123
}
124124

125-
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
126-
OrientedImage::GetFrameAtSize(const IntSize& aSize,
127-
uint32_t aWhichFrame,
128-
uint32_t aFlags)
129-
{
130-
// XXX(seth): It'd be nice to support downscale-during-decode for this case,
131-
// but right now we just fall back to the intrinsic size.
132-
return GetFrame(aWhichFrame, aFlags);
133-
}
134-
135125
NS_IMETHODIMP_(bool)
136126
OrientedImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
137127
{

image/OrientedImage.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ class OrientedImage : public ImageWrapper
3434
NS_IMETHOD GetIntrinsicRatio(nsSize* aRatio) override;
3535
NS_IMETHOD_(already_AddRefed<SourceSurface>)
3636
GetFrame(uint32_t aWhichFrame, uint32_t aFlags) override;
37-
NS_IMETHOD_(already_AddRefed<SourceSurface>)
38-
GetFrameAtSize(const gfx::IntSize& aSize,
39-
uint32_t aWhichFrame,
40-
uint32_t aFlags) override;
4137
NS_IMETHOD_(bool) IsImageContainerAvailable(layers::LayerManager* aManager,
4238
uint32_t aFlags) override;
4339
NS_IMETHOD_(already_AddRefed<layers::ImageContainer>)

image/RasterImage.cpp

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -698,28 +698,14 @@ NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
698698
RasterImage::GetFrame(uint32_t aWhichFrame,
699699
uint32_t aFlags)
700700
{
701-
return GetFrameInternal(mSize, aWhichFrame, aFlags).second().forget();
702-
}
703-
704-
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
705-
RasterImage::GetFrameAtSize(const IntSize& aSize,
706-
uint32_t aWhichFrame,
707-
uint32_t aFlags)
708-
{
709-
return GetFrameInternal(aSize, aWhichFrame, aFlags).second().forget();
701+
return GetFrameInternal(aWhichFrame, aFlags).second().forget();
710702
}
711703

712704
Pair<DrawResult, RefPtr<SourceSurface>>
713-
RasterImage::GetFrameInternal(const IntSize& aSize,
714-
uint32_t aWhichFrame,
715-
uint32_t aFlags)
705+
RasterImage::GetFrameInternal(uint32_t aWhichFrame, uint32_t aFlags)
716706
{
717707
MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE);
718708

719-
if (aSize.IsEmpty()) {
720-
return MakePair(DrawResult::BAD_ARGS, RefPtr<SourceSurface>());
721-
}
722-
723709
if (aWhichFrame > FRAME_MAX_VALUE) {
724710
return MakePair(DrawResult::BAD_ARGS, RefPtr<SourceSurface>());
725711
}
@@ -732,7 +718,7 @@ RasterImage::GetFrameInternal(const IntSize& aSize,
732718
// not waiting for the data to be loaded from the network or not passing
733719
// FLAG_SYNC_DECODE
734720
DrawableFrameRef frameRef =
735-
LookupFrame(GetRequestedFrameIndex(aWhichFrame), aSize, aFlags);
721+
LookupFrame(GetRequestedFrameIndex(aWhichFrame), mSize, aFlags);
736722
if (!frameRef) {
737723
// The OS threw this frame away and we couldn't redecode it.
738724
return MakePair(DrawResult::TEMPORARY_ERROR, RefPtr<SourceSurface>());
@@ -741,15 +727,15 @@ RasterImage::GetFrameInternal(const IntSize& aSize,
741727
// If this frame covers the entire image, we can just reuse its existing
742728
// surface.
743729
RefPtr<SourceSurface> frameSurf;
744-
if (!frameRef->NeedsPadding() &&
745-
frameRef->GetSize() == aSize) {
730+
IntRect frameRect = frameRef->GetRect();
731+
if (frameRect.x == 0 && frameRect.y == 0 &&
732+
frameRect.width == mSize.width &&
733+
frameRect.height == mSize.height) {
746734
frameSurf = frameRef->GetSurface();
747735
}
748736

749737
// The image doesn't have a usable surface because it's been optimized away or
750-
// because it's a partial update frame from an animation. Create one. (In this
751-
// case we fall back to returning a surface at our intrinsic size, even if a
752-
// different size was originally specified.)
738+
// because it's a partial update frame from an animation. Create one.
753739
if (!frameSurf) {
754740
frameSurf = CopyFrame(aWhichFrame, aFlags);
755741
}
@@ -770,7 +756,7 @@ RasterImage::GetCurrentImage(ImageContainer* aContainer, uint32_t aFlags)
770756
DrawResult drawResult;
771757
RefPtr<SourceSurface> surface;
772758
Tie(drawResult, surface) =
773-
GetFrameInternal(mSize, FRAME_CURRENT, aFlags | FLAG_ASYNC_NOTIFY);
759+
GetFrameInternal(FRAME_CURRENT, aFlags | FLAG_ASYNC_NOTIFY);
774760
if (!surface) {
775761
// The OS threw out some or all of our buffer. We'll need to wait for the
776762
// redecode (which was automatically triggered by GetFrame) to complete.

0 commit comments

Comments
 (0)