mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 06:34:57 +00:00
LibGfx: Decrease flatness a little in Path::stroke_to_fill()
Noticed larger stroke widths were looking a little 'low poly', this looks a little nicer. (Minor LibWeb test changes)
This commit is contained in:
parent
58df9c45b9
commit
e9e1ee11d4
3 changed files with 9 additions and 5 deletions
Binary file not shown.
Before Width: | Height: | Size: 410 B After Width: | Height: | Size: 400 B |
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
@ -513,11 +513,15 @@ Path Path::stroke_to_fill(float thickness) const
|
|||
}
|
||||
}
|
||||
|
||||
// Note: This is the same as the tolerance from bezier curve splitting.
|
||||
constexpr auto flatness = 0.5f;
|
||||
auto pen_vertex_count = (thickness >= 2 * flatness) ? max(
|
||||
static_cast<int>(ceilf(AK::Pi<float> / acosf(1 - (2 * flatness) / thickness))), 4)
|
||||
: 4;
|
||||
constexpr auto flatness = 0.15f;
|
||||
auto pen_vertex_count = 4;
|
||||
if (thickness > flatness) {
|
||||
pen_vertex_count = max(
|
||||
static_cast<int>(ceilf(AK::Pi<float>
|
||||
/ acosf(1 - (2 * flatness) / thickness))),
|
||||
pen_vertex_count);
|
||||
}
|
||||
|
||||
if (pen_vertex_count % 2 == 1)
|
||||
pen_vertex_count += 1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue