Bug 950553 - Use Moz2D for drawing in OrientedImage. r=seth

This commit is contained in:
Matt Woodrow 2014-01-20 14:17:38 +13:00
parent 83c116b78a
commit 175023e83d

View File

@ -110,9 +110,7 @@ OrientedImage::GetFrame(uint32_t aWhichFrame,
// Create a surface to draw into.
mozilla::RefPtr<mozilla::gfx::DrawTarget> target;
target = gfxPlatform::GetPlatform()->
CreateOffscreenCanvasDrawTarget(gfx::IntSize(width, height), surfaceFormat);
nsRefPtr<gfxASurface> surface = gfxPlatform::GetPlatform()->
GetThebesSurfaceForDrawTarget(target);
CreateOffscreenContentDrawTarget(gfx::IntSize(width, height), surfaceFormat);
// Create our drawable.
nsRefPtr<gfxASurface> innerSurface =
@ -122,11 +120,14 @@ OrientedImage::GetFrame(uint32_t aWhichFrame,
new gfxSurfaceDrawable(innerSurface, gfxIntSize(width, height));
// Draw.
nsRefPtr<gfxContext> ctx = new gfxContext(surface);
nsRefPtr<gfxContext> ctx = new gfxContext(target);
gfxRect imageRect(0, 0, width, height);
gfxUtils::DrawPixelSnapped(ctx, drawable, OrientationMatrix(nsIntSize(width, height)),
imageRect, imageRect, imageRect, imageRect,
imageFormat, GraphicsFilter::FILTER_FAST);
nsRefPtr<gfxASurface> surface = gfxPlatform::GetPlatform()->
GetThebesSurfaceForDrawTarget(target);
return surface.forget();
}