summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar nlevy <nicolaspierrelevy@gmail.com>2021-04-08 14:50:12 +0200
committerLibravatar Héctor Ramón <hector0193@gmail.com>2021-06-09 21:30:00 +0700
commit656dc357f87849f2506ce402f8484a7d7484f250 (patch)
treed0e8ecd3bafffa8e0daf569c3a1e301393306a8d
parent0e70b11e00e4d8517419a5f09490c9502827d35b (diff)
downloadiced-656dc357f87849f2506ce402f8484a7d7484f250.tar.gz
iced-656dc357f87849f2506ce402f8484a7d7484f250.tar.bz2
iced-656dc357f87849f2506ce402f8484a7d7484f250.zip
Attempt to fix scissor_rect validation error
Update wgpu/src/backend.rs Cargo fmt
-rw-r--r--wgpu/src/backend.rs11
1 files changed, 10 insertions, 1 deletions
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(