Bug 1416267 - Update gfxContext matrix functions to avoid flip-flopping between float and double matrices. r=jrmuizel

The core of this change is in gfxContext.*:
- change gfxContext::CurrentMatrix() and gfxContext::SetMatrix() to
  return and take a Matrix respectively, instead of converting to
  and from a gfxMatrix (which uses doubles). These functions therefore
  will now match the native representation of the transform in gfxContext.
- add two new functions CurrentMatrixDouble() and SetMatrixDouble() that
  do what the old CurrentMatrix() and SetMatrix() used to do, i.e.
  convert between the float matrix and the double matrix.

The rest of the change is just updating the call sites to avoid round-
tripping between floats and doubles where possible. Call sites that are
hard to fix are migrated to the new XXXDouble functions which preserves
the existing behaviour.

MozReview-Commit-ID: 5sbBpLUus3U
This commit is contained in:
Kartikaya Gupta 2017-11-10 21:14:09 -05:00
parent 4fa452ee6e
commit 00ef028ed3
34 changed files with 159 additions and 148 deletions

View File

@ -5370,9 +5370,7 @@ CanvasRenderingContext2D::DrawDirectlyToCanvas(
// Get any existing transforms on the context, including transformations used
// for context shadow.
Matrix matrix = tempTarget->GetTransform();
gfxMatrix contextMatrix;
contextMatrix = gfxMatrix(matrix._11, matrix._12, matrix._21,
matrix._22, matrix._31, matrix._32);
gfxMatrix contextMatrix = ThebesMatrix(matrix);
gfxSize contextScale(contextMatrix.ScaleFactors(true));
// Scale the dest rect to include the context scale.
@ -5393,10 +5391,10 @@ CanvasRenderingContext2D::DrawDirectlyToCanvas(
gfxDevCrash(LogReason::InvalidContext) << "Canvas context problem";
return;
}
context->SetMatrix(contextMatrix.
PreScale(1.0 / contextScale.width,
1.0 / contextScale.height).
PreTranslate(aDest.x - aSrc.x, aDest.y - aSrc.y));
context->SetMatrixDouble(contextMatrix.
PreScale(1.0 / contextScale.width,
1.0 / contextScale.height).
PreTranslate(aDest.x - aSrc.x, aDest.y - aSrc.y));
// FLAG_CLAMP is added for increased performance, since we never tile here.
uint32_t modifiedFlags = aImage.mDrawingFlags | imgIContainer::FLAG_CLAMP;
@ -5603,8 +5601,7 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindowInner& aWindow, double aX,
thebes = gfxContext::CreateOrNull(mTarget);
MOZ_ASSERT(thebes); // already checked the draw target above
// (in SupportsAzureContentForDrawTarget)
thebes->SetMatrix(gfxMatrix(matrix._11, matrix._12, matrix._21,
matrix._22, matrix._31, matrix._32));
thebes->SetMatrix(matrix);
} else {
IntSize dtSize = IntSize::Ceil(sw, sh);
if (!Factory::AllowedSurfaceSize(dtSize)) {
@ -5621,7 +5618,7 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindowInner& aWindow, double aX,
thebes = gfxContext::CreateOrNull(drawDT);
MOZ_ASSERT(thebes); // alrady checked the draw target above
thebes->SetMatrix(gfxMatrix::Scaling(matrix._11, matrix._22));
thebes->SetMatrix(Matrix::Scaling(matrix._11, matrix._22));
}
nsCOMPtr<nsIPresShell> shell = presContext->PresShell();

View File

@ -95,7 +95,7 @@ DocumentRendererChild::RenderDocument(nsPIDOMWindowOuter* window,
}
RefPtr<gfxContext> ctx = gfxContext::CreateOrNull(dt);
MOZ_ASSERT(ctx); // already checked the draw target above
ctx->SetMatrix(mozilla::gfx::ThebesMatrix(transform));
ctx->SetMatrix(transform);
nsCOMPtr<nsIPresShell> shell = presContext->PresShell();
shell->RenderDocument(documentRect, renderFlags, bgColor, ctx);

View File

@ -2644,8 +2644,8 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext,
// Renderer::Draw() draws a rectangle with top-left at the aContext origin.
gfxContextAutoSaveRestore autoSR(aContext);
aContext->SetMatrix(
aContext->CurrentMatrix().PreTranslate(pluginRect.TopLeft()));
aContext->SetMatrixDouble(
aContext->CurrentMatrixDouble().PreTranslate(pluginRect.TopLeft()));
Renderer renderer(window, this, pluginSize, pluginDirtyRect);

View File

@ -60,7 +60,7 @@ public:
AutoRestoreTransform autoRestoreTransform(aDT);
Matrix transform = aDT->GetTransform();
RefPtr<gfxContext> context = gfxContext::CreateOrNull(aDT, aDeviceOffset);
context->SetMatrix(ThebesMatrix(transform));
context->SetMatrix(transform);
mItem->Paint(mBuilder, context);
}

View File

@ -67,8 +67,8 @@ ClipToContain(gfxContext* aContext, const IntRect& aRect)
gfxRect deviceRect = aContext->UserToDevice(userRect);
deviceRect.RoundOut();
gfxMatrix currentMatrix = aContext->CurrentMatrix();
aContext->SetMatrix(gfxMatrix());
Matrix currentMatrix = aContext->CurrentMatrix();
aContext->SetMatrix(Matrix());
aContext->NewPath();
aContext->Rectangle(deviceRect);
aContext->Clip();
@ -130,7 +130,7 @@ BasicLayerManager::PushGroupForLayer(gfxContext* aContext, Layer* aLayer, const
// destination. Since the User->Device space transform will be applied
// to the mask by PopGroupAndBlend we need to adjust the transform to
// transform the mask to user space.
Matrix currentTransform = ToMatrix(aGroupResult.mFinalTarget->CurrentMatrix());
Matrix currentTransform = aGroupResult.mFinalTarget->CurrentMatrix();
currentTransform.Invert();
maskTransform = maskTransform * currentTransform;
}
@ -249,7 +249,7 @@ public:
// it applies an identity.
void Apply2DTransform()
{
mTarget->SetMatrix(ThebesMatrix(mTransform));
mTarget->SetMatrix(mTransform);
}
// Set the opaque rect to match the bounds of the visible region.
@ -591,7 +591,7 @@ BasicLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback,
} else {
mSnapEffectiveTransforms = true;
}
mRoot->ComputeEffectiveTransforms(mTarget ? Matrix4x4::From2D(ToMatrix(mTarget->CurrentMatrix())) : Matrix4x4());
mRoot->ComputeEffectiveTransforms(mTarget ? Matrix4x4::From2D(mTarget->CurrentMatrix()) : Matrix4x4());
ToData(mRoot)->Validate(aCallback, aCallbackData, nullptr);
if (mRoot->GetMaskLayer()) {
@ -788,9 +788,9 @@ InstallLayerClipPreserves3D(gfxContext* aTarget, Layer* aLayer)
if (!transform3d.CanDraw2D(&transform)) {
gfxDevCrash(LogReason::CannotDraw3D) << "GFX: We should not have a 3D transform that CanDraw2D() is false!";
}
gfxMatrix oldTransform = aTarget->CurrentMatrix();
transform *= ToMatrix(oldTransform);
aTarget->SetMatrix(ThebesMatrix(transform));
Matrix oldTransform = aTarget->CurrentMatrix();
transform *= oldTransform;
aTarget->SetMatrix(transform);
aTarget->NewPath();
aTarget->SnappedRectangle(gfxRect(clipRect->x, clipRect->y,

View File

@ -64,7 +64,7 @@ PaintWithMask(gfxContext* aContext, float aOpacity, Layer* aMaskLayer)
{
AutoMoz2DMaskData mask;
if (GetMaskData(aMaskLayer, Point(), &mask)) {
aContext->SetMatrix(ThebesMatrix(mask.GetTransform()));
aContext->SetMatrix(mask.GetTransform());
aContext->Mask(mask.GetSurface(), aOpacity);
return;
}

View File

@ -991,7 +991,7 @@ void ClientMultiTiledLayerBuffer::Update(const nsIntRegion& newValidRegion,
RefPtr<gfxContext> ctx = gfxContext::CreateOrNull(drawTarget);
MOZ_ASSERT(ctx); // already checked the draw target above
ctx->SetMatrix(
ctx->CurrentMatrix().PreScale(mResolution, mResolution).PreTranslate(ThebesPoint(-mTilingOrigin)));
ctx->CurrentMatrix().PreScale(mResolution, mResolution).PreTranslate(-mTilingOrigin));
mCallback(&mPaintedLayer, ctx, paintRegion, dirtyRegion,
DrawRegionClip::DRAW, nsIntRegion(), mCallbackData);

View File

@ -426,7 +426,7 @@ nsDeviceContext::CreateRenderingContextCommon(bool aWantReferenceContext)
}
transform.PreScale(mPrintingScale, mPrintingScale);
pContext->SetMatrix(transform);
pContext->SetMatrixDouble(transform);
return pContext.forget();
}

View File

@ -52,7 +52,7 @@ gfxAlphaBoxBlur::Init(gfxContext* aDestinationCtx,
RefPtr<gfxContext> context = gfxContext::CreateOrNull(dt);
MOZ_ASSERT(context); // already checked for target above
context->SetMatrix(gfxMatrix::Translation(-mBlur.GetRect().TopLeft()));
context->SetMatrix(Matrix::Translation(-mBlur.GetRect().TopLeft()));
return context.forget();
}
@ -588,7 +588,7 @@ GetBlur(gfxContext* aDestinationCtx,
// since our source image is only 1px for some parts, we make thousands of calls.
// Instead just render the blur ourself here as one image and send it over for printing.
// TODO: May need to change this with the blob renderer in WR since it also records.
Matrix destMatrix = ToMatrix(aDestinationCtx->CurrentMatrix());
Matrix destMatrix = aDestinationCtx->CurrentMatrix();
bool useDestRect = !destMatrix.IsRectilinear() || destMatrix.HasNonIntegerTranslation() ||
aDestinationCtx->GetDrawTarget()->IsRecording();
if (useDestRect) {

View File

@ -112,7 +112,7 @@ gfxContext::CreatePreservingTransformOrNull(DrawTarget* aTarget)
Matrix transform = aTarget->GetTransform();
RefPtr<gfxContext> result = new gfxContext(aTarget);
result->SetMatrix(ThebesMatrix(transform));
result->SetMatrix(transform);
return result.forget();
}
@ -318,16 +318,28 @@ gfxContext::Multiply(const gfxMatrix& matrix)
}
void
gfxContext::SetMatrix(const gfxMatrix& matrix)
gfxContext::SetMatrix(const gfx::Matrix& matrix)
{
CURRENTSTATE_CHANGED()
ChangeTransform(ToMatrix(matrix));
ChangeTransform(matrix);
}
void
gfxContext::SetMatrixDouble(const gfxMatrix& matrix)
{
SetMatrix(ToMatrix(matrix));
}
gfx::Matrix
gfxContext::CurrentMatrix() const
{
return mTransform;
}
gfxMatrix
gfxContext::CurrentMatrix() const
gfxContext::CurrentMatrixDouble() const
{
return ThebesMatrix(mTransform);
return ThebesMatrix(CurrentMatrix());
}
gfxPoint

View File

@ -172,12 +172,14 @@ public:
/**
* Replaces the current transformation matrix with matrix.
*/
void SetMatrix(const gfxMatrix& matrix);
void SetMatrix(const mozilla::gfx::Matrix& matrix);
void SetMatrixDouble(const gfxMatrix& matrix);
/**
* Returns the current transformation matrix.
*/
gfxMatrix CurrentMatrix() const;
mozilla::gfx::Matrix CurrentMatrix() const;
gfxMatrix CurrentMatrixDouble() const;
/**
* Converts a point from device to user coordinates using the inverse
@ -628,7 +630,7 @@ public:
}
}
const gfxMatrix& Matrix()
const mozilla::gfx::Matrix& Matrix()
{
MOZ_ASSERT(mContext, "mMatrix doesn't contain a useful matrix");
return mMatrix;
@ -638,7 +640,7 @@ public:
private:
gfxContext *mContext;
gfxMatrix mMatrix;
mozilla::gfx::Matrix mMatrix;
};

View File

@ -1679,7 +1679,7 @@ private:
fillPattern =
mFontParams.contextPaint->GetFillPattern(
mRunParams.context->GetDrawTarget(),
mRunParams.context->CurrentMatrix(),
mRunParams.context->CurrentMatrixDouble(),
imgParams);
}
if (!fillPattern) {
@ -2163,7 +2163,7 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT)
? -M_PI / 2.0 : M_PI / 2.0;
gfxMatrix mat =
aRunParams.context->CurrentMatrix().
aRunParams.context->CurrentMatrixDouble().
PreTranslate(p). // translate origin for rotation
PreRotate(rotation). // turn 90deg CCW (sideways-left) or CW (*-right)
PreTranslate(-p); // undo the translation
@ -2182,7 +2182,7 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
mat.PreTranslate(baseAdj);
}
aRunParams.context->SetMatrix(mat);
aRunParams.context->SetMatrixDouble(mat);
}
RefPtr<SVGContextPaint> contextPaint;
@ -2193,7 +2193,7 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
RefPtr<gfxPattern> fillPattern = aRunParams.context->GetPattern();
contextPaint =
new SimpleTextContextPaint(fillPattern, nullptr,
aRunParams.context->CurrentMatrix());
aRunParams.context->CurrentMatrixDouble());
fontParams.contextPaint = contextPaint.get();
}

View File

@ -438,8 +438,8 @@ PrescaleAndTileDrawable(gfxDrawable* aDrawable,
gfxFloat aOpacity,
ExtendMode aExtendMode)
{
gfxSize scaleFactor = aContext->CurrentMatrix().ScaleFactors(true);
gfxMatrix scaleMatrix = gfxMatrix::Scaling(scaleFactor.width, scaleFactor.height);
Size scaleFactor = aContext->CurrentMatrix().ScaleFactors(true);
Matrix scaleMatrix = Matrix::Scaling(scaleFactor.width, scaleFactor.height);
const float fuzzFactor = 0.01;
// If we aren't scaling or translating, don't go down this path
@ -456,13 +456,13 @@ PrescaleAndTileDrawable(gfxDrawable* aDrawable,
clipExtents.Inflate(1.0);
gfxRect needed = aRegion.IntersectAndRestrict(clipExtents);
Rect scaledNeededRect = ToMatrix(scaleMatrix).TransformBounds(ToRect(needed));
Rect scaledNeededRect = scaleMatrix.TransformBounds(ToRect(needed));
scaledNeededRect.RoundOut();
if (scaledNeededRect.IsEmpty()) {
return false;
}
Rect scaledImageRect = ToMatrix(scaleMatrix).TransformBounds(aImageRect);
Rect scaledImageRect = scaleMatrix.TransformBounds(aImageRect);
if (!ShouldUseTempSurface(scaledImageRect, scaledNeededRect)) {
return false;
}
@ -485,7 +485,7 @@ PrescaleAndTileDrawable(gfxDrawable* aDrawable,
RefPtr<gfxContext> tmpCtx = gfxContext::CreateOrNull(scaledDT);
MOZ_ASSERT(tmpCtx); // already checked the target above
scaledDT->SetTransform(ToMatrix(scaleMatrix));
scaledDT->SetTransform(scaleMatrix);
gfxRect gfxImageRect(aImageRect.x, aImageRect.y, aImageRect.width, aImageRect.height);
// Since this is just the scaled image, we don't want to repeat anything yet.
@ -495,12 +495,12 @@ PrescaleAndTileDrawable(gfxDrawable* aDrawable,
{
gfxContextMatrixAutoSaveRestore autoSR(aContext);
Matrix withoutScale = ToMatrix(aContext->CurrentMatrix());
Matrix withoutScale = aContext->CurrentMatrix();
DrawTarget* destDrawTarget = aContext->GetDrawTarget();
// The translation still is in scaled units
withoutScale.PreScale(1.0 / scaleFactor.width, 1.0 / scaleFactor.height);
aContext->SetMatrix(ThebesMatrix(withoutScale));
aContext->SetMatrix(withoutScale);
DrawOptions drawOptions(aOpacity, aContext->CurrentOp(),
aContext->CurrentAntialiasMode());

View File

@ -68,7 +68,7 @@ gfxWindowsNativeDrawing::BeginNativeDrawing()
if (surf && surf->CairoStatus() != 0)
return nullptr;
gfxMatrix m = mContext->CurrentMatrix();
gfxMatrix m = mContext->CurrentMatrixDouble();
if (!m.HasNonTranslation())
mTransformType = TRANSLATION_ONLY;
else if (m.HasNonAxisAlignedTransform())

View File

@ -467,7 +467,7 @@ void
gfxXlibNativeRenderer::Draw(gfxContext* ctx, IntSize size,
uint32_t flags, Screen *screen, Visual *visual)
{
gfxMatrix matrix = ctx->CurrentMatrix();
Matrix matrix = ctx->CurrentMatrix();
// We can only draw direct or onto a copied background if pixels align and
// native drawing is compatible with the current operator. (The matrix is

View File

@ -302,10 +302,10 @@ SVGDrawingCallback::operator()(gfxContext* aContext,
if (!matrix.Invert()) {
return false;
}
aContext->SetMatrix(
aContext->CurrentMatrix().PreMultiply(matrix).
PreScale(double(mSize.width) / mViewportSize.width,
double(mSize.height) / mViewportSize.height));
aContext->SetMatrixDouble(
aContext->CurrentMatrixDouble().PreMultiply(matrix).
PreScale(double(mSize.width) / mViewportSize.width,
double(mSize.height) / mViewportSize.height));
nsPresContext* presContext = presShell->GetPresContext();
MOZ_ASSERT(presContext, "pres shell w/out pres context");

View File

@ -4685,10 +4685,10 @@ PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags,
// slight rounding errors here. We use NudgeToIntegers() here to adjust
// matrix components that are integers up to the accuracy of floats to be
// those integers.
gfxMatrix newTM = aThebesContext->CurrentMatrix().PreTranslate(offset).
PreScale(scale, scale).
NudgeToIntegers();
aThebesContext->SetMatrix(newTM);
gfxMatrix newTM = aThebesContext->CurrentMatrixDouble().PreTranslate(offset).
PreScale(scale, scale).
NudgeToIntegers();
aThebesContext->SetMatrixDouble(newTM);
AutoSaveRestoreRenderingState _(this);
@ -5088,7 +5088,7 @@ PresShell::PaintRangePaintInfo(const nsTArray<UniquePtr<RangePaintInfo>>& aItems
ctx->Clip(path);
}
gfxMatrix initialTM = ctx->CurrentMatrix();
gfxMatrix initialTM = ctx->CurrentMatrixDouble();
if (resize)
initialTM.PreScale(scale, scale);
@ -5118,7 +5118,7 @@ PresShell::PaintRangePaintInfo(const nsTArray<UniquePtr<RangePaintInfo>>& aItems
gfxPoint rootOffset =
nsLayoutUtils::PointToGfxPoint(rangeInfo->mRootOffset,
pc->AppUnitsPerDevPixel());
ctx->SetMatrix(gfxMatrix(initialTM).PreTranslate(rootOffset));
ctx->SetMatrixDouble(initialTM.PreTranslate(rootOffset));
aArea.MoveBy(-rangeInfo->mRootOffset.x, -rangeInfo->mRootOffset.y);
nsRegion visible(aArea);
RefPtr<LayerManager> layerManager =
@ -10144,8 +10144,8 @@ void ReflowCountMgr::PaintCount(const char* aName,
aRenderingContext->Save();
gfxPoint devPixelOffset =
nsLayoutUtils::PointToGfxPoint(aOffset, appUnitsPerDevPixel);
aRenderingContext->SetMatrix(
aRenderingContext->CurrentMatrix().PreTranslate(devPixelOffset));
aRenderingContext->SetMatrixDouble(
aRenderingContext->CurrentMatrixDouble().PreTranslate(devPixelOffset));
// We don't care about the document language or user fonts here;
// just get a default Latin font.

View File

@ -3728,8 +3728,8 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
gfxPoint devPixelOffset =
nsLayoutUtils::PointToGfxPoint(pos,
presContext->AppUnitsPerDevPixel());
aRenderingContext->SetMatrix(
aRenderingContext->CurrentMatrix().PreTranslate(devPixelOffset));
aRenderingContext->SetMatrixDouble(
aRenderingContext->CurrentMatrixDouble().PreTranslate(devPixelOffset));
}
}
builder.SetIgnoreScrollFrame(rootScrollFrame);
@ -6674,7 +6674,7 @@ ComputeSnappedImageDrawingParameters(gfxContext* aCtx,
gfxRect devPixelDirty =
nsLayoutUtils::RectToGfxRect(aDirty, aAppUnitsPerDevPixel);
gfxMatrix currentMatrix = aCtx->CurrentMatrix();
gfxMatrix currentMatrix = aCtx->CurrentMatrixDouble();
gfxRect fill = devPixelFill;
gfxRect dest = devPixelDest;
bool didSnap;
@ -6901,7 +6901,7 @@ DrawImageInternal(gfxContext& aContext,
{
gfxContextMatrixAutoSaveRestore contextMatrixRestorer(&aContext);
aContext.SetMatrix(params.imageSpaceToDeviceSpace);
aContext.SetMatrixDouble(params.imageSpaceToDeviceSpace);
Maybe<SVGImageContext> fallbackContext;
if (!aSVGContext) {

View File

@ -871,7 +871,7 @@ nsPluginFrame::PaintPrintPlugin(nsIFrame* aFrame, gfxContext* aCtx,
nsLayoutUtils::PointToGfxPoint(pt, aFrame->PresContext()->AppUnitsPerDevPixel());
gfxContextMatrixAutoSaveRestore autoSR(aCtx);
aCtx->SetMatrix(aCtx->CurrentMatrix().PreTranslate(devPixelPt));
aCtx->SetMatrixDouble(aCtx->CurrentMatrixDouble().PreTranslate(devPixelPt));
// FIXME - Bug 385435: Doesn't aDirtyRect need translating too?

View File

@ -5190,9 +5190,9 @@ nsDisplayText::RenderToContext(gfxContext* aCtx, nsDisplayListBuilder* aBuilder,
// necessary. This is done here because we want selection be
// compressed at the same time as text.
gfxPoint pt = nsLayoutUtils::PointToGfxPoint(framePt, A2D);
gfxMatrix mat = aCtx->CurrentMatrix()
gfxMatrix mat = aCtx->CurrentMatrixDouble()
.PreTranslate(pt).PreScale(scaleFactor, 1.0).PreTranslate(-pt);
aCtx->SetMatrix (mat);
aCtx->SetMatrixDouble(mat);
}
}
nsTextFrame::PaintTextParams params(aCtx);
@ -7240,10 +7240,10 @@ nsTextFrame::DrawTextRunAndDecorations(Range aRange,
float scaleFactor = GetTextCombineScaleFactor(this);
if (scaleFactor != 1.0f) {
scaledRestorer.SetContext(aParams.context);
gfxMatrix unscaled = aParams.context->CurrentMatrix();
gfxMatrix unscaled = aParams.context->CurrentMatrixDouble();
gfxPoint pt(x / app, y / app);
unscaled.PreTranslate(pt).PreScale(1.0f / scaleFactor, 1.0f).PreTranslate(-pt);
aParams.context->SetMatrix(unscaled);
aParams.context->SetMatrixDouble(unscaled);
}
}

View File

@ -2025,16 +2025,16 @@ nsMathMLChar::ApplyTransforms(gfxContext* aThebesContext,
nsPoint pt = r.TopRight();
gfxPoint devPixelOffset(NSAppUnitsToFloatPixels(pt.x, aAppUnitsPerGfxUnit),
NSAppUnitsToFloatPixels(pt.y, aAppUnitsPerGfxUnit));
aThebesContext->SetMatrix(
aThebesContext->CurrentMatrix().PreTranslate(devPixelOffset).
PreScale(-mScaleX, mScaleY));
aThebesContext->SetMatrixDouble(
aThebesContext->CurrentMatrixDouble().PreTranslate(devPixelOffset).
PreScale(-mScaleX, mScaleY));
} else {
nsPoint pt = r.TopLeft();
gfxPoint devPixelOffset(NSAppUnitsToFloatPixels(pt.x, aAppUnitsPerGfxUnit),
NSAppUnitsToFloatPixels(pt.y, aAppUnitsPerGfxUnit));
aThebesContext->SetMatrix(
aThebesContext->CurrentMatrix().PreTranslate(devPixelOffset).
PreScale(mScaleX, mScaleY));
aThebesContext->SetMatrixDouble(
aThebesContext->CurrentMatrixDouble().PreTranslate(devPixelOffset).
PreScale(mScaleX, mScaleY));
}
// update the bounding rectangle.

View File

@ -3684,8 +3684,8 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder,
gfxDevCrash(LogReason::InvalidContext) << "PaintInactive context problem " << gfx::hexa(tempDT);
return;
}
context->SetMatrix(gfxMatrix::Translation(-itemVisibleRect.x,
-itemVisibleRect.y));
context->SetMatrix(Matrix::Translation(-itemVisibleRect.x,
-itemVisibleRect.y));
}
}
#endif
@ -3914,7 +3914,7 @@ ContainerState::SetupMaskLayerForCSSMask(Layer* aLayer,
}
RefPtr<gfxContext> maskCtx = gfxContext::CreateOrNull(dt);
maskCtx->SetMatrix(gfxMatrix::Translation(-itemRect.TopLeft()));
maskCtx->SetMatrix(Matrix::Translation(-itemRect.TopLeft()));
maskCtx->Multiply(gfxMatrix::Scaling(mParameters.mXScale, mParameters.mYScale));
bool isPaintFinished = aMaskItem->PaintMask(mBuilder, maskCtx);
@ -5889,7 +5889,7 @@ static void DebugPaintItem(DrawTarget& aDrawTarget,
gfxDevCrash(LogReason::InvalidContext) << "DebugPaintItem context problem " << gfx::hexa(tempDT);
return;
}
context->SetMatrix(gfxMatrix::Translation(-bounds.x, -bounds.y));
context->SetMatrix(Matrix::Translation(-bounds.x, -bounds.y));
aItem->Paint(aBuilder, context);
RefPtr<SourceSurface> surface = tempDT->Snapshot();
@ -6177,9 +6177,9 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
// Apply the residual transform if it has been enabled, to ensure that
// snapping when we draw into aContext exactly matches the ideal transform.
// See above for why this is OK.
aContext->SetMatrix(
aContext->CurrentMatrix().PreTranslate(aLayer->GetResidualTranslation() - gfxPoint(offset.x, offset.y)).
PreScale(userData->mXScale, userData->mYScale));
aContext->SetMatrixDouble(
aContext->CurrentMatrixDouble().PreTranslate(aLayer->GetResidualTranslation() - gfxPoint(offset.x, offset.y)).
PreScale(userData->mXScale, userData->mYScale));
layerBuilder->PaintItems(entry->mItems, iterRect, aContext,
builder, presContext,
@ -6193,9 +6193,9 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
// Apply the residual transform if it has been enabled, to ensure that
// snapping when we draw into aContext exactly matches the ideal transform.
// See above for why this is OK.
aContext->SetMatrix(
aContext->CurrentMatrix().PreTranslate(aLayer->GetResidualTranslation() - gfxPoint(offset.x, offset.y)).
PreScale(userData->mXScale,userData->mYScale));
aContext->SetMatrixDouble(
aContext->CurrentMatrixDouble().PreTranslate(aLayer->GetResidualTranslation() - gfxPoint(offset.x, offset.y)).
PreScale(userData->mXScale,userData->mYScale));
layerBuilder->PaintItems(entry->mItems, aRegionToDraw.GetBounds(), aContext,
builder, presContext,

View File

@ -1685,8 +1685,8 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
nsLayoutUtils::PointToGfxPoint(nsPoint(shadowItem->mXOffset,
shadowItem->mYOffset),
aPresContext->AppUnitsPerDevPixel());
shadowContext->SetMatrix(
shadowContext->CurrentMatrix().PreTranslate(devPixelOffset));
shadowContext->SetMatrixDouble(
shadowContext->CurrentMatrixDouble().PreTranslate(devPixelOffset));
nsRect nativeRect = aDirtyRect;
nativeRect.MoveBy(-nsPoint(shadowItem->mXOffset, shadowItem->mYOffset));
@ -4479,7 +4479,7 @@ nsContextBoxBlur::Init(const nsRect& aRect, nscoord aSpreadRadius,
nsLayoutUtils::RectToGfxRect(aDirtyRect, aAppUnitsPerDevPixel);
dirtyRect.RoundOut();
gfxMatrix transform = aDestinationCtx->CurrentMatrix();
gfxMatrix transform = aDestinationCtx->CurrentMatrixDouble();
rect = transform.TransformBounds(rect);
mPreTransformed = !transform.IsIdentity();
@ -4516,7 +4516,7 @@ nsContextBoxBlur::DoPaint()
gfxContextMatrixAutoSaveRestore saveMatrix(mDestinationCtx);
if (mPreTransformed) {
mDestinationCtx->SetMatrix(gfxMatrix());
mDestinationCtx->SetMatrix(Matrix());
}
mAlphaBoxBlur.Paint(mDestinationCtx);
@ -4577,12 +4577,12 @@ nsContextBoxBlur::BlurRectangle(gfxContext* aDestinationCtx,
// Do blurs in device space when possible.
// Chrome/Skia always does the blurs in device space
// and will sometimes get incorrect results (e.g. rotated blurs)
gfxMatrix transform = aDestinationCtx->CurrentMatrix();
gfxMatrix transform = aDestinationCtx->CurrentMatrixDouble();
// XXX: we could probably handle negative scales but for now it's easier just to fallback
if (!transform.HasNonAxisAlignedTransform() && transform._11 > 0.0 && transform._22 > 0.0) {
scaleX = transform._11;
scaleY = transform._22;
aDestinationCtx->SetMatrix(gfxMatrix());
aDestinationCtx->SetMatrix(Matrix());
} else {
transform = gfxMatrix();
}
@ -4677,13 +4677,13 @@ nsContextBoxBlur::InsetBoxBlur(gfxContext* aDestinationCtx,
// input data to the blur. This way, we don't have to scale the min
// inset blur to the invert of the dest context, then rescale it back
// when we draw to the destination surface.
gfxSize scale = aDestinationCtx->CurrentMatrix().ScaleFactors(true);
Matrix transform = ToMatrix(aDestinationCtx->CurrentMatrix());
gfx::Size scale = aDestinationCtx->CurrentMatrix().ScaleFactors(true);
Matrix transform = aDestinationCtx->CurrentMatrix();
// XXX: we could probably handle negative scales but for now it's easier just to fallback
if (!transform.HasNonAxisAlignedTransform() && transform._11 > 0.0 && transform._22 > 0.0) {
// If we don't have a rotation, we're pre-transforming all the rects.
aDestinationCtx->SetMatrix(gfxMatrix());
aDestinationCtx->SetMatrix(Matrix());
} else {
// Don't touch anything, we have a rotation.
transform = Matrix();

View File

@ -932,7 +932,7 @@ nsCSSGradientRenderer::Paint(gfxContext& aContext,
gfxRect dirtyAreaToFill = nsLayoutUtils::RectToGfxRect(dirty, appUnitsPerDevPixel);
dirtyAreaToFill.RoundOut();
gfxMatrix ctm = aContext.CurrentMatrix();
Matrix ctm = aContext.CurrentMatrix();
bool isCTMPreservingAxisAlignedRectangles = ctm.PreservesAxisAlignedRectangles();
// xStart/yStart are the top-left corner of the top-left tile.
@ -975,7 +975,7 @@ nsCSSGradientRenderer::Paint(gfxContext& aContext,
gfxMatrix transform = gfxUtils::TransformRectToRect(fillRect,
snappedFillRectTopLeft, snappedFillRectTopRight,
snappedFillRectBottomRight);
aContext.SetMatrix(transform);
aContext.SetMatrixDouble(transform);
}
aContext.NewPath();
aContext.Rectangle(fillRect);
@ -989,8 +989,8 @@ nsCSSGradientRenderer::Paint(gfxContext& aContext,
edgeColor.a *= aOpacity;
aContext.SetColor(edgeColor);
} else {
aContext.SetMatrix(
aContext.CurrentMatrix().Copy().PreTranslate(tileRect.TopLeft()));
aContext.SetMatrixDouble(
aContext.CurrentMatrixDouble().Copy().PreTranslate(tileRect.TopLeft()));
aContext.SetPattern(gradientPattern);
}
aContext.Fill();

View File

@ -771,7 +771,7 @@ GenerateAndPushTextMask(nsIFrame* aFrame, gfxContext* aContext,
{
// Paint text selection background into sourceCtx.
gfxContextMatrixAutoSaveRestore save(sourceCtx);
sourceCtx->SetMatrix(sourceCtx->CurrentMatrix().PreTranslate(bounds.TopLeft()));
sourceCtx->SetMatrixDouble(sourceCtx->CurrentMatrixDouble().PreTranslate(bounds.TopLeft()));
nsLayoutUtils::PaintFrame(aContext, aFrame,
nsRect(nsPoint(0, 0), aFrame->GetSize()),
@ -793,10 +793,10 @@ GenerateAndPushTextMask(nsIFrame* aFrame, gfxContext* aContext,
}
RefPtr<gfxContext> maskCtx = gfxContext::CreatePreservingTransformOrNull(maskDT);
MOZ_ASSERT(maskCtx);
gfxMatrix currentMatrix = sourceCtx->CurrentMatrix();
maskCtx->SetMatrix(gfxMatrix::Translation(bounds.TopLeft()) *
currentMatrix *
gfxMatrix::Translation(-drawRect.TopLeft()));
gfxMatrix currentMatrix = sourceCtx->CurrentMatrixDouble();
maskCtx->SetMatrixDouble(gfxMatrix::Translation(bounds.TopLeft()) *
currentMatrix *
gfxMatrix::Translation(-drawRect.TopLeft()));
// Shade text shape into mask A8 surface.
nsLayoutUtils::PaintFrame(maskCtx, aFrame,
@ -9171,7 +9171,7 @@ ComputeMaskGeometry(PaintFramesParams& aParams)
frame->PresContext()->AppUnitsPerDevPixel());
gfxContextMatrixAutoSaveRestore matSR(&ctx);
ctx.SetMatrix(ctx.CurrentMatrix().PreTranslate(devPixelOffsetToUserSpace));
ctx.SetMatrixDouble(ctx.CurrentMatrixDouble().PreTranslate(devPixelOffsetToUserSpace));
// Convert boaderArea and dirtyRect to user space.
int32_t appUnitsPerDevPixel = frame->PresContext()->AppUnitsPerDevPixel();

View File

@ -698,7 +698,7 @@ nsImageRenderer::DrawableForElement(const nsRect& aImageRect,
nsSVGIntegrationUtils::DrawableFromPaintServer(
mPaintServerFrame, mForFrame, mSize, imageSize,
aContext.GetDrawTarget(),
aContext.CurrentMatrix(),
aContext.CurrentMatrixDouble(),
nsSVGIntegrationUtils::FLAG_SYNC_DECODE_IMAGES);
return drawable.forget();

View File

@ -277,7 +277,7 @@ SVGGeometryFrame::PaintSVG(gfxContext& aContext,
// Matrix to the geometry's user space:
gfxMatrix newMatrix =
aContext.CurrentMatrix().PreMultiply(aTransform).NudgeToIntegers();
aContext.CurrentMatrixDouble().PreMultiply(aTransform).NudgeToIntegers();
if (newMatrix.IsSingular()) {
return;
}
@ -767,7 +767,7 @@ SVGGeometryFrame::Render(gfxContext* aContext,
// set it unnecessarily if we return early (it's an expensive operation for
// some backends).
gfxContextMatrixAutoSaveRestore autoRestoreTransform(aContext);
aContext->SetMatrix(aNewTransform);
aContext->SetMatrixDouble(aNewTransform);
if (GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) {
// We don't complicate this code with GetAsSimplePath since the cost of

View File

@ -2943,7 +2943,7 @@ SVGTextDrawPathCallbacks::HandleTextGeometry()
} else {
// Normal painting.
gfxContextMatrixAutoSaveRestore saveMatrix(&mContext);
mContext.SetMatrix(mCanvasTM);
mContext.SetMatrixDouble(mCanvasTM);
FillAndStrokeGeometry();
}
@ -3589,7 +3589,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
nsPresContext* presContext = PresContext();
gfxMatrix initialMatrix = aContext.CurrentMatrix();
gfxMatrix initialMatrix = aContext.CurrentMatrixDouble();
if (mState & NS_FRAME_IS_NONDISPLAY) {
// If we are in a canvas DrawWindow call that used the
@ -3650,7 +3650,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
gfxContextMatrixAutoSaveRestore matSR(&aContext);
aContext.NewPath();
aContext.Multiply(canvasTMForChildren);
gfxMatrix currentMatrix = aContext.CurrentMatrix();
gfxMatrix currentMatrix = aContext.CurrentMatrixDouble();
RefPtr<nsCaret> caret = presContext->PresShell()->GetCaret();
nsRect caretRect;
@ -3687,7 +3687,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
gfxMatrix runTransform =
run.GetTransformFromUserSpaceForPainting(presContext, item) *
currentMatrix;
aContext.SetMatrix(runTransform);
aContext.SetMatrixDouble(runTransform);
if (drawMode != DrawMode(0)) {
bool paintSVGGlyphs;

View File

@ -71,7 +71,7 @@ nsFilterInstance::PaintFilteredFrame(nsIFrame *aFilteredFrame,
UniquePtr<UserSpaceMetrics> metrics = UserSpaceMetricsForFrame(aFilteredFrame);
gfxContextMatrixAutoSaveRestore autoSR(aCtx);
gfxSize scaleFactors = aCtx->CurrentMatrix().ScaleFactors(true);
gfxSize scaleFactors = aCtx->CurrentMatrixDouble().ScaleFactors(true);
if (scaleFactors.IsEmpty()) {
return;
}
@ -85,7 +85,7 @@ nsFilterInstance::PaintFilteredFrame(nsIFrame *aFilteredFrame,
MOZ_ASSERT(invertible);
// Pull scale vector out of aCtx's transform, put all scale factors, which
// includes css and css-to-dev-px scale, into scaleMatrixInDevUnits.
aCtx->SetMatrix(reverseScaleMatrix * aCtx->CurrentMatrix());
aCtx->SetMatrixDouble(reverseScaleMatrix * aCtx->CurrentMatrixDouble());
gfxMatrix scaleMatrixInDevUnits =
scaleMatrix * nsSVGUtils::GetCSSPxToDevPxMatrix(aFilteredFrame);
@ -414,8 +414,8 @@ nsFilterInstance::BuildSourcePaint(SourceInfo *aSource,
MOZ_ASSERT(ctx); // already checked the draw target above
gfxContextAutoSaveRestore saver(ctx);
ctx->SetMatrix(mPaintTransform *
gfxMatrix::Translation(-neededRect.TopLeft()));
ctx->SetMatrixDouble(mPaintTransform *
gfxMatrix::Translation(-neededRect.TopLeft()));
GeneralPattern pattern;
if (aSource == &mFillPaint) {
nsSVGUtils::MakeFillPatternFor(mTargetFrame, ctx, &pattern, aImgParams);
@ -483,8 +483,8 @@ nsFilterInstance::BuildSourceImage(DrawTarget *aDest, imgDrawingParams& aImgPara
gfxMatrix devPxToCssPxTM = nsSVGUtils::GetCSSPxToDevPxMatrix(mTargetFrame);
DebugOnly<bool> invertible = devPxToCssPxTM.Invert();
MOZ_ASSERT(invertible);
ctx->SetMatrix(devPxToCssPxTM * mPaintTransform *
gfxMatrix::Translation(-neededRect.TopLeft()));
ctx->SetMatrixDouble(devPxToCssPxTM * mPaintTransform *
gfxMatrix::Translation(-neededRect.TopLeft()));
mPaintCallback->Paint(*ctx, mTargetFrame, mPaintTransform, &dirty, aImgParams);

View File

@ -63,9 +63,9 @@ nsSVGClipPathFrame::ApplyClipPath(gfxContext& aContext,
PrependLocalTransformsTo(GetClipPathTransform(aClippedFrame) * aMatrix,
eUserSpaceToParent);
gfxMatrix newMatrix =
aContext.CurrentMatrix().PreMultiply(toChildsUserSpace).NudgeToIntegers();
aContext.CurrentMatrixDouble().PreMultiply(toChildsUserSpace).NudgeToIntegers();
if (!newMatrix.IsSingular()) {
aContext.SetMatrix(newMatrix);
aContext.SetMatrixDouble(newMatrix);
FillRule clipRule =
nsSVGUtils::ToFillRule(pathFrame->StyleSVG()->mClipRule);
clipPath = pathElement->GetOrBuildPath(aDrawTarget, clipRule);
@ -103,7 +103,7 @@ nsSVGClipPathFrame::CreateClipMask(gfxContext& aReferenceContext,
}
static void
ComposeExtraMask(DrawTarget* aTarget, const gfxMatrix& aMaskTransfrom,
ComposeExtraMask(DrawTarget* aTarget,
SourceSurface* aExtraMask, const Matrix& aExtraMasksTransform)
{
MOZ_ASSERT(aExtraMask);
@ -178,14 +178,14 @@ nsSVGClipPathFrame::PaintClipMask(gfxContext& aMaskContext,
}
// Moz2D transforms in the opposite direction to Thebes
gfxMatrix maskTransfrom = aMaskContext.CurrentMatrix();
Matrix maskTransfrom = aMaskContext.CurrentMatrix();
maskTransfrom.Invert();
if (aExtraMask) {
ComposeExtraMask(maskDT, maskTransfrom, aExtraMask, aExtraMasksTransform);
ComposeExtraMask(maskDT, aExtraMask, aExtraMasksTransform);
}
*aMaskTransform = ToMatrix(maskTransfrom);
*aMaskTransform = maskTransfrom;
}
void
@ -271,7 +271,7 @@ nsSVGClipPathFrame::GetClipMask(gfxContext& aReferenceContext,
return nullptr;
}
maskContext->SetMatrix(aReferenceContext.CurrentMatrix() *
gfxMatrix::Translation(-offset));
Matrix::Translation(-offset));
PaintClipMask(*maskContext, aClippedFrame, aMatrix, aMaskTransform,
aExtraMask, aExtraMasksTransform);

View File

@ -419,7 +419,7 @@ public:
basic->SetTarget(&aContext);
gfxContextMatrixAutoSaveRestore autoSR(&aContext);
aContext.SetMatrix(aContext.CurrentMatrix().PreTranslate(-mUserSpaceToFrameSpaceOffset));
aContext.SetMatrixDouble(aContext.CurrentMatrixDouble().PreTranslate(-mUserSpaceToFrameSpaceOffset));
mLayerManager->EndTransaction(FrameLayerBuilder::DrawPaintedLayer, mBuilder);
basic->SetTarget(oldCtx);
@ -440,7 +440,7 @@ static void
PaintMaskSurface(const PaintFramesParams& aParams,
DrawTarget* aMaskDT, float aOpacity, nsStyleContext* aSC,
const nsTArray<nsSVGMaskFrame*>& aMaskFrames,
const gfxMatrix& aMaskSurfaceMatrix,
const Matrix& aMaskSurfaceMatrix,
const nsPoint& aOffsetToUserSpace)
{
MOZ_ASSERT(aMaskFrames.Length() > 0);
@ -573,8 +573,8 @@ CreateAndPaintMaskSurface(const PaintFramesParams& aParams,
// Set context's matrix on maskContext, offset by the maskSurfaceRect's
// position. This makes sure that we combine the masks in device space.
gfxMatrix maskSurfaceMatrix =
ctx.CurrentMatrix() * gfxMatrix::Translation(-aParams.maskRect.TopLeft());
Matrix maskSurfaceMatrix =
ctx.CurrentMatrix() * Matrix::Translation(-aParams.maskRect.TopLeft());
PaintMaskSurface(aParams, maskDT,
paintResult.opacityApplied ? aOpacity : 1.0,
@ -604,7 +604,7 @@ CreateAndPaintMaskSurface(const PaintFramesParams& aParams,
return paintResult;
}
paintResult.maskTransform = ToMatrix(maskSurfaceMatrix);
paintResult.maskTransform = maskSurfaceMatrix;
if (!paintResult.maskTransform.Invert()) {
return paintResult;
}
@ -711,8 +711,8 @@ MoveContextOriginToUserSpace(nsIFrame* aFrame, const PaintFramesParams& aParams)
{
EffectOffsets offset = ComputeEffectOffset(aFrame, aParams);
aParams.ctx.SetMatrix(
aParams.ctx.CurrentMatrix().PreTranslate(offset.offsetToUserSpaceInDevPx));
aParams.ctx.SetMatrixDouble(
aParams.ctx.CurrentMatrixDouble().PreTranslate(offset.offsetToUserSpaceInDevPx));
return offset;
}
@ -852,7 +852,7 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams)
maskUsage.shouldGenerateMaskLayer ? maskTarget->Snapshot() : nullptr;
clipPathFrame->PaintClipMask(ctx, frame, cssPxToDevPxMatrix,
&clipMaskTransform, maskSurface,
ToMatrix(ctx.CurrentMatrix()));
ctx.CurrentMatrix());
}
}

View File

@ -99,8 +99,8 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(MaskParams& aParams)
return nullptr;
}
gfxMatrix maskSurfaceMatrix =
context->CurrentMatrix() * gfxMatrix::Translation(-maskSurfaceRect.TopLeft());
Matrix maskSurfaceMatrix =
context->CurrentMatrix() * ToMatrix(gfxMatrix::Translation(-maskSurfaceRect.TopLeft()));
RefPtr<gfxContext> tmpCtx = gfxContext::CreateOrNull(maskDT);
MOZ_ASSERT(tmpCtx); // already checked the draw target above
@ -153,7 +153,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(MaskParams& aParams)
return nullptr;
}
*aParams.maskTransform = ToMatrix(maskSurfaceMatrix);
*aParams.maskTransform = maskSurfaceMatrix;
return surface.forget();
}

View File

@ -579,7 +579,7 @@ public:
mTargetCtx = gfxContext::CreateOrNull(targetDT);
MOZ_ASSERT(mTargetCtx); // already checked the draw target above
mTargetCtx->SetMatrix(mSourceCtx->CurrentMatrix() *
gfxMatrix::Translation(-drawRect.TopLeft()));
Matrix::Translation(-drawRect.TopLeft()));
mTargetOffset = drawRect.TopLeft();
@ -595,7 +595,7 @@ public:
RefPtr<SourceSurface> targetSurf = mTargetCtx->GetDrawTarget()->Snapshot();
gfxContextAutoSaveRestore save(mSourceCtx);
mSourceCtx->SetMatrix(gfxMatrix()); // This will be restored right after.
mSourceCtx->SetMatrix(Matrix()); // This will be restored right after.
RefPtr<gfxPattern> pattern =
new gfxPattern(targetSurf,
Matrix::Translation(mTargetOffset.x, mTargetOffset.y));
@ -854,8 +854,8 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
// have to adjust the scale.
gfxMatrix reverseScaleMatrix = nsSVGUtils::GetCSSPxToDevPxMatrix(aFrame);
DebugOnly<bool> invertible = reverseScaleMatrix.Invert();
target->SetMatrix(reverseScaleMatrix * aTransform *
target->CurrentMatrix());
target->SetMatrixDouble(reverseScaleMatrix * aTransform *
target->CurrentMatrixDouble());
SVGPaintCallback paintCallback;
nsFilterInstance::PaintFilteredFrame(aFrame, target, &paintCallback,
@ -1509,7 +1509,7 @@ nsSVGUtils::MakeFillPatternFor(nsIFrame* aFrame,
if (ps) {
RefPtr<gfxPattern> pattern =
ps->GetPaintServerPattern(aFrame, dt, aContext->CurrentMatrix(),
ps->GetPaintServerPattern(aFrame, dt, aContext->CurrentMatrixDouble(),
&nsStyleSVG::mFill, fillOpacity, aImgParams);
if (pattern) {
pattern->CacheColorStops(dt);
@ -1524,12 +1524,12 @@ nsSVGUtils::MakeFillPatternFor(nsIFrame* aFrame,
case eStyleSVGPaintType_ContextFill:
pattern =
aContextPaint->GetFillPattern(dt, fillOpacity,
aContext->CurrentMatrix(), aImgParams);
aContext->CurrentMatrixDouble(), aImgParams);
break;
case eStyleSVGPaintType_ContextStroke:
pattern =
aContextPaint->GetStrokePattern(dt, fillOpacity,
aContext->CurrentMatrix(), aImgParams);
aContext->CurrentMatrixDouble(), aImgParams);
break;
default:
;
@ -1585,7 +1585,7 @@ nsSVGUtils::MakeStrokePatternFor(nsIFrame* aFrame,
if (ps) {
RefPtr<gfxPattern> pattern =
ps->GetPaintServerPattern(aFrame, dt, aContext->CurrentMatrix(),
ps->GetPaintServerPattern(aFrame, dt, aContext->CurrentMatrixDouble(),
&nsStyleSVG::mStroke, strokeOpacity, aImgParams);
if (pattern) {
pattern->CacheColorStops(dt);
@ -1600,12 +1600,12 @@ nsSVGUtils::MakeStrokePatternFor(nsIFrame* aFrame,
case eStyleSVGPaintType_ContextFill:
pattern =
aContextPaint->GetFillPattern(dt, strokeOpacity,
aContext->CurrentMatrix(), aImgParams);
aContext->CurrentMatrixDouble(), aImgParams);
break;
case eStyleSVGPaintType_ContextStroke:
pattern =
aContextPaint->GetStrokePattern(dt, strokeOpacity,
aContext->CurrentMatrix(), aImgParams);
aContext->CurrentMatrixDouble(), aImgParams);
break;
default:
;

View File

@ -1172,11 +1172,11 @@ nsNativeThemeGTK::DrawWidgetBackground(gfxContext* aContext,
gfxContextAutoSaveRestore autoSR(ctx);
gfxMatrix matrix;
if (!snapped) { // else rects are in device coords
matrix = ctx->CurrentMatrix();
matrix = ctx->CurrentMatrixDouble();
}
matrix.Translate(origin);
matrix.Scale(scaleFactor, scaleFactor); // Draw in GDK coords
ctx->SetMatrix(matrix);
ctx->SetMatrixDouble(matrix);
// The gdk_clip is just advisory here, meaning "you don't
// need to draw outside this rect if you don't feel like it!"