Bug 1064084, part 4 - Convert all consumers of gfxContext::IdentityMatrix() to use gfxContext::SetMatrix(). r=Bas

This commit is contained in:
Jonathan Watt 2014-09-11 07:57:39 +01:00
parent d4d2f025b9
commit 2a0767dbda
11 changed files with 18 additions and 28 deletions

View File

@ -69,7 +69,7 @@ ClipToContain(gfxContext* aContext, const nsIntRect& aRect)
deviceRect.RoundOut();
gfxMatrix currentMatrix = aContext->CurrentMatrix();
aContext->IdentityMatrix();
aContext->SetMatrix(gfxMatrix());
aContext->NewPath();
aContext->Rectangle(deviceRect);
aContext->Clip();

View File

@ -112,7 +112,7 @@ nsRenderingContext::SetClip(const nsIntRegion& aRegion)
// an existing clip.
gfxMatrix mat = mThebes->CurrentMatrix();
mThebes->IdentityMatrix();
mThebes->SetMatrix(gfxMatrix());
mThebes->ResetClip();
@ -185,7 +185,7 @@ nsRenderingContext::DrawLine(nscoord aX0, nscoord aY0,
p0.Round();
p1.Round();
mThebes->IdentityMatrix();
mThebes->SetMatrix(gfxMatrix());
mThebes->NewPath();
@ -308,7 +308,7 @@ nsRenderingContext::FillRect(const nsRect& aRect)
if (!ConditionRect(r))
return;
mThebes->IdentityMatrix();
mThebes->SetMatrix(gfxMatrix());
mThebes->NewPath();
mThebes->Rectangle(r, true);

View File

@ -450,12 +450,6 @@ gfxContext::SetMatrix(const gfxMatrix& matrix)
ChangeTransform(ToMatrix(matrix));
}
void
gfxContext::IdentityMatrix()
{
ChangeTransform(Matrix());
}
gfxMatrix
gfxContext::CurrentMatrix() const
{
@ -1072,7 +1066,7 @@ static gfxRect
GetRoundOutDeviceClipExtents(gfxContext* aCtx)
{
gfxContextMatrixAutoSaveRestore save(aCtx);
aCtx->IdentityMatrix();
aCtx->SetMatrix(gfxMatrix());
gfxRect r = aCtx->GetClipExtents();
r.RoundOut();
return r;

View File

@ -257,11 +257,6 @@ public:
*/
void SetMatrix(const gfxMatrix& matrix);
/**
* Sets the transformation matrix to the identity matrix.
*/
void IdentityMatrix();
/**
* Returns the current transformation matrix.
*/

View File

@ -4362,7 +4362,7 @@ gfxFont::SetupGlyphExtents(gfxContext *aContext, uint32_t aGlyphID, bool aNeedTi
gfxGlyphExtents *aExtents)
{
gfxContextMatrixAutoSaveRestore matrixRestore(aContext);
aContext->IdentityMatrix();
aContext->SetMatrix(gfxMatrix());
gfxRect svgBounds;
if (mFontEntry->TryGetSVGData(this) && mFontEntry->HasSVGGlyph(aGlyphID) &&

View File

@ -450,7 +450,7 @@ struct MOZ_STACK_CLASS AutoCairoPixmanBugWorkaround
// Clip the rounded-out-to-device-pixels bounds of the
// transformed fill area. This is the area for the group we
// want to push.
mContext->IdentityMatrix();
mContext->SetMatrix(gfxMatrix());
gfxRect bounds = currentMatrix.TransformBounds(aFill);
bounds.RoundOut();
mContext->Clip(bounds);

View File

@ -5030,7 +5030,7 @@ nsContextBoxBlur::DoPaint()
gfxContextMatrixAutoSaveRestore saveMatrix(mDestinationCtx);
if (mPreTransformed) {
mDestinationCtx->IdentityMatrix();
mDestinationCtx->SetMatrix(gfxMatrix());
}
blur.Paint(mDestinationCtx);
@ -5095,7 +5095,7 @@ nsContextBoxBlur::BlurRectangle(gfxContext* aDestinationCtx,
if (!transform.HasNonAxisAlignedTransform() && transform._11 > 0.0 && transform._22 > 0.0) {
scaleX = transform._11;
scaleY = transform._22;
aDestinationCtx->IdentityMatrix();
aDestinationCtx->SetMatrix(gfxMatrix());
} else {
transform = gfxMatrix();
}

View File

@ -1731,7 +1731,7 @@ nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
if (ctx->UserToDevicePixelSnapped(frameGfxRect, false)) {
dirtyGfxRect = ctx->UserToDevice(dirtyGfxRect);
ctx->IdentityMatrix();
ctx->SetMatrix(gfxMatrix());
}
dirtyGfxRect.RoundOut();

View File

@ -200,7 +200,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gfxContext* aContext,
// and maskArea) is important for performance.
aContext->Save();
nsSVGUtils::SetClipRect(aContext, aMatrix, maskArea);
aContext->IdentityMatrix();
aContext->SetMatrix(gfxMatrix());
gfxRect maskSurfaceRect = aContext->GetClipExtents();
maskSurfaceRect.RoundOut();
aContext->Restore();

View File

@ -466,7 +466,7 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
nsRefPtr<gfxContext> tmpCtx = new gfxContext(tmpDT);
GeneratePath(tmpCtx, aToBBoxUserspace);
tmpCtx->IdentityMatrix();
tmpCtx->SetMatrix(gfxMatrix());
// Be careful when replacing the following logic to get the fill and stroke
// extents independently (instead of computing the stroke extents from the
@ -703,7 +703,7 @@ nsSVGPathGeometryFrame::GeneratePath(gfxContext* aContext,
const Matrix &aTransform)
{
if (aTransform.IsSingular()) {
aContext->IdentityMatrix();
aContext->SetMatrix(gfxMatrix());
aContext->NewPath();
return;
}

View File

@ -838,11 +838,12 @@ nsNativeThemeGTK::DrawWidgetBackground(nsRenderingContext* aContext,
// translate everything so (0,0) is the top left of the drawingRect
gfxContextAutoSaveRestore autoSR(ctx);
if (snapXY) {
// Rects are in device coords.
ctx->IdentityMatrix();
gfxMatrix tm;
if (!snapXY) { // else rects are in device coords
tm = ctx->CurrentMatrix();
}
ctx->Translate(rect.TopLeft() + gfxPoint(drawingRect.x, drawingRect.y));
tm.Translate(rect.TopLeft() + gfxPoint(drawingRect.x, drawingRect.y));
ctx->SetMatrix(tm);
NS_ASSERTION(!IsWidgetTypeDisabled(mDisabledWidgetTypes, aWidgetType),
"Trying to render an unsafe widget!");