From 3899e4e12e5572ffe225d2fd94af09ec1cefc3a2 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Fri, 26 Jan 2024 12:59:47 +0800 Subject: [PATCH] add round to avoid precision problem --- libs/scrap/src/quartz/display.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/scrap/src/quartz/display.rs b/libs/scrap/src/quartz/display.rs index 2bf2eb112..548e5d952 100644 --- a/libs/scrap/src/quartz/display.rs +++ b/libs/scrap/src/quartz/display.rs @@ -38,7 +38,7 @@ impl Display { let w = unsafe { CGDisplayPixelsWide(self.0) }; let s = self.scale(); if s > 1.0 { - ((w as f64) * s) as usize + ((w as f64) * s).round() as usize } else { w } @@ -48,7 +48,7 @@ impl Display { let h = unsafe { CGDisplayPixelsHigh(self.0) }; let s = self.scale(); if s > 1.0 { - ((h as f64) * s) as usize + ((h as f64) * s).round() as usize } else { h }