summaryrefslogtreecommitdiffstats
path: root/wgpu/src/quad.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-27 03:10:49 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-27 03:10:49 +0100
commit21eb2f692c687a675c54ae5e951556e28e7435eb (patch)
treebc11342e8f0a3efeeb4f84d455891feb75790eb8 /wgpu/src/quad.rs
parente21890168f3db64fb6bb9aa5e1de974f5fad1c68 (diff)
downloadiced-21eb2f692c687a675c54ae5e951556e28e7435eb.tar.gz
iced-21eb2f692c687a675c54ae5e951556e28e7435eb.tar.bz2
iced-21eb2f692c687a675c54ae5e951556e28e7435eb.zip
Implement clipping for quads
Diffstat (limited to 'wgpu/src/quad.rs')
-rw-r--r--wgpu/src/quad.rs8
1 files changed, 8 insertions, 0 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,