Skip to content

Commit 045ed41

Browse files
authored
Fix zero-width strokes still affecting the feathering color of boxes (#5485)
1 parent e802917 commit 045ed41

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

crates/epaint/src/stroke.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,15 @@ where
161161

162162
impl From<Stroke> for PathStroke {
163163
fn from(value: Stroke) -> Self {
164-
Self {
165-
width: value.width,
166-
color: ColorMode::Solid(value.color),
167-
kind: StrokeKind::default(),
164+
if value.is_empty() {
165+
// Important, since we use the stroke color when doing feathering of the fill!
166+
Self::NONE
167+
} else {
168+
Self {
169+
width: value.width,
170+
color: ColorMode::Solid(value.color),
171+
kind: StrokeKind::default(),
172+
}
168173
}
169174
}
170175
}

crates/epaint/src/tessellator.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,8 @@ impl Path {
502502
/// Calling this may reverse the vertices in the path if they are wrong winding order.
503503
///
504504
/// The preferred winding order is clockwise.
505+
///
506+
/// The stroke colors is used for color-correct feathering.
505507
pub fn fill(&mut self, feathering: f32, color: Color32, stroke: &PathStroke, out: &mut Mesh) {
506508
fill_closed_path(feathering, &mut self.0, color, stroke, out);
507509
}
@@ -918,7 +920,7 @@ fn stroke_path(
918920
) {
919921
let n = path.len() as u32;
920922

921-
if stroke.width <= 0.0 || stroke.color == ColorMode::TRANSPARENT || n < 2 {
923+
if stroke.is_empty() || n < 2 {
922924
return;
923925
}
924926

0 commit comments

Comments
 (0)