mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:37:34 +00:00
LibWeb: Fix drawing axis-aligned lines
Previously, these were clipped by the RecordingPainter, which used the path's bounding box (which in this case is zero width or height). The fix is to expand the bounding box by the stroke width. Fixes #22661 Note: This is unrelated to any recent LibGfx changes :^)
This commit is contained in:
parent
fc41c282ec
commit
00b24a55b1
4 changed files with 24 additions and 0 deletions
|
@ -97,6 +97,8 @@ void RecordingPainter::stroke_path(StrokePathUsingColorParams params)
|
|||
{
|
||||
auto aa_translation = state().translation.map(params.translation.value_or(Gfx::FloatPoint {}));
|
||||
auto path_bounding_rect = params.path.bounding_box().translated(aa_translation).to_type<int>();
|
||||
// Increase path bounding box by `thickness` to account for stroke.
|
||||
path_bounding_rect.inflate(params.thickness, params.thickness);
|
||||
push_command(StrokePathUsingColor {
|
||||
.path_bounding_rect = path_bounding_rect,
|
||||
.path = params.path,
|
||||
|
@ -110,6 +112,8 @@ void RecordingPainter::stroke_path(StrokePathUsingPaintStyleParams params)
|
|||
{
|
||||
auto aa_translation = state().translation.map(params.translation.value_or(Gfx::FloatPoint {}));
|
||||
auto path_bounding_rect = params.path.bounding_box().translated(aa_translation).to_type<int>();
|
||||
// Increase path bounding box by `thickness` to account for stroke.
|
||||
path_bounding_rect.inflate(params.thickness, params.thickness);
|
||||
push_command(StrokePathUsingPaintStyle {
|
||||
.path_bounding_rect = path_bounding_rect,
|
||||
.path = params.path,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue