skip rendering transparent rects

This commit is contained in:
griffi-gh 2024-05-04 17:23:39 +02:00
parent 2863bbdf8a
commit e7b2a8ff69
2 changed files with 6 additions and 0 deletions

View file

@ -25,6 +25,9 @@ impl Frame for ImageHandle {
impl Frame for FillColor { impl Frame for FillColor {
fn draw(&self, draw: &mut UiDrawCommandList, rect: Rect) { fn draw(&self, draw: &mut UiDrawCommandList, rect: Rect) {
if self.is_transparent() {
return
}
draw.add(UiDrawCommand::Rectangle { draw.add(UiDrawCommand::Rectangle {
position: rect.position, position: rect.position,
size: rect.size, size: rect.size,

View file

@ -116,6 +116,9 @@ impl Default for RectFrame {
impl Frame for RectFrame { impl Frame for RectFrame {
fn draw(&self, draw: &mut UiDrawCommandList, rect: Rect) { fn draw(&self, draw: &mut UiDrawCommandList, rect: Rect) {
if self.color.is_transparent() {
return
}
//TODO: handle bottom_right < top_left //TODO: handle bottom_right < top_left
let top_left = self.top_left.resolve(rect.size); let top_left = self.top_left.resolve(rect.size);
let bottom_right = self.bottom_right.resolve(rect.size); let bottom_right = self.bottom_right.resolve(rect.size);