From fbc48512ef2c844c35a6511acfaa386b6dda8e42 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 13 Dec 2022 14:53:40 +0100 Subject: [PATCH] Modify the fruit example to show any logical vs. physical pixel mismatches Resize the window to the physical size of the image. If softbuffer scales the contents incorrectly, only parts of the fruit basket will be visible. --- examples/fruit.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/fruit.rs b/examples/fruit.rs index d0497d6..fabf979 100644 --- a/examples/fruit.rs +++ b/examples/fruit.rs @@ -16,7 +16,10 @@ fn main() { }).collect::>(); let event_loop = EventLoop::new(); - let window = WindowBuilder::new().build(&event_loop).unwrap(); + let window = WindowBuilder::new() + .with_inner_size(winit::dpi::PhysicalSize::new(fruit.width(), fruit.height())) + .build(&event_loop) + .unwrap(); #[cfg(target_arch = "wasm32")] {