From 82ac4086fcc9b3d6f0b1c0b33aa1773916906ee0 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 11 May 2020 18:14:02 +0200 Subject: [PATCH] Improve debug painting of clip rects --- emigui/src/mesher.rs | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/emigui/src/mesher.rs b/emigui/src/mesher.rs index fe5d911d..1984997d 100644 --- a/emigui/src/mesher.rs +++ b/emigui/src/mesher.rs @@ -605,27 +605,28 @@ pub fn mesh_paint_commands( if batches.is_empty() || batches.last().unwrap().0 != clip_rect { batches.push((clip_rect, Mesh::default())); - - if options.debug_paint_clip_rects && !clip_rect.is_empty() { - let out_mesh = &mut batches.last_mut().unwrap().1; - mesh_command( - &mut reused_path, - options, - fonts, - PaintCmd::Rect { - rect: clip_rect, - corner_radius: 0.0, - fill_color: Some(srgba(50, 100, 200, 64)), - outline: Some(Outline::new(1.0, srgba(200, 200, 200, 255))), - }, - out_mesh, - ) - } } let out_mesh = &mut batches.last_mut().unwrap().1; mesh_command(&mut reused_path, options, fonts, cmd, out_mesh); } + if options.debug_paint_clip_rects { + for (clip_rect, mesh) in &mut batches { + mesh_command( + &mut reused_path, + options, + fonts, + PaintCmd::Rect { + rect: *clip_rect, + corner_radius: 0.0, + fill_color: None, + outline: Some(Outline::new(2.0, srgba(150, 255, 150, 255))), + }, + mesh, + ) + } + } + batches }