Bug 922942 - Use the screen reference draw target in SVG. r=jwatt

--HG--
extra : rebase_source : 230fd579b052649c59b4e1f5f6725fc60f6a05ae
This commit is contained in:
Matt Woodrow 2013-10-15 13:29:15 +13:00
parent a75a520319
commit 0604fa2aa9
4 changed files with 11 additions and 12 deletions

View File

@ -2559,7 +2559,7 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
GetAppUnitsValues(&processor.mAppUnitsPerDevPixel, nullptr);
processor.mPt = gfxPoint(aX, aY);
processor.mThebes =
new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget());
// If we don't have a target then we don't have a transform. A target won't
// be needed in the case where we're measuring the text size. This allows

View File

@ -35,8 +35,9 @@ struct CharacterPosition {
bool draw;
};
static gfxContext* MakeTmpCtx() {
return new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
static already_AddRefed<gfxContext> MakeTmpCtx() {
nsRefPtr<gfxContext> ctx = new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget());
return ctx.forget();
}
/**

View File

@ -466,7 +466,7 @@ nsSVGImageFrame::ReflowSVG()
return;
}
gfxContext tmpCtx(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
nsRefPtr<gfxContext> tmpCtx = new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget());
// We'd like to just pass the identity matrix to GeneratePath, but if
// this frame's user space size is _very_ large/small then the extents we
@ -485,10 +485,10 @@ nsSVGImageFrame::ReflowSVG()
if (applyScaling) {
scaling.Scale(scaleFactors.width, scaleFactors.height);
}
tmpCtx.Save();
GeneratePath(&tmpCtx, scaling);
tmpCtx.Restore();
gfxRect extent = tmpCtx.GetUserPathExtent();
tmpCtx->Save();
GeneratePath(tmpCtx, scaling);
tmpCtx->Restore();
gfxRect extent = tmpCtx->GetUserPathExtent();
if (applyScaling) {
extent.Scale(1 / scaleFactors.width, 1 / scaleFactors.height);
}

View File

@ -245,8 +245,7 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const nsPoint &aPoint)
bool isHit = false;
nsRefPtr<gfxContext> tmpCtx =
new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
nsRefPtr<gfxContext> tmpCtx = new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget());
GeneratePath(tmpCtx, canvasTM);
gfxPoint userSpacePoint =
@ -408,8 +407,7 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
return bbox;
}
nsRefPtr<gfxContext> tmpCtx =
new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
nsRefPtr<gfxContext> tmpCtx = new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget());
GeneratePath(tmpCtx, aToBBoxUserspace);
tmpCtx->IdentityMatrix();