Tesselator: ignore non-positive clip rectangles
Closes https://github.com/emilk/egui/issues/328
This commit is contained in:
parent
72d0d71d66
commit
0f1df90d90
2 changed files with 7 additions and 0 deletions
|
@ -304,16 +304,19 @@ impl Rect {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `min.x <= max.x && min.y <= max.y`.
|
/// `min.x <= max.x && min.y <= max.y`.
|
||||||
|
#[inline(always)]
|
||||||
pub fn is_non_negative(&self) -> bool {
|
pub fn is_non_negative(&self) -> bool {
|
||||||
self.min.x <= self.max.x && self.min.y <= self.max.y
|
self.min.x <= self.max.x && self.min.y <= self.max.y
|
||||||
}
|
}
|
||||||
|
|
||||||
/// True if all members are also finite.
|
/// True if all members are also finite.
|
||||||
|
#[inline(always)]
|
||||||
pub fn is_finite(&self) -> bool {
|
pub fn is_finite(&self) -> bool {
|
||||||
self.min.is_finite() && self.max.is_finite()
|
self.min.is_finite() && self.max.is_finite()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// True if any member is NaN.
|
/// True if any member is NaN.
|
||||||
|
#[inline(always)]
|
||||||
pub fn any_nan(self) -> bool {
|
pub fn any_nan(self) -> bool {
|
||||||
self.min.any_nan() || self.max.any_nan()
|
self.min.any_nan() || self.max.any_nan()
|
||||||
}
|
}
|
||||||
|
|
|
@ -742,6 +742,10 @@ pub fn tessellate_shapes(
|
||||||
let mut clipped_meshes: Vec<ClippedMesh> = Vec::default();
|
let mut clipped_meshes: Vec<ClippedMesh> = Vec::default();
|
||||||
|
|
||||||
for ClippedShape(clip_rect, shape) in shapes {
|
for ClippedShape(clip_rect, shape) in shapes {
|
||||||
|
if !clip_rect.is_non_negative() {
|
||||||
|
continue; // skip empty clip rectangles
|
||||||
|
}
|
||||||
|
|
||||||
let start_new_mesh = match clipped_meshes.last() {
|
let start_new_mesh = match clipped_meshes.last() {
|
||||||
None => true,
|
None => true,
|
||||||
Some(cm) => cm.0 != clip_rect || cm.1.texture_id != shape.texture_id(),
|
Some(cm) => cm.0 != clip_rect || cm.1.texture_id != shape.texture_id(),
|
||||||
|
|
Loading…
Reference in a new issue