From 2901ca5b824404e116eb91a731adf073e050ef4e Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Sat, 4 May 2024 17:23:39 +0200 Subject: [PATCH] skip rendering transparent rects --- hui/src/frame/impls.rs | 3 +++ hui/src/frame/rect.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/hui/src/frame/impls.rs b/hui/src/frame/impls.rs index 7a0c41a..fc0d0e7 100644 --- a/hui/src/frame/impls.rs +++ b/hui/src/frame/impls.rs @@ -25,6 +25,9 @@ impl Frame for ImageHandle { impl Frame for FillColor { fn draw(&self, draw: &mut UiDrawCommandList, rect: Rect) { + if self.is_transparent() { + return + } draw.add(UiDrawCommand::Rectangle { position: rect.position, size: rect.size, diff --git a/hui/src/frame/rect.rs b/hui/src/frame/rect.rs index 1170360..d6e5d5e 100644 --- a/hui/src/frame/rect.rs +++ b/hui/src/frame/rect.rs @@ -116,6 +116,9 @@ impl Default for RectFrame { impl Frame for RectFrame { fn draw(&self, draw: &mut UiDrawCommandList, rect: Rect) { + if self.color.is_transparent() { + return + } //TODO: handle bottom_right < top_left let top_left = self.top_left.resolve(rect.size); let bottom_right = self.bottom_right.resolve(rect.size);