Bug 1201796 (Part 2) - Add GetFrameAtSize() to support downscale-during-decode for GetFrame() use cases. r=tn
This commit is contained in:
@@ -168,10 +168,18 @@ DynamicImage::GetFrame(uint32_t aWhichFrame,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
gfxIntSize size(mDrawable->Size());
|
||||
return GetFrameAtSize(IntSize(size.width, size.height),
|
||||
aWhichFrame,
|
||||
aFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
|
||||
DynamicImage::GetFrameAtSize(const IntSize& aSize,
|
||||
uint32_t aWhichFrame,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
RefPtr<DrawTarget> dt = gfxPlatform::GetPlatform()->
|
||||
CreateOffscreenContentDrawTarget(IntSize(size.width, size.height),
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
CreateOffscreenContentDrawTarget(aSize, SurfaceFormat::B8G8R8A8);
|
||||
if (!dt) {
|
||||
gfxWarning() <<
|
||||
"DynamicImage::GetFrame failed in CreateOffscreenContentDrawTarget";
|
||||
@@ -179,7 +187,7 @@ DynamicImage::GetFrame(uint32_t aWhichFrame,
|
||||
}
|
||||
nsRefPtr<gfxContext> context = new gfxContext(dt);
|
||||
|
||||
auto result = Draw(context, size, ImageRegion::Create(size),
|
||||
auto result = Draw(context, aSize, ImageRegion::Create(aSize),
|
||||
aWhichFrame, GraphicsFilter::FILTER_NEAREST,
|
||||
Nothing(), aFlags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user