mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb: Fix painting of paths with storke-width=0 in Skia painter
From SkPaint.h: "Sets the thickness of the pen used by the paint to outline the shape. A stroke-width of zero is treated as "hairline" width. Hairlines are always exactly one pixel wide in device space (their thickness does not change as the canvas is scaled)." While we expect stroke-width=0 to simply not be painted.
This commit is contained in:
parent
877adcc021
commit
bce7b24cfb
Notes:
sideshowbarker
2024-07-17 01:06:10 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/bce7b24cfb Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/329
1 changed files with 16 additions and 0 deletions
|
@ -698,6 +698,10 @@ CommandResult DisplayListPlayerSkia::fill_path_using_paint_style(FillPathUsingPa
|
|||
|
||||
CommandResult DisplayListPlayerSkia::stroke_path_using_color(StrokePathUsingColor const& command)
|
||||
{
|
||||
// Skia treats zero thickness as a special case and will draw a hairline, while we want to draw nothing.
|
||||
if (!command.thickness)
|
||||
return CommandResult::Continue;
|
||||
|
||||
auto& canvas = surface().canvas();
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
|
@ -712,6 +716,10 @@ CommandResult DisplayListPlayerSkia::stroke_path_using_color(StrokePathUsingColo
|
|||
|
||||
CommandResult DisplayListPlayerSkia::stroke_path_using_paint_style(StrokePathUsingPaintStyle const& command)
|
||||
{
|
||||
// Skia treats zero thickness as a special case and will draw a hairline, while we want to draw nothing.
|
||||
if (!command.thickness)
|
||||
return CommandResult::Continue;
|
||||
|
||||
auto path = to_skia_path(command.path);
|
||||
path.offset(command.aa_translation.x(), command.aa_translation.y());
|
||||
auto paint = paint_style_to_skia_paint(*command.paint_style, command.bounding_rect().to_type<float>());
|
||||
|
@ -725,6 +733,10 @@ CommandResult DisplayListPlayerSkia::stroke_path_using_paint_style(StrokePathUsi
|
|||
|
||||
CommandResult DisplayListPlayerSkia::draw_ellipse(DrawEllipse const& command)
|
||||
{
|
||||
// Skia treats zero thickness as a special case and will draw a hairline, while we want to draw nothing.
|
||||
if (!command.thickness)
|
||||
return CommandResult::Continue;
|
||||
|
||||
auto const& rect = command.rect;
|
||||
auto& canvas = surface().canvas();
|
||||
SkPaint paint;
|
||||
|
@ -749,6 +761,10 @@ CommandResult DisplayListPlayerSkia::fill_ellipse(FillEllipse const& command)
|
|||
|
||||
CommandResult DisplayListPlayerSkia::draw_line(DrawLine const& command)
|
||||
{
|
||||
// Skia treats zero thickness as a special case and will draw a hairline, while we want to draw nothing.
|
||||
if (!command.thickness)
|
||||
return CommandResult::Continue;
|
||||
|
||||
auto from = SkPoint::Make(command.from.x(), command.from.y());
|
||||
auto to = SkPoint::Make(command.to.x(), command.to.y());
|
||||
auto& canvas = surface().canvas();
|
||||
|
|
Loading…
Reference in a new issue