fix: scissor layout bounds for images
This commit is contained in:
parent
b4aedceac6
commit
751ffb5900
2 changed files with 12 additions and 1 deletions
|
|
@ -129,7 +129,7 @@ impl Backend {
|
||||||
* Transformation::scale(scale_factor, scale_factor);
|
* Transformation::scale(scale_factor, scale_factor);
|
||||||
|
|
||||||
self.image_pipeline
|
self.image_pipeline
|
||||||
.draw(gl, scaled, scale_factor, &layer.images);
|
.draw(gl, scaled, scale_factor, &layer.images, bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !layer.text.is_empty() {
|
if !layer.text.is_empty() {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ use iced_graphics::image::raster;
|
||||||
use iced_graphics::image::vector;
|
use iced_graphics::image::vector;
|
||||||
|
|
||||||
use iced_graphics::layer;
|
use iced_graphics::layer;
|
||||||
|
use iced_graphics::Rectangle;
|
||||||
use iced_graphics::Size;
|
use iced_graphics::Size;
|
||||||
|
|
||||||
use glow::HasContext;
|
use glow::HasContext;
|
||||||
|
|
@ -144,11 +145,13 @@ impl Pipeline {
|
||||||
transformation: Transformation,
|
transformation: Transformation,
|
||||||
_scale_factor: f32,
|
_scale_factor: f32,
|
||||||
images: &[layer::Image],
|
images: &[layer::Image],
|
||||||
|
layer_bounds: Rectangle<u32>,
|
||||||
) {
|
) {
|
||||||
unsafe {
|
unsafe {
|
||||||
gl.use_program(Some(self.program));
|
gl.use_program(Some(self.program));
|
||||||
gl.bind_vertex_array(Some(self.vertex_array));
|
gl.bind_vertex_array(Some(self.vertex_array));
|
||||||
gl.bind_buffer(glow::ARRAY_BUFFER, Some(self.vertex_buffer));
|
gl.bind_buffer(glow::ARRAY_BUFFER, Some(self.vertex_buffer));
|
||||||
|
gl.enable(glow::SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "image")]
|
#[cfg(feature = "image")]
|
||||||
|
|
@ -187,6 +190,13 @@ impl Pipeline {
|
||||||
};
|
};
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
gl.scissor(
|
||||||
|
layer_bounds.x as i32,
|
||||||
|
layer_bounds.y as i32,
|
||||||
|
layer_bounds.width as i32,
|
||||||
|
layer_bounds.height as i32,
|
||||||
|
);
|
||||||
|
|
||||||
if let Some(storage::Entry { texture, .. }) = entry {
|
if let Some(storage::Entry { texture, .. }) = entry {
|
||||||
gl.bind_texture(glow::TEXTURE_2D, Some(*texture))
|
gl.bind_texture(glow::TEXTURE_2D, Some(*texture))
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -213,6 +223,7 @@ impl Pipeline {
|
||||||
gl.bind_buffer(glow::ARRAY_BUFFER, None);
|
gl.bind_buffer(glow::ARRAY_BUFFER, None);
|
||||||
gl.bind_vertex_array(None);
|
gl.bind_vertex_array(None);
|
||||||
gl.use_program(None);
|
gl.use_program(None);
|
||||||
|
gl.disable(glow::SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue