Bug 999266 - Switch DrawPixelSnapped to gfx::SurfaceFormat, r=mattwoodrow

This commit is contained in:
Michael Wu 2014-04-19 21:03:35 -04:00
parent c0332f9eca
commit c5b519ba15
5 changed files with 9 additions and 12 deletions

View File

@ -300,7 +300,7 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable,
const gfxMatrix& aUserSpaceToImageSpace,
const gfxRect& aSourceRect,
const gfxRect& aSubimage,
const gfxImageFormat aFormat)
const SurfaceFormat aFormat)
{
PROFILER_LABEL("gfxUtils", "CreateSamplingRestricedDrawable");
gfxRect userSpaceClipExtents = aContext->GetClipExtents();
@ -334,9 +334,9 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable,
nsRefPtr<gfxASurface> temp = image->GetSubimage(needed);
drawable = new gfxSurfaceDrawable(temp, size, gfxMatrix().Translate(-needed.TopLeft()));
} else {
mozilla::RefPtr<mozilla::gfx::DrawTarget> target =
RefPtr<DrawTarget> target =
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(ToIntSize(size),
ImageFormatToSurfaceFormat(aFormat));
aFormat);
if (!target) {
return nullptr;
}
@ -504,7 +504,7 @@ gfxUtils::DrawPixelSnapped(gfxContext* aContext,
const gfxRect& aSourceRect,
const gfxRect& aImageRect,
const gfxRect& aFill,
const gfxImageFormat aFormat,
const SurfaceFormat aFormat,
GraphicsFilter aFilter,
uint32_t aImageFlags)
{

View File

@ -70,7 +70,7 @@ public:
const gfxRect& aSourceRect,
const gfxRect& aImageRect,
const gfxRect& aFill,
const gfxImageFormat aFormat,
const mozilla::gfx::SurfaceFormat aFormat,
GraphicsFilter aFilter,
uint32_t aImageFlags = imgIContainer::FLAG_NONE);

View File

@ -251,7 +251,7 @@ ClippedImage::GetFrameInternal(const nsIntSize& aViewportSize,
gfxRect imageRect(0, 0, mClip.width, mClip.height);
gfxUtils::DrawPixelSnapped(ctx, drawable, gfxMatrix(),
imageRect, imageRect, imageRect, imageRect,
gfxImageFormat::ARGB32,
SurfaceFormat::B8G8R8A8,
GraphicsFilter::FILTER_FAST);
// Cache the resulting surface.
@ -336,7 +336,7 @@ ClippedImage::Draw(gfxContext* aContext,
gfxRect subimage(aSubimage.x, aSubimage.y, aSubimage.width, aSubimage.height);
gfxUtils::DrawPixelSnapped(aContext, drawable, aUserSpaceToImageSpace,
subimage, sourceRect, imageRect, aFill,
gfxImageFormat::ARGB32, aFilter);
SurfaceFormat::B8G8R8A8, aFilter);
return NS_OK;
}

View File

@ -100,13 +100,10 @@ OrientedImage::GetFrame(uint32_t aWhichFrame,
// Determine an appropriate format for the surface.
gfx::SurfaceFormat surfaceFormat;
gfxImageFormat imageFormat;
if (InnerImage()->FrameIsOpaque(aWhichFrame)) {
surfaceFormat = gfx::SurfaceFormat::B8G8R8X8;
imageFormat = gfxImageFormat::ARGB32;
} else {
surfaceFormat = gfx::SurfaceFormat::B8G8R8A8;
imageFormat = gfxImageFormat::ARGB32;
}
// Create a surface to draw into.
@ -126,7 +123,7 @@ OrientedImage::GetFrame(uint32_t aWhichFrame,
gfxRect imageRect(0, 0, width, height);
gfxUtils::DrawPixelSnapped(ctx, drawable, OrientationMatrix(nsIntSize(width, height)),
imageRect, imageRect, imageRect, imageRect,
imageFormat, GraphicsFilter::FILTER_FAST);
surfaceFormat, GraphicsFilter::FILTER_FAST);
return target->Snapshot();
}

View File

@ -4867,7 +4867,7 @@ nsLayoutUtils::DrawPixelSnapped(nsRenderingContext* aRenderingContext,
gfxUtils::DrawPixelSnapped(ctx, aDrawable,
drawingParams.mUserSpaceToImageSpace, subimage,
sourceRect, imageRect, drawingParams.mFillRect,
gfxImageFormat::ARGB32, aFilter);
gfx::SurfaceFormat::B8G8R8A8, aFilter);
}
/* static */ nsresult