From 3a5ec4733f956f07a8977691edef60409aa60ed3 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sat, 19 Feb 2022 20:18:27 +0100 Subject: [PATCH] Fix bug when debug-painting clip rectangles --- epaint/src/tessellator.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/epaint/src/tessellator.rs b/epaint/src/tessellator.rs index 2db85348..ec16b3ad 100644 --- a/epaint/src/tessellator.rs +++ b/epaint/src/tessellator.rs @@ -1026,16 +1026,20 @@ pub fn tessellate_shapes( if options.debug_paint_clip_rects { for ClippedMesh(clip_rect, mesh) in &mut clipped_meshes { - tessellator.clip_rect = Rect::EVERYTHING; - tessellator.tessellate_shape( - tex_size, - Shape::rect_stroke( - *clip_rect, - 0.0, - Stroke::new(2.0, Color32::from_rgb(150, 255, 150)), - ), - mesh, - ); + if mesh.texture_id == TextureId::default() { + tessellator.clip_rect = Rect::EVERYTHING; + tessellator.tessellate_shape( + tex_size, + Shape::rect_stroke( + *clip_rect, + 0.0, + Stroke::new(2.0, Color32::from_rgb(150, 255, 150)), + ), + mesh, + ); + } else { + // TODO: create a new `ClippedMesh` just for the painted clip rectangle + } } }