From 656dc357f87849f2506ce402f8484a7d7484f250 Mon Sep 17 00:00:00 2001 From: nlevy Date: Thu, 8 Apr 2021 14:50:12 +0200 Subject: [PATCH 1/3] Attempt to fix scissor_rect validation error Update wgpu/src/backend.rs Cargo fmt --- wgpu/src/backend.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wgpu/src/backend.rs b/wgpu/src/backend.rs index 534c6cb7..6cd6d976 100644 --- a/wgpu/src/backend.rs +++ b/wgpu/src/backend.rs @@ -110,7 +110,16 @@ impl Backend { target_width: u32, target_height: u32, ) { - let bounds = (layer.bounds * scale_factor).snap(); + let target_bounds = iced_graphics::Rectangle::with_size( + iced_graphics::Size::new(target_width as f32, target_height as f32), + ); + let mut bounds_float = layer.bounds * scale_factor; + bounds_float.width = + bounds_float.width.min(target_width as f32 - bounds_float.x); + bounds_float.height = bounds_float + .height + .min(target_height as f32 - bounds_float.y); + let bounds = bounds_float.snap(); if !layer.quads.is_empty() { self.quad_pipeline.draw( From 5224cc7f26fc1549555c5bf3b25a1a80c9d26cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n?= Date: Wed, 9 Jun 2021 21:30:20 +0700 Subject: [PATCH 2/3] Floor `width` and `height` in `Rectangle::floor` --- core/src/rectangle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index 0a7f5fe2..4e082051 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -105,8 +105,8 @@ impl Rectangle { Rectangle { x: self.x as u32, y: self.y as u32, - width: self.width.ceil() as u32, - height: self.height.ceil() as u32, + width: self.width as u32, + height: self.height as u32, } } } From 56f673d819b241336f7cd041d990d47bdb2307b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n?= Date: Wed, 9 Jun 2021 21:30:48 +0700 Subject: [PATCH 3/3] Revert "Attempt to fix scissor_rect validation error" This reverts commit 656dc357f87849f2506ce402f8484a7d7484f250. --- wgpu/src/backend.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/wgpu/src/backend.rs b/wgpu/src/backend.rs index 6cd6d976..534c6cb7 100644 --- a/wgpu/src/backend.rs +++ b/wgpu/src/backend.rs @@ -110,16 +110,7 @@ impl Backend { target_width: u32, target_height: u32, ) { - let target_bounds = iced_graphics::Rectangle::with_size( - iced_graphics::Size::new(target_width as f32, target_height as f32), - ); - let mut bounds_float = layer.bounds * scale_factor; - bounds_float.width = - bounds_float.width.min(target_width as f32 - bounds_float.x); - bounds_float.height = bounds_float - .height - .min(target_height as f32 - bounds_float.y); - let bounds = bounds_float.snap(); + let bounds = (layer.bounds * scale_factor).snap(); if !layer.quads.is_empty() { self.quad_pipeline.draw(