mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 15:43:20 +00:00
LibWeb: Use shape-rendering
to control anti aliasing for SVG paths
Anti-aliasing is disabled if `shape-rendering` is set to `optimizeSpeed` or `crispEdges`.
This commit is contained in:
parent
1d745884be
commit
cfc6439c12
Notes:
github-actions[bot]
2025-08-19 08:48:50 +00:00
Author: https://github.com/tcl3
Commit: cfc6439c12
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5899
Reviewed-by: https://github.com/AtkinsSJ ✅
10 changed files with 43 additions and 4 deletions
|
@ -98,6 +98,7 @@ void SVGPathPaintable::paint(DisplayListRecordingContext& context, PaintPhase ph
|
|||
.path = closed_path(),
|
||||
.paint_style_or_color = Gfx::Color(Color::Black),
|
||||
.winding_rule = to_gfx_winding_rule(graphics_element.clip_rule().value_or(SVG::ClipRule::Nonzero)),
|
||||
.should_anti_alias = should_anti_alias(),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
@ -116,12 +117,14 @@ void SVGPathPaintable::paint(DisplayListRecordingContext& context, PaintPhase ph
|
|||
.opacity = fill_opacity,
|
||||
.paint_style_or_color = *paint_style,
|
||||
.winding_rule = winding_rule,
|
||||
.should_anti_alias = should_anti_alias(),
|
||||
});
|
||||
} else if (auto fill_color = graphics_element.fill_color(); fill_color.has_value()) {
|
||||
context.display_list_recorder().fill_path({
|
||||
.path = closed_path(),
|
||||
.paint_style_or_color = fill_color->with_opacity(fill_opacity),
|
||||
.winding_rule = winding_rule,
|
||||
.should_anti_alias = should_anti_alias(),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -177,6 +180,7 @@ void SVGPathPaintable::paint(DisplayListRecordingContext& context, PaintPhase ph
|
|||
.opacity = stroke_opacity,
|
||||
.paint_style_or_color = *paint_style,
|
||||
.thickness = stroke_thickness,
|
||||
.should_anti_alias = should_anti_alias(),
|
||||
});
|
||||
} else if (auto stroke_color = graphics_element.stroke_color(); stroke_color.has_value()) {
|
||||
context.display_list_recorder().stroke_path({
|
||||
|
@ -188,6 +192,7 @@ void SVGPathPaintable::paint(DisplayListRecordingContext& context, PaintPhase ph
|
|||
.path = path,
|
||||
.paint_style_or_color = stroke_color->with_opacity(stroke_opacity),
|
||||
.thickness = stroke_thickness,
|
||||
.should_anti_alias = should_anti_alias(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue