diff --git a/content/base/src/DOMMatrix.cpp b/content/base/src/DOMMatrix.cpp index 8c508a5a72e9..4c98f6dec536 100644 --- a/content/base/src/DOMMatrix.cpp +++ b/content/base/src/DOMMatrix.cpp @@ -437,7 +437,7 @@ DOMMatrix::TranslateSelf(double aTx, Ensure3DMatrix(); mMatrix3D->Translate(aTx, aTy, aTz); } else { - mMatrix2D->Translate(aTx, aTy); + mMatrix2D->PreTranslate(aTx, aTy); } return this; @@ -517,7 +517,7 @@ DOMMatrix::RotateSelf(double aAngle, double aOriginX, double aOriginY) if (mMatrix3D) { RotateAxisAngleSelf(0, 0, 1, aAngle); } else { - *mMatrix2D = mMatrix2D->Rotate(aAngle * radPerDegree); + *mMatrix2D = mMatrix2D->PreRotate(aAngle * radPerDegree); } TranslateSelf(-aOriginX, -aOriginY); diff --git a/content/svg/content/src/SVGMotionSMILType.cpp b/content/svg/content/src/SVGMotionSMILType.cpp index d7944ccafd82..8448615ec95a 100644 --- a/content/svg/content/src/SVGMotionSMILType.cpp +++ b/content/svg/content/src/SVGMotionSMILType.cpp @@ -465,8 +465,8 @@ SVGMotionSMILType::CreateMatrix(const nsSMILValue& aSMILVal) arr[i].mRotateType, rotateAngle, point); } - matrix.Translate(point.x, point.y); - matrix = gfx::Matrix::Rotation(rotateAngle) * matrix; + matrix.PreTranslate(point.x, point.y); + matrix.PreRotate(rotateAngle); } return matrix; } diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index 0e01093156c8..94b5368c2503 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -1277,7 +1277,7 @@ CanvasRenderingContext2D::Scale(double x, double y, ErrorResult& error) } Matrix newMatrix = mTarget->GetTransform(); - mTarget->SetTransform(newMatrix.Scale(x, y)); + mTarget->SetTransform(newMatrix.PreScale(x, y)); } void @@ -1302,8 +1302,7 @@ CanvasRenderingContext2D::Translate(double x, double y, ErrorResult& error) return; } - Matrix newMatrix = mTarget->GetTransform(); - mTarget->SetTransform(newMatrix.Translate(x, y)); + mTarget->SetTransform(Matrix(mTarget->GetTransform()).PreTranslate(x, y)); } void @@ -3023,9 +3022,9 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText, // Translate so that the anchor point is at 0,0, then scale and then // translate back. - newTransform.Translate(aX, 0); - newTransform.Scale(aMaxWidth.Value() / totalWidth, 1); - newTransform.Translate(-aX, 0); + newTransform.PreTranslate(aX, 0); + newTransform.PreScale(aMaxWidth.Value() / totalWidth, 1); + newTransform.PreTranslate(-aX, 0); /* we do this to avoid an ICE in the android compiler */ Matrix androidCompilerBug = newTransform; mTarget->SetTransform(androidCompilerBug); diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp index 442a9ee8276c..f5fe169415fe 100644 --- a/dom/canvas/WebGLContext.cpp +++ b/dom/canvas/WebGLContext.cpp @@ -1727,10 +1727,7 @@ WebGLContext::GetSurfaceSnapshot(bool* aPremultAlpha) return nullptr; } - Matrix m; - m.Translate(0.0, mHeight); - m.Scale(1.0, -1.0); - dt->SetTransform(m); + dt->SetTransform(Matrix::Translation(0.0, mHeight).PreScale(1.0, -1.0)); dt->DrawSurface(surf, Rect(0, 0, mWidth, mHeight), diff --git a/gfx/layers/RotatedBuffer.cpp b/gfx/layers/RotatedBuffer.cpp index 04eddd0ab678..0515754f2e71 100644 --- a/gfx/layers/RotatedBuffer.cpp +++ b/gfx/layers/RotatedBuffer.cpp @@ -295,9 +295,9 @@ RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds NS_ASSERTION(quadrantRect.Contains(bounds), "Messed up quadrants"); mLoanedTransform = mLoanedDrawTarget->GetTransform(); - mLoanedTransform.Translate(-quadrantRect.x, -quadrantRect.y); - mLoanedDrawTarget->SetTransform(mLoanedTransform); - mLoanedTransform.Translate(quadrantRect.x, quadrantRect.y); + mLoanedDrawTarget->SetTransform(Matrix(mLoanedTransform). + PreTranslate(-quadrantRect.x, + -quadrantRect.y)); return mLoanedDrawTarget; } diff --git a/gfx/layers/basic/BasicCanvasLayer.cpp b/gfx/layers/basic/BasicCanvasLayer.cpp index 6d1979bda8e5..49116ebbab03 100644 --- a/gfx/layers/basic/BasicCanvasLayer.cpp +++ b/gfx/layers/basic/BasicCanvasLayer.cpp @@ -36,13 +36,12 @@ BasicCanvasLayer::Paint(DrawTarget* aDT, return; } - Matrix m; + Matrix oldTM; if (mNeedsYFlip) { - m = aDT->GetTransform(); - Matrix newTransform = m; - newTransform.Translate(0.0f, mBounds.height); - newTransform.Scale(1.0f, -1.0f); - aDT->SetTransform(newTransform); + oldTM = aDT->GetTransform(); + aDT->SetTransform(Matrix(oldTM). + PreTranslate(0.0f, mBounds.height). + PreScale(1.0f, -1.0f)); } FillRectWithMask(aDT, aDeviceOffset, @@ -52,7 +51,7 @@ BasicCanvasLayer::Paint(DrawTarget* aDT, aMaskLayer); if (mNeedsYFlip) { - aDT->SetTransform(m); + aDT->SetTransform(oldTM); } } diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index c85d3f5ec745..06300332c2e8 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -290,7 +290,7 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect, MOZ_ASSERT(effectMask->mMaskTransform.Is2D(), "How did we end up with a 3D transform here?!"); MOZ_ASSERT(!effectMask->mIs3D); maskTransform = effectMask->mMaskTransform.As2D(); - maskTransform.Translate(-offset.x, -offset.y); + maskTransform.PreTranslate(-offset.x, -offset.y); } switch (aEffectChain.mPrimaryEffect->mType) { diff --git a/gfx/layers/basic/BasicLayersImpl.cpp b/gfx/layers/basic/BasicLayersImpl.cpp index 34e26b6e1b06..ce80b30a2eca 100644 --- a/gfx/layers/basic/BasicLayersImpl.cpp +++ b/gfx/layers/basic/BasicLayersImpl.cpp @@ -31,7 +31,7 @@ GetMaskData(Layer* aMaskLayer, Matrix4x4 effectiveTransform = aMaskLayer->GetEffectiveTransform(); DebugOnly maskIs2D = effectiveTransform.CanDraw2D(&transform); NS_ASSERTION(maskIs2D, "How did we end up with a 3D transform here?!"); - transform.Translate(-aDeviceOffset.x, -aDeviceOffset.y); + transform.PreTranslate(-aDeviceOffset.x, -aDeviceOffset.y); aMaskData->Construct(transform, surface); return true; } diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index c68443f5dbee..d5faf022aad9 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -934,9 +934,8 @@ ContentClientIncremental::BorrowDrawTargetForPainting(PaintState& aPaintState, result = mLoanedDrawTarget; mLoanedTransform = mLoanedDrawTarget->GetTransform(); - mLoanedTransform.Translate(-drawBounds.x, -drawBounds.y); - result->SetTransform(mLoanedTransform); - mLoanedTransform.Translate(drawBounds.x, drawBounds.y); + result->SetTransform(Matrix(mLoanedTransform). + PreTranslate(-drawBounds.x, -drawBounds.y)); if (mContentType == gfxContentType::COLOR_ALPHA) { gfxUtils::ClipToRegion(result, aPaintState.mRegionToDraw); diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 837645f44427..b4d661c686ef 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -830,8 +830,8 @@ CompositorD3D11::PrepareViewport(const gfx::IntSize& aSize, mContext->RSSetViewports(1, &viewport); Matrix viewMatrix = Matrix::Translation(-1.0, 1.0); - viewMatrix.Scale(2.0f / float(aSize.width), 2.0f / float(aSize.height)); - viewMatrix.Scale(1.0f, -1.0f); + viewMatrix.PreScale(2.0f / float(aSize.width), 2.0f / float(aSize.height)); + viewMatrix.PreScale(1.0f, -1.0f); viewMatrix = aWorldTransform * viewMatrix; diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index 1004e4fbbb7e..695a11b791ca 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -588,16 +588,16 @@ CompositorOGL::PrepareViewport(const gfx::IntSize& aSize, Matrix viewMatrix; if (mGLContext->IsOffscreen()) { // In case of rendering via GL Offscreen context, disable Y-Flipping - viewMatrix.Translate(-1.0, -1.0); - viewMatrix.Scale(2.0f / float(aSize.width), 2.0f / float(aSize.height)); + viewMatrix.PreTranslate(-1.0, -1.0); + viewMatrix.PreScale(2.0f / float(aSize.width), 2.0f / float(aSize.height)); } else { - viewMatrix.Translate(-1.0, 1.0); - viewMatrix.Scale(2.0f / float(aSize.width), 2.0f / float(aSize.height)); - viewMatrix.Scale(1.0f, -1.0f); + viewMatrix.PreTranslate(-1.0, 1.0); + viewMatrix.PreScale(2.0f / float(aSize.width), 2.0f / float(aSize.height)); + viewMatrix.PreScale(1.0f, -1.0f); } if (!mTarget) { - viewMatrix.Translate(mRenderOffset.x, mRenderOffset.y); + viewMatrix.PreTranslate(mRenderOffset.x, mRenderOffset.y); } viewMatrix = aWorldTransform * viewMatrix; @@ -1212,8 +1212,8 @@ CompositorOGL::DrawQuad(const Rect& aRect, // Drawing is always flipped, but when copying between surfaces we want to avoid // this, so apply a flip here to cancel the other one out. Matrix transform; - transform.Translate(0.0, 1.0); - transform.Scale(1.0f, -1.0f); + transform.PreTranslate(0.0, 1.0); + transform.PreScale(1.0f, -1.0f); program->SetTextureTransform(Matrix4x4::From2D(transform)); program->SetTextureUnit(0); @@ -1496,8 +1496,8 @@ CompositorOGL::CopyToTarget(DrawTarget* aTarget, const nsIntPoint& aTopLeft, con // Map from GL space to Cairo space and reverse the world transform. Matrix glToCairoTransform = aTransform; glToCairoTransform.Invert(); - glToCairoTransform.Scale(1.0, -1.0); - glToCairoTransform.Translate(0.0, -height); + glToCairoTransform.PreScale(1.0, -1.0); + glToCairoTransform.PreTranslate(0.0, -height); glToCairoTransform.PostTranslate(-aTopLeft.x, -aTopLeft.y); diff --git a/gfx/thebes/gfxBlur.cpp b/gfx/thebes/gfxBlur.cpp index d512a686de7b..046ce0b5b985 100644 --- a/gfx/thebes/gfxBlur.cpp +++ b/gfx/thebes/gfxBlur.cpp @@ -93,7 +93,7 @@ DrawBlur(gfxContext* aDestinationCtx, Matrix oldTransform = dest->GetTransform(); Matrix newTransform = oldTransform; - newTransform.Translate(aTopLeft.x, aTopLeft.y); + newTransform.PreTranslate(aTopLeft.x, aTopLeft.y); // Avoid a semi-expensive clip operation if we can, otherwise // clip to the dirty rect diff --git a/gfx/thebes/gfxContext.cpp b/gfx/thebes/gfxContext.cpp index eade3f97dee1..1f76b575e4e4 100644 --- a/gfx/thebes/gfxContext.cpp +++ b/gfx/thebes/gfxContext.cpp @@ -434,14 +434,14 @@ void gfxContext::Translate(const gfxPoint& pt) { Matrix newMatrix = mTransform; - ChangeTransform(newMatrix.Translate(Float(pt.x), Float(pt.y))); + ChangeTransform(newMatrix.PreTranslate(Float(pt.x), Float(pt.y))); } void gfxContext::Scale(gfxFloat x, gfxFloat y) { Matrix newMatrix = mTransform; - ChangeTransform(newMatrix.Scale(Float(x), Float(y))); + ChangeTransform(newMatrix.PreScale(Float(x), Float(y))); } void @@ -1163,11 +1163,9 @@ gfxContext::PopGroup() Matrix mat = mTransform; mat.Invert(); + mat.PreTranslate(deviceOffset.x, deviceOffset.y); // device offset translation - Matrix deviceOffsetTranslation; - deviceOffsetTranslation.Translate(deviceOffset.x, deviceOffset.y); - - nsRefPtr pat = new gfxPattern(src, deviceOffsetTranslation * mat); + nsRefPtr pat = new gfxPattern(src, mat); return pat.forget(); } @@ -1186,10 +1184,9 @@ gfxContext::PopGroupToSource() Matrix mat = mTransform; mat.Invert(); + mat.PreTranslate(deviceOffset.x, deviceOffset.y); // device offset translation - Matrix deviceOffsetTranslation; - deviceOffsetTranslation.Translate(deviceOffset.x, deviceOffset.y); - CurrentState().surfTransform = deviceOffsetTranslation * mat; + CurrentState().surfTransform = mat; } bool diff --git a/gfx/thebes/gfxPattern.cpp b/gfx/thebes/gfxPattern.cpp index 36173d2ae923..4be42d11a866 100644 --- a/gfx/thebes/gfxPattern.cpp +++ b/gfx/thebes/gfxPattern.cpp @@ -224,7 +224,7 @@ gfxPattern::GetPattern(DrawTarget *aTarget, Matrix *aPatternTransform) double x, y; cairo_surface_get_device_offset(surf, &x, &y); - newMat.Translate(-x, -y); + newMat.PreTranslate(-x, -y); mGfxPattern = new (mSurfacePattern.addr()) SurfacePattern(mSourceSurface, ToExtendMode(extend), newMat, ToFilter(filter)); return mGfxPattern; diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index c0c66d66b62c..9530f2246fe7 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -4620,10 +4620,10 @@ ContainerState::SetupMaskLayer(Layer *aLayer, Matrix::Scaling(surfaceSize.width / boundingRect.Width(), surfaceSize.height / boundingRect.Height()); gfx::Point p = boundingRect.TopLeft(); - maskTransform.Translate(-p.x, -p.y); + maskTransform.PreTranslate(-p.x, -p.y); // imageTransform is only used when the clip is painted to the mask gfx::Matrix imageTransform = maskTransform; - imageTransform.Scale(mParameters.mXScale, mParameters.mYScale); + imageTransform.PreScale(mParameters.mXScale, mParameters.mYScale); nsAutoPtr newKey( new MaskLayerImageCache::MaskLayerImageKey()); diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index c236c1e82a0a..6e1fceb35354 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -2180,8 +2180,8 @@ nsDisplayBackgroundImage::ConfigureLayer(ImageLayer* aLayer, const nsIntPoint& a gfxPoint p = mDestRect.TopLeft() + aOffset; Matrix transform = Matrix::Translation(p.x, p.y); - transform.Scale(mDestRect.width/imageSize.width, - mDestRect.height/imageSize.height); + transform.PreScale(mDestRect.width / imageSize.width, + mDestRect.height / imageSize.height); aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform)); } diff --git a/layout/generic/nsHTMLCanvasFrame.cpp b/layout/generic/nsHTMLCanvasFrame.cpp index c377415a6f97..139114554c07 100644 --- a/layout/generic/nsHTMLCanvasFrame.cpp +++ b/layout/generic/nsHTMLCanvasFrame.cpp @@ -283,7 +283,8 @@ nsHTMLCanvasFrame::BuildLayer(nsDisplayListBuilder* aBuilder, // Transform the canvas into the right place gfxPoint p = r.TopLeft() + aContainerParameters.mOffset; Matrix transform = Matrix::Translation(p.x, p.y); - transform.Scale(r.Width()/canvasSize.width, r.Height()/canvasSize.height); + transform.PreScale(r.Width() / canvasSize.width, + r.Height() / canvasSize.height); layer->SetBaseTransform(gfx::Matrix4x4::From2D(transform)); layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this)); diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 794ec8d36416..99f4598ac07f 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1445,8 +1445,8 @@ nsDisplayImage::ConfigureLayer(ImageLayer *aLayer, const nsIntPoint& aOffset) gfxPoint p = destRect.TopLeft() + aOffset; Matrix transform = Matrix::Translation(p.x, p.y); - transform.Scale(destRect.Width()/imageWidth, - destRect.Height()/imageHeight); + transform.PreScale(destRect.Width() / imageWidth, + destRect.Height() / imageHeight); aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform)); } diff --git a/layout/generic/nsVideoFrame.cpp b/layout/generic/nsVideoFrame.cpp index 5a6c2ba108c3..ddf2337a29d9 100644 --- a/layout/generic/nsVideoFrame.cpp +++ b/layout/generic/nsVideoFrame.cpp @@ -224,7 +224,8 @@ nsVideoFrame::BuildLayer(nsDisplayListBuilder* aBuilder, // Set a transform on the layer to draw the video in the right place gfxPoint p = r.TopLeft() + aContainerParameters.mOffset; Matrix transform = Matrix::Translation(p.x, p.y); - transform.Scale(r.Width()/frameSize.width, r.Height()/frameSize.height); + transform.PreScale(r.Width() / frameSize.width, + r.Height() / frameSize.height); layer->SetBaseTransform(gfx::Matrix4x4::From2D(transform)); nsRefPtr result = layer.forget(); return result.forget(); diff --git a/layout/svg/nsFilterInstance.cpp b/layout/svg/nsFilterInstance.cpp index 55e4763e35be..c1802d308e9f 100644 --- a/layout/svg/nsFilterInstance.cpp +++ b/layout/svg/nsFilterInstance.cpp @@ -9,6 +9,7 @@ // Keep others in (case-insensitive) order: #include "gfxPlatform.h" #include "gfxUtils.h" +#include "mozilla/gfx/Helpers.h" #include "nsISVGChildFrame.h" #include "nsRenderingContext.h" #include "nsCSSFilterInstance.h" @@ -407,12 +408,11 @@ nsFilterInstance::Render(gfxContext* aContext) return NS_OK; } - Matrix oldDTMatrix; RefPtr dt = aContext->GetDrawTarget(); - oldDTMatrix = dt->GetTransform(); - Matrix matrix = ToMatrix(ctm); - matrix.Translate(filterRect.x, filterRect.y); - dt->SetTransform(matrix * oldDTMatrix); + + AutoSaveTransform autoSR(dt); + Matrix newTM = ToMatrix(ctm).PreTranslate(filterRect.x, filterRect.y) * dt->GetTransform(); + dt->SetTransform(newTM); ComputeNeededBoxes(); @@ -430,8 +430,6 @@ nsFilterInstance::Render(gfxContext* aContext) mStrokePaint.mSourceSurface, mStrokePaint.mSurfaceRect, mInputImages); - dt->SetTransform(oldDTMatrix); - return NS_OK; } diff --git a/layout/svg/nsSVGImageFrame.cpp b/layout/svg/nsSVGImageFrame.cpp index 4a4b5e0fd7d9..63f540589033 100644 --- a/layout/svg/nsSVGImageFrame.cpp +++ b/layout/svg/nsSVGImageFrame.cpp @@ -277,7 +277,7 @@ nsSVGImageFrame::TransformContextForPainting(gfxContext* aGfxContext, nscoord appUnitsPerDevPx = PresContext()->AppUnitsPerDevPixel(); gfxFloat pageZoomFactor = nsPresContext::AppUnitsToFloatCSSPixels(appUnitsPerDevPx); - imageTransform.Scale(pageZoomFactor, pageZoomFactor); + imageTransform.PreScale(pageZoomFactor, pageZoomFactor); } if (imageTransform.IsSingular()) { diff --git a/layout/svg/nsSVGPathGeometryFrame.cpp b/layout/svg/nsSVGPathGeometryFrame.cpp index 60249d6cbe79..d70ab8d8d7bf 100644 --- a/layout/svg/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/nsSVGPathGeometryFrame.cpp @@ -368,7 +368,7 @@ nsSVGPathGeometryFrame::ReflowSVG() fabs(scaleFactors.height) >= 1e-6; gfx::Matrix scaling; if (applyScaling) { - scaling.Scale(scaleFactors.width, scaleFactors.height); + scaling.PreScale(scaleFactors.width, scaleFactors.height); } gfxRect extent = GetBBoxContribution(scaling, flags).ToThebesRect(); if (applyScaling) { diff --git a/layout/svg/nsSVGPatternFrame.cpp b/layout/svg/nsSVGPatternFrame.cpp index 3a0799d4478e..8aad7675542d 100644 --- a/layout/svg/nsSVGPatternFrame.cpp +++ b/layout/svg/nsSVGPatternFrame.cpp @@ -197,8 +197,8 @@ GetPatternMatrix(uint16_t aPatternUnits, float scale = 1.0f / MaxExpansion(callerCTM); Matrix patternMatrix = patternTransform; - patternMatrix.Scale(scale, scale); - patternMatrix.Translate(minx, miny); + patternMatrix.PreScale(scale, scale); + patternMatrix.PreTranslate(minx, miny); return patternMatrix; } @@ -368,8 +368,8 @@ nsSVGPatternFrame::PaintPattern(Matrix* patternMatrix, patternFrame->mCTM->PreMultiply(tempTM); // and rescale pattern to compensate - patternMatrix->Scale(patternWidth / surfaceSize.width, - patternHeight / surfaceSize.height); + patternMatrix->PreScale(patternWidth / surfaceSize.width, + patternHeight / surfaceSize.height); } RefPtr dt = diff --git a/layout/xul/nsImageBoxFrame.cpp b/layout/xul/nsImageBoxFrame.cpp index 6735ec3c90b2..1e757deb28f0 100644 --- a/layout/xul/nsImageBoxFrame.cpp +++ b/layout/xul/nsImageBoxFrame.cpp @@ -404,8 +404,8 @@ nsDisplayXULImage::ConfigureLayer(ImageLayer* aLayer, const nsIntPoint& aOffset) gfxPoint p = destRect.TopLeft() + aOffset; Matrix transform = Matrix::Translation(p.x, p.y); - transform.Scale(destRect.Width()/imageWidth, - destRect.Height()/imageHeight); + transform.PreScale(destRect.Width() / imageWidth, + destRect.Height() / imageHeight); aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform)); } diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index f634e6c7c4b5..48cedd08436b 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -3014,8 +3014,9 @@ GLPresenter::BeginFrame(nsIntSize aRenderSize) // Matrix to transform (0, 0, width, height) to viewport space (-1.0, 1.0, // 2, 2) and flip the contents. gfx::Matrix viewMatrix = gfx::Matrix::Translation(-1.0, 1.0); - viewMatrix.Scale(2.0f / float(aRenderSize.width), 2.0f / float(aRenderSize.height)); - viewMatrix.Scale(1.0f, -1.0f); + viewMatrix.PreScale(2.0f / float(aRenderSize.width), + 2.0f / float(aRenderSize.height)); + viewMatrix.PreScale(1.0f, -1.0f); gfx::Matrix4x4 matrix3d = gfx::Matrix4x4::From2D(viewMatrix); matrix3d._33 = 0.0f; diff --git a/widget/xpwidgets/WidgetUtils.cpp b/widget/xpwidgets/WidgetUtils.cpp index 9ad278005cff..7db4c70096e1 100644 --- a/widget/xpwidgets/WidgetUtils.cpp +++ b/widget/xpwidgets/WidgetUtils.cpp @@ -20,16 +20,16 @@ ComputeTransformForRotation(const nsIntRect& aBounds, case ROTATION_0: break; case ROTATION_90: - transform.Translate(aBounds.width, 0); - transform = gfx::Matrix::Rotation(floatPi / 2) * transform; + transform.PreTranslate(aBounds.width, 0); + transform.PreRotate(floatPi / 2); break; case ROTATION_180: - transform.Translate(aBounds.width, aBounds.height); - transform = gfx::Matrix::Rotation(floatPi) * transform; + transform.PreTranslate(aBounds.width, aBounds.height); + transform.PreRotate(floatPi); break; case ROTATION_270: - transform.Translate(0, aBounds.height); - transform = gfx::Matrix::Rotation(floatPi * 3 / 2) * transform; + transform.PreTranslate(0, aBounds.height); + transform.PreRotate(floatPi * 3 / 2); break; default: MOZ_CRASH("Unknown rotation");