[paint] ignore negatively sized rectangles and circles
This commit is contained in:
parent
53dbbd0d53
commit
bff7232e9d
1 changed files with 20 additions and 16 deletions
|
@ -573,12 +573,14 @@ pub fn paint_command_into_triangles(
|
||||||
outline,
|
outline,
|
||||||
radius,
|
radius,
|
||||||
} => {
|
} => {
|
||||||
path.add_circle(center, radius);
|
if radius > 0.0 {
|
||||||
if let Some(fill) = fill {
|
path.add_circle(center, radius);
|
||||||
fill_closed_path(out, options, &path.0, fill);
|
if let Some(fill) = fill {
|
||||||
}
|
fill_closed_path(out, options, &path.0, fill);
|
||||||
if let Some(outline) = outline {
|
}
|
||||||
paint_path_outline(out, options, Closed, &path.0, outline);
|
if let Some(outline) = outline {
|
||||||
|
paint_path_outline(out, options, Closed, &path.0, outline);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PaintCmd::Triangles(triangles) => {
|
PaintCmd::Triangles(triangles) => {
|
||||||
|
@ -614,17 +616,19 @@ pub fn paint_command_into_triangles(
|
||||||
outline,
|
outline,
|
||||||
mut rect,
|
mut rect,
|
||||||
} => {
|
} => {
|
||||||
// Common bug is to accidentally create an infinitely sized ractangle.
|
if !rect.is_empty() {
|
||||||
// Make sure we can visualize that:
|
// It is common to (sometimes accidentally) create an infinitely sized ractangle.
|
||||||
rect.min = rect.min.max(pos2(-1e7, -1e7));
|
// Make sure we can handle that:
|
||||||
rect.max = rect.max.min(pos2(1e7, 1e7));
|
rect.min = rect.min.max(pos2(-1e7, -1e7));
|
||||||
|
rect.max = rect.max.min(pos2(1e7, 1e7));
|
||||||
|
|
||||||
path.add_rounded_rectangle(rect, corner_radius);
|
path.add_rounded_rectangle(rect, corner_radius);
|
||||||
if let Some(fill) = fill {
|
if let Some(fill) = fill {
|
||||||
fill_closed_path(out, options, &path.0, fill);
|
fill_closed_path(out, options, &path.0, fill);
|
||||||
}
|
}
|
||||||
if let Some(outline) = outline {
|
if let Some(outline) = outline {
|
||||||
paint_path_outline(out, options, Closed, &path.0, outline);
|
paint_path_outline(out, options, Closed, &path.0, outline);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PaintCmd::Text {
|
PaintCmd::Text {
|
||||||
|
|
Loading…
Reference in a new issue