Fix sharp corners for rectangles with StrokeKind != Inside (#5675)

Oops!
This commit is contained in:
Emil Ernerfeldt 2025-02-04 14:36:29 +01:00 committed by GitHub
parent b8051cc301
commit c90b97f4ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 40 additions and 16 deletions

View File

@ -93,6 +93,19 @@ impl TessellationTest {
)
.with_blur_width(5.0),
),
(
"Additive rectangle",
RectShape::new(
sized([24.0, 12.0]),
0.0,
egui::Color32::LIGHT_RED.additive().linear_multiply(0.025),
(
1.0,
egui::Color32::LIGHT_BLUE.additive().linear_multiply(0.1),
),
StrokeKind::Outside,
),
),
];
for (_name, shape) in &mut shapes {

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9c6ce16a8a8c34d882485da6bbe08039fb55f90636da8136f68b1bb9baf0effb
size 557610
oid sha256:c03f90098fb2b2ff846586cc608126580050303b48e7c918b135efcdc6d52686
size 554947

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a49c052578a46adb41bc02c6d7fdc264ed0ab8ae636cc8a11ac729fe1e48091b
size 791802
oid sha256:6ee96b64140d91e1b98cbf5dfef9ac5654050c48b3f9d36889f83a62c9ec985a
size 788322

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:989c55a83b8bc7cce4f459d8b835962377927a98f2bce085e92cba8438438ecd
size 943736
oid sha256:c82611e7b3ec5c7b82e552421aeef6ad5562d649339708ab6283e0c5af3589c6
size 939339

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:01ac61dc5bcecf6bf0d13c8399460b1afae652efe6fecc1d0e4b2f27d9f1c5a4
size 1046906
oid sha256:3b315e64464b060c4ef2b508bcb223663e0560871b82c9513fe232f92bd33609
size 1041890

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3348923ecbad34e385e3ed52ab9b7c88b5d4fc07de00620302d5b191d90a453f
size 1140236
oid sha256:1dc4d7c51eb301ab3e0679b0247c96997ffa30b763c7b203a91fff706264d929
size 1134943

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:179c17b0405c6e87bd3cafaa7272e3e6d6eefd462b4406cca2a7abfe8af6f2bd
size 1317569
oid sha256:92c0615b09916c9a70fc898fbbde2921363044a3bcfcf82410e1d3f6e466bb8a
size 1311678

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:70fd682bf6ba07b235cf2db643e9d050522aeb3e6ef28426c2b3d23c09920d22
size 46196

View File

@ -1885,19 +1885,27 @@ impl Tessellator {
let extra_cr_tweak = 0.4; // Otherwise is doesn't _feels_ enough.
if 0.0 < original_cr.nw {
if original_cr.nw == 0.0 {
corner_radius.nw = 0.0;
} else {
corner_radius.nw += extra_cr_tweak;
corner_radius.nw = corner_radius.nw.at_least(min_outside_cr);
}
if 0.0 < original_cr.ne {
if original_cr.ne == 0.0 {
corner_radius.ne = 0.0;
} else {
corner_radius.ne += extra_cr_tweak;
corner_radius.ne = corner_radius.ne.at_least(min_outside_cr);
}
if 0.0 < original_cr.sw {
if original_cr.sw == 0.0 {
corner_radius.sw = 0.0;
} else {
corner_radius.sw += extra_cr_tweak;
corner_radius.sw = corner_radius.sw.at_least(min_outside_cr);
}
if 0.0 < original_cr.se {
if original_cr.se == 0.0 {
corner_radius.se = 0.0;
} else {
corner_radius.se += extra_cr_tweak;
corner_radius.se = corner_radius.se.at_least(min_outside_cr);
}