summaryrefslogtreecommitdiffstats
path: root/wgpu/src
diff options
context:
space:
mode:
Diffstat (limited to 'wgpu/src')
-rw-r--r--wgpu/src/quad.rs8
-rw-r--r--wgpu/src/renderer.rs3
2 files changed, 10 insertions, 1 deletions
diff --git a/wgpu/src/quad.rs b/wgpu/src/quad.rs
index adb294f0..6365e117 100644
--- a/wgpu/src/quad.rs
+++ b/wgpu/src/quad.rs
@@ -1,4 +1,5 @@
use crate::Transformation;
+use iced_native::Rectangle;
use std::mem;
@@ -165,6 +166,7 @@ impl Pipeline {
encoder: &mut wgpu::CommandEncoder,
instances: &[Quad],
transformation: Transformation,
+ bounds: Rectangle<u32>,
target: &wgpu::TextureView,
) {
let matrix: [f32; 16] = transformation.into();
@@ -227,6 +229,12 @@ impl Pipeline {
0,
&[(&self.vertices, 0), (&self.instances, 0)],
);
+ render_pass.set_scissor_rect(
+ bounds.x,
+ bounds.y,
+ bounds.width,
+ bounds.height,
+ );
render_pass.draw_indexed(
0..QUAD_INDICES.len() as u32,
diff --git a/wgpu/src/renderer.rs b/wgpu/src/renderer.rs
index 5bd7be8d..ba140a66 100644
--- a/wgpu/src/renderer.rs
+++ b/wgpu/src/renderer.rs
@@ -251,7 +251,7 @@ impl Renderer {
border_radius,
} => {
layer.quads.push(Quad {
- position: [bounds.x, bounds.y],
+ position: [bounds.x, bounds.y - layer.y_offset as f32],
scale: [bounds.width, bounds.height],
color: match background {
Background::Color(color) => color.into_linear(),
@@ -304,6 +304,7 @@ impl Renderer {
encoder,
&layer.quads,
transformation,
+ layer.bounds,
target,
);