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
Notes:
sideshowbarker
2024-07-17 09:49:48 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/e9e1ee11d4 Pull-request: https://github.com/SerenityOS/serenity/pull/22875
3 changed files with 9 additions and 5 deletions
Tests/LibWeb/Ref/reference/images
Userland/Libraries/LibGfx
Binary file not shown.
Before ![]() (image error) Size: 410 B After ![]() (image error) Size: 400 B ![]() ![]() |
Binary file not shown.
Before ![]() (image error) Size: 18 KiB After ![]() (image error) 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
Reference in a new issue