Bug 1348430 - Part 1. (Main) Correct value pass to nsFilterInstance::PaintFilteredFrame in nsSVGUtil.
There are two places that use nsFilterInstance::PaintFilteredFrame. One is
nsSVGIntegrationUtil::PaintFilter, we do take care of it in
bug 1224207.
Another path is at nsSVGUtils::PaintFrameWithEffects, apparently I missed that
path while working on
bug 1224207.
MozReview-Commit-ID: K4MjKa4ZpCR
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -477,17 +477,19 @@ public:
gfxRect dirtyBounds = userToDeviceSpace.TransformBounds(
gfxRect(aDirtyRect->x, aDirtyRect->y, aDirtyRect->width, aDirtyRect->height));
dirtyBounds.RoundOut();
if (gfxUtils::GfxRectToIntRect(dirtyBounds, &tmpDirtyRect)) {
dirtyRect = &tmpDirtyRect;
}
}
- return svgFrame->PaintSVG(aContext, aTransform, dirtyRect);
+ return svgFrame->PaintSVG(aContext,
+ nsSVGUtils::GetCSSPxToDevPxMatrix(aTarget),
+ dirtyRect);
}
};
float
nsSVGUtils::ComputeOpacity(nsIFrame* aFrame, bool aHandleOpacity)
{
float opacity = aFrame->StyleEffects()->mOpacity;
@@ -853,16 +855,23 @@ nsSVGUtils::PaintFrameWithEffects(nsIFra
gfxRect(aDirtyRect->x, aDirtyRect->y,
aDirtyRect->width, aDirtyRect->height));
tmpDirtyRegion =
nsLayoutUtils::RoundGfxRectToAppRect(
dirtyBounds, aFrame->PresContext()->AppUnitsPerCSSPixel()) -
aFrame->GetPosition();
dirtyRegion = &tmpDirtyRegion;
}
+
+ gfxContextMatrixAutoSaveRestore saver(target);
+ gfxMatrix devPxToCssPxTM = nsSVGUtils::GetCSSPxToDevPxMatrix(aFrame);
+ DebugOnly<bool> invertible = devPxToCssPxTM.Invert();
+ MOZ_ASSERT(invertible);
+ target->SetMatrix(aTransform * devPxToCssPxTM);
+
SVGPaintCallback paintCallback;
result =
nsFilterInstance::PaintFilteredFrame(aFrame, target->GetDrawTarget(),
aTransform, &paintCallback,
dirtyRegion);
} else {
result = svgFrame->PaintSVG(*target, aTransform, aDirtyRect);
}