Skip to content

Commit

Permalink
Bug 1756197. Avoid clipping if we're just going to fill the path. r=g…
Browse files Browse the repository at this point in the history
…fx-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
  • Loading branch information
jrmuizel committed Feb 18, 2022
1 parent f76e907 commit fe9ff9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 5 additions & 2 deletions layout/svg/SVGIntegrationUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

This file was deleted.

0 comments on commit fe9ff9b

Please sign in to comment.