1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 23:00:04 -04:00

[paint] ignore negatively sized rectangles and circles

This commit is contained in:
Emil Ernerfeldt
2020-06-07 15:24:03 +02:00
parent 53dbbd0d53
commit bff7232e9d

View File

@@ -573,6 +573,7 @@ pub fn paint_command_into_triangles(
outline,
radius,
} => {
if radius > 0.0 {
path.add_circle(center, radius);
if let Some(fill) = fill {
fill_closed_path(out, options, &path.0, fill);
@@ -581,6 +582,7 @@ pub fn paint_command_into_triangles(
paint_path_outline(out, options, Closed, &path.0, outline);
}
}
}
PaintCmd::Triangles(triangles) => {
out.append(&triangles);
}
@@ -614,8 +616,9 @@ pub fn paint_command_into_triangles(
outline,
mut rect,
} => {
// Common bug is to accidentally create an infinitely sized ractangle.
// Make sure we can visualize that:
if !rect.is_empty() {
// It is common to (sometimes accidentally) create an infinitely sized ractangle.
// Make sure we can handle that:
rect.min = rect.min.max(pos2(-1e7, -1e7));
rect.max = rect.max.min(pos2(1e7, 1e7));
@@ -627,6 +630,7 @@ pub fn paint_command_into_triangles(
paint_path_outline(out, options, Closed, &path.0, outline);
}
}
}
PaintCmd::Text {
pos,
galley,