Draw a centred image background at its pixel size

An image background not fitted to the screen keeps its own pixel size
(times its scale), centred on the viewport and moved by its offset, as
the reference draws it; tiling repeats it from there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-10-12 12:04:52 +03:00
1 parent bd4029fb50
commit 7a0e08129f
2 files changed
+10 -4

No files matched your search

+4 -2
View File
@@ -3009,11 +3009,13 @@ impl Scene {
background.use_tiling as u8 as f32,
image.width as f32 / image.height.max(1) as f32,
];
// Offset, then the image's size in pixels at its scale:
// an image not fitted to the screen keeps its pixel size.
result.image_transform = [
background.offset.x as f32,
background.offset.y as f32,
background.scale.x as f32,
background.scale.y as f32,
background.scale.x as f32 * image.width as f32,
background.scale.y as f32 * image.height as f32,
];
result.params[0] = 4.0;
result.image = Some(image);