Bug 1756197. Avoid clipping if we're just going to fill the path. r=gfx-reviewers,nical

This avoids having to rasterize the path twice. Once for the clip path and once for
the fill. It will also give us correct antialiasing on the edges.

Differential Revision: https://phabricator.services.mozilla.com/D139137
This commit is contained in:
Jeff Muizelaar 2022-02-23 16:19:07 +00:00
parent e78ea43b78
commit adafdb308e
3 changed files with 6 additions and 5 deletions

View File

@ -14,7 +14,7 @@
== clip-path-polygon-010.html clip-path-stripes-001-ref.html
== clip-path-polygon-011.html clip-path-stripes-001-ref.html
== clip-path-polygon-012.html clip-path-stripes-001-ref.html
fuzzy(0-1,0-20) fails-if(!gtkWidget) == clip-path-polygon-013.html clip-path-stripes-003-ref.html
fuzzy(0-1,0-20) == clip-path-polygon-013.html clip-path-stripes-003-ref.html
fuzzy-if(!useDrawSnapshot,35-70,699-800) == clip-path-circle-001.html clip-path-circle-001-ref.html
fuzzy-if(!useDrawSnapshot,35-70,699-800) == clip-path-circle-002.html clip-path-circle-001-ref.html

View File

@ -758,16 +758,19 @@ bool SVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams,
MoveContextOriginToUserSpace(firstFrame, aParams);
basicShapeSR.SetContext(&ctx);
CSSClipPathInstance::ApplyBasicShapeOrPathClip(
ctx, frame, SVGUtils::GetCSSPxToDevPxMatrix(frame));
gfxMatrix mat = SVGUtils::GetCSSPxToDevPxMatrix(frame);
if (!maskUsage.shouldGenerateMaskLayer) {
// Only have basic-shape clip-path effect. Fill clipped region by
// opaque white.
ctx.SetDeviceColor(DeviceColor::MaskOpaqueWhite());
RefPtr<Path> path = CSSClipPathInstance::CreateClipPathForFrame(
ctx.GetDrawTarget(), frame, mat);
ctx.SetPath(path);
ctx.Fill();
return true;
}
CSSClipPathInstance::ApplyBasicShapeOrPathClip(ctx, frame, mat);
}
// Paint mask onto ctx.

View File

@ -1,2 +0,0 @@
[clip-path-geometryBox-2.html]
expected: FAIL