swrenderer: fix image drawing when the image is not stretched to the geometry

This would cause some of the image to be drawn outside of the clip
region, which may even lead to panics

(Fix changing pages in the energy-monitor demo)
This commit is contained in:
Olivier Goffart 2023-03-06 15:35:29 +01:00 committed by Olivier Goffart
parent 04eacbb526
commit 5a54fcfeb1

View file

@ -1013,6 +1013,7 @@ impl<'a, T: ProcessScene> SceneBuilder<'a, T> {
let renderer_clip_in_source_rect_space = (self.current_state.clip.cast()
* self.scale_factor)
.translate(-image_fit_offset)
.scale(1. / source_to_target_x, 1. / source_to_target_y);
match image_inner {
ImageInner::None => (),