From 26bd2b3578aa48dc7a396a25184f4f83d7798090 Mon Sep 17 00:00:00 2001 From: Yejia Date: Tue, 7 Jul 2026 02:12:43 +0800 Subject: [PATCH] Fix window-to-pixel coordinates when downscaling --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 6b02064..9a5c117 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -691,8 +691,8 @@ impl<'win> Pixels<'win> { ); let pos = self.scaling_matrix_inverse * pos; - let offset_width = pixels_width.min(physical_width) / 2.0; - let offset_height = pixels_height.min(physical_height) / 2.0; + let offset_width = pixels_width / 2.0; + let offset_height = pixels_height / 2.0; let pixel_x = (pos.x / pos.w + offset_width).floor() as isize; let pixel_y = (pos.y / pos.w + offset_height).floor() as isize;