diff options
author | 2019-10-27 02:29:23 +0100 | |
---|---|---|
committer | 2019-10-27 02:29:23 +0100 | |
commit | 0a0aa3edd9c5185551040c75a934f12d3bce7618 (patch) | |
tree | f158003fb4e4316a318453ddd53f2cd3357474e4 /wgpu/src/image.rs | |
parent | 63c10b67ab213c5971313743fde566bd5c0f0c15 (diff) | |
download | iced-0a0aa3edd9c5185551040c75a934f12d3bce7618.tar.gz iced-0a0aa3edd9c5185551040c75a934f12d3bce7618.tar.bz2 iced-0a0aa3edd9c5185551040c75a934f12d3bce7618.zip |
Implement clipping for images
Diffstat (limited to 'wgpu/src/image.rs')
-rw-r--r-- | wgpu/src/image.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/wgpu/src/image.rs b/wgpu/src/image.rs index c883eaa8..c42e1cd4 100644 --- a/wgpu/src/image.rs +++ b/wgpu/src/image.rs @@ -1,4 +1,5 @@ use crate::Transformation; +use iced_native::Rectangle; use std::cell::RefCell; use std::collections::HashMap; @@ -218,6 +219,7 @@ impl Pipeline { encoder: &mut wgpu::CommandEncoder, instances: &[Image], transformation: Transformation, + bounds: Rectangle<u32>, target: &wgpu::TextureView, ) { let matrix: [f32; 16] = transformation.into(); @@ -291,6 +293,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, |