diff --git a/content/canvas/src/CanvasRenderingContext2D.cpp b/content/canvas/src/CanvasRenderingContext2D.cpp index c5e203cbdc4..3150001c11e 100644 --- a/content/canvas/src/CanvasRenderingContext2D.cpp +++ b/content/canvas/src/CanvasRenderingContext2D.cpp @@ -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 diff --git a/layout/svg/nsSVGGlyphFrame.cpp b/layout/svg/nsSVGGlyphFrame.cpp index 146e0597666..1f0cb8a091a 100644 --- a/layout/svg/nsSVGGlyphFrame.cpp +++ b/layout/svg/nsSVGGlyphFrame.cpp @@ -35,8 +35,9 @@ struct CharacterPosition { bool draw; }; -static gfxContext* MakeTmpCtx() { - return new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface()); +static already_AddRefed MakeTmpCtx() { + nsRefPtr ctx = new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()); + return ctx.forget(); } /** diff --git a/layout/svg/nsSVGImageFrame.cpp b/layout/svg/nsSVGImageFrame.cpp index 2cb1d3bb30c..21c30bf7632 100644 --- a/layout/svg/nsSVGImageFrame.cpp +++ b/layout/svg/nsSVGImageFrame.cpp @@ -466,7 +466,7 @@ nsSVGImageFrame::ReflowSVG() return; } - gfxContext tmpCtx(gfxPlatform::GetPlatform()->ScreenReferenceSurface()); + nsRefPtr 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); } diff --git a/layout/svg/nsSVGPathGeometryFrame.cpp b/layout/svg/nsSVGPathGeometryFrame.cpp index aff4957d486..a31fcd8e47a 100644 --- a/layout/svg/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/nsSVGPathGeometryFrame.cpp @@ -245,8 +245,7 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const nsPoint &aPoint) bool isHit = false; - nsRefPtr tmpCtx = - new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface()); + nsRefPtr tmpCtx = new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()); GeneratePath(tmpCtx, canvasTM); gfxPoint userSpacePoint = @@ -408,8 +407,7 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace, return bbox; } - nsRefPtr tmpCtx = - new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface()); + nsRefPtr tmpCtx = new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()); GeneratePath(tmpCtx, aToBBoxUserspace); tmpCtx->IdentityMatrix();