diff --git a/gfx/thebes/gfxDrawable.cpp b/gfx/thebes/gfxDrawable.cpp index 98cef22ff5cd..e49e94759d5e 100644 --- a/gfx/thebes/gfxDrawable.cpp +++ b/gfx/thebes/gfxDrawable.cpp @@ -57,7 +57,7 @@ DeviceToImageTransform(gfxContext* aContext, return gfxMatrix(0, 0, 0, 0, 0, 0); // singular } deviceToUser.Translate(-gfxPoint(-deviceX, -deviceY)); - return gfxMatrix(deviceToUser).Multiply(aUserSpaceToImageSpace); + return deviceToUser * aUserSpaceToImageSpace; } static void @@ -159,7 +159,7 @@ gfxSurfaceDrawable::Draw(gfxContext* aContext, PreparePatternForUntiledDrawing(pattern, deviceSpaceToImageSpace, currentTarget, filter); } - pattern->SetMatrix(gfxMatrix(aTransform).Multiply(mTransform)); + pattern->SetMatrix(aTransform * mTransform); aContext->NewPath(); aContext->SetPattern(pattern); aContext->Rectangle(aFillRect); @@ -297,7 +297,7 @@ gfxPatternDrawable::Draw(gfxContext* aContext, aContext->NewPath(); gfxMatrix oldMatrix = mPattern->GetMatrix(); - mPattern->SetMatrix(gfxMatrix(aTransform).Multiply(oldMatrix)); + mPattern->SetMatrix(aTransform * oldMatrix); aContext->SetPattern(mPattern); aContext->Rectangle(aFillRect); aContext->Fill(); diff --git a/gfx/thebes/gfxMatrix.cpp b/gfx/thebes/gfxMatrix.cpp index 07bd3ce677e4..9fe86d134f1d 100644 --- a/gfx/thebes/gfxMatrix.cpp +++ b/gfx/thebes/gfxMatrix.cpp @@ -45,7 +45,7 @@ gfxMatrix::Rotate(gfxFloat radians) } const gfxMatrix& -gfxMatrix::Multiply(const gfxMatrix& m) +gfxMatrix::operator *= (const gfxMatrix& m) { cairo_matrix_multiply(CAIRO_MATRIX(this), CAIRO_MATRIX(this), CONST_CAIRO_MATRIX(&m)); return *this; diff --git a/gfx/thebes/gfxMatrix.h b/gfx/thebes/gfxMatrix.h index 2e54856c9590..9fff986fa798 100644 --- a/gfx/thebes/gfxMatrix.h +++ b/gfx/thebes/gfxMatrix.h @@ -53,15 +53,13 @@ public: /** * Post-multiplies m onto the matrix. */ - const gfxMatrix& operator *= (const gfxMatrix& m) { - return Multiply(m); - } + const gfxMatrix& operator *= (const gfxMatrix& m); /** * Multiplies *this with m and returns the result. */ gfxMatrix operator * (const gfxMatrix& m) const { - return gfxMatrix(*this).Multiply(m); + return gfxMatrix(*this) *= m; } /* Returns true if the other matrix is fuzzy-equal to this matrix. @@ -128,15 +126,6 @@ public: */ const gfxMatrix& Rotate(gfxFloat radians); - /** - * Multiplies the current matrix with m. - * This is a post-multiplication, i.e. the transformations of m are - * applied _after_ the existing transformations. - * - * XXX is that difference (compared to Rotate etc) a good thing? - */ - const gfxMatrix& Multiply(const gfxMatrix& m); - /** * Multiplies the current matrix with m. * This is a pre-multiplication, i.e. the transformations of m are diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index 3411403fc232..29c5ed831c89 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -501,7 +501,7 @@ DeviceToImageTransform(gfxContext* aContext, return gfxMatrix(0, 0, 0, 0, 0, 0); // singular } deviceToUser.Translate(-gfxPoint(-deviceX, -deviceY)); - return gfxMatrix(deviceToUser).Multiply(aUserSpaceToImageSpace); + return deviceToUser * aUserSpaceToImageSpace; } /* These heuristics are based on Source/WebCore/platform/graphics/skia/ImageSkia.cpp:computeResamplingMode() */ diff --git a/image/src/ClippedImage.cpp b/image/src/ClippedImage.cpp index 339a0356766f..301a027729d4 100644 --- a/image/src/ClippedImage.cpp +++ b/image/src/ClippedImage.cpp @@ -388,19 +388,18 @@ ClippedImage::DrawSingleTile(gfxContext* aContext, } // Add a translation to the transform to reflect the clipping region. - gfxMatrix transform(aUserSpaceToImageSpace); - transform.Multiply(gfxMatrix().Translate(gfxPoint(mClip.x, mClip.y))); + gfxMatrix transform = + aUserSpaceToImageSpace * gfxMatrix::Translation(mClip.x, mClip.y); // "Clamp the source rectangle" to the clipping region's width and height. // Really, this means modifying the transform to get the results we want. gfxRect sourceRect = transform.Transform(aFill); if (sourceRect.width > mClip.width || sourceRect.height > mClip.height) { - gfxMatrix clampSource; - clampSource.Translate(gfxPoint(sourceRect.x, sourceRect.y)); + gfxMatrix clampSource = gfxMatrix::Translation(sourceRect.TopLeft()); clampSource.Scale(ClampFactor(sourceRect.width, mClip.width), ClampFactor(sourceRect.height, mClip.height)); - clampSource.Translate(gfxPoint(-sourceRect.x, -sourceRect.y)); - transform.Multiply(clampSource); + clampSource.Translate(-sourceRect.TopLeft()); + transform *= clampSource; } return InnerImage()->Draw(aContext, aFilter, transform, aFill, aSubimage, diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index 5f2cdcd6ac7b..8c0960e5ef04 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -2623,8 +2623,7 @@ RasterImage::DrawWithPreDownscaleIfNeeded(imgFrame *aFrame, needScaleReq = !surf; if (surf) { frame = mScaleResult.frame; - userSpaceToImageSpace.Multiply(gfxMatrix().Scale(scale.width, - scale.height)); + userSpaceToImageSpace *= gfxMatrix::Scaling(scale.width, scale.height); // Since we're switching to a scaled image, we need to transform the // area of the subimage to draw accordingly, since imgFrame::Draw() diff --git a/image/src/imgFrame.cpp b/image/src/imgFrame.cpp index 327f1db0dcce..e0c8c0414099 100644 --- a/image/src/imgFrame.cpp +++ b/image/src/imgFrame.cpp @@ -365,7 +365,7 @@ imgFrame::SurfaceForDrawing(bool aDoPadding, aFill = imageSpaceToUserSpace.Transform(aSourceRect); aSubimage = aSubimage.Intersect(available) - gfxPoint(aPadding.left, aPadding.top); - aUserSpaceToImageSpace.Multiply(gfxMatrix().Translate(-gfxPoint(aPadding.left, aPadding.top))); + aUserSpaceToImageSpace *= gfxMatrix::Translation(-aPadding.left, -aPadding.top); aSourceRect = aSourceRect - gfxPoint(aPadding.left, aPadding.top); aImageRect = gfxRect(0, 0, mSize.width, mSize.height); diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp index f3c76048fdfd..16e70641f903 100644 --- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -975,7 +975,7 @@ TextRenderedRun::GetUserSpaceRect(nsPresContext* aContext, } gfxMatrix m = GetTransformFromRunUserSpaceToUserSpace(aContext); if (aAdditionalTransform) { - m.Multiply(*aAdditionalTransform); + m *= *aAdditionalTransform; } return m.TransformBounds(r.ToThebesRect()); } @@ -3594,8 +3594,7 @@ SVGTextFrame::PaintSVG(nsRenderingContext* aContext, return NS_ERROR_FAILURE; } - gfxMatrix matrixForPaintServers(canvasTM); - matrixForPaintServers.Multiply(initialMatrix); + gfxMatrix matrixForPaintServers = canvasTM * initialMatrix; // Check if we need to draw anything. if (aDirtyRect) { @@ -3658,8 +3657,8 @@ SVGTextFrame::PaintSVG(nsRenderingContext* aContext, // Set up the transform for painting the text frame for the substring // indicated by the run. gfxMatrix runTransform = - run.GetTransformFromUserSpaceForPainting(presContext, item); - runTransform.Multiply(currentMatrix); + run.GetTransformFromUserSpaceForPainting(presContext, item) * + currentMatrix; gfx->SetMatrix(runTransform); if (drawMode != DrawMode(0)) { @@ -3718,8 +3717,8 @@ SVGTextFrame::GetFrameForPoint(const nsPoint& aPoint) continue; } - gfxMatrix m = GetCanvasTM(FOR_HIT_TESTING); - m.PreMultiply(run.GetTransformFromRunUserSpaceToUserSpace(presContext)); + gfxMatrix m = run.GetTransformFromRunUserSpaceToUserSpace(presContext) * + GetCanvasTM(FOR_HIT_TESTING); if (!m.Invert()) { return nullptr; } @@ -5451,9 +5450,8 @@ SVGTextFrame::TransformFrameRectToTextChild(const gfxRect& aRect, if (!userSpaceToRunUserSpace.Invert()) { return result; } - gfxMatrix m; - m.PreMultiply(userSpaceToRunUserSpace); - m.PreMultiply(run.GetTransformFromRunUserSpaceToFrameUserSpace(presContext)); + gfxMatrix m = run.GetTransformFromRunUserSpaceToFrameUserSpace(presContext) * + userSpaceToRunUserSpace; gfxRect incomingRectInFrameUserSpace = m.TransformBounds(incomingRectInUserSpace); diff --git a/layout/svg/nsSVGGradientFrame.cpp b/layout/svg/nsSVGGradientFrame.cpp index 62be21468343..c2ef2eab197f 100644 --- a/layout/svg/nsSVGGradientFrame.cpp +++ b/layout/svg/nsSVGGradientFrame.cpp @@ -268,7 +268,7 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame *aSource, if (!nonScalingStrokeTM.Invert()) { return nullptr; } - patternMatrix.Multiply(nonScalingStrokeTM); + patternMatrix *= nonScalingStrokeTM; } if (!patternMatrix.Invert()) { diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp index bf49a0893060..cee0276e76b2 100644 --- a/layout/svg/nsSVGIntegrationUtils.cpp +++ b/layout/svg/nsSVGIntegrationUtils.cpp @@ -711,8 +711,8 @@ nsSVGIntegrationUtils::DrawableFromPaintServer(nsIFrame* aFrame, // pattern size. gfxFloat scaleX = overrideBounds.Width() / aRenderSize.width; gfxFloat scaleY = overrideBounds.Height() / aRenderSize.height; - gfxMatrix scaleMatrix = gfxMatrix().Scale(scaleX, scaleY); - pattern->SetMatrix(scaleMatrix.Multiply(pattern->GetMatrix())); + gfxMatrix scaleMatrix = gfxMatrix::Scaling(scaleX, scaleY); + pattern->SetMatrix(scaleMatrix * pattern->GetMatrix()); nsRefPtr drawable = new gfxPatternDrawable(pattern, aRenderSize); return drawable.forget(); diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index 85610de73f14..a65ff4afc7c8 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -1125,8 +1125,7 @@ PathExtentsToMaxStrokeExtents(const gfxRect& aPathExtents, double style_expansion = aStyleExpansionFactor * nsSVGUtils::GetStrokeWidth(aFrame); - gfxMatrix matrix = aMatrix; - matrix.Multiply(nsSVGUtils::GetStrokeTransform(aFrame)); + gfxMatrix matrix = aMatrix * nsSVGUtils::GetStrokeTransform(aFrame); double dx = style_expansion * (fabs(matrix._11) + fabs(matrix._21)); double dy = style_expansion * (fabs(matrix._22) + fabs(matrix._12));