Fix: Mac retina display video blur (#6980)
* fix mac retina display blur Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com> * Update display.rs --------- Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com> Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
parent
a0d79dd26d
commit
1d755c705b
@ -35,11 +35,23 @@ impl Display {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn width(self) -> usize {
|
pub fn width(self) -> usize {
|
||||||
unsafe { CGDisplayPixelsWide(self.0) }
|
let w = unsafe { CGDisplayPixelsWide(self.0) };
|
||||||
|
let s = self.scale();
|
||||||
|
if s > 1.0 {
|
||||||
|
((w as f64) * s) as usize
|
||||||
|
} else {
|
||||||
|
w
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn height(self) -> usize {
|
pub fn height(self) -> usize {
|
||||||
unsafe { CGDisplayPixelsHigh(self.0) }
|
let h = unsafe { CGDisplayPixelsHigh(self.0) };
|
||||||
|
let s = self.scale();
|
||||||
|
if s > 1.0 {
|
||||||
|
((h as f64) * s) as usize
|
||||||
|
} else {
|
||||||
|
h
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_builtin(self) -> bool {
|
pub fn is_builtin(self) -> bool {
|
||||||
@ -58,6 +70,10 @@ impl Display {
|
|||||||
unsafe { CGDisplayIsOnline(self.0) != 0 }
|
unsafe { CGDisplayIsOnline(self.0) != 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn scale(self) -> f64 {
|
||||||
|
unsafe { BackingScaleFactor() } as _
|
||||||
|
}
|
||||||
|
|
||||||
pub fn bounds(self) -> CGRect {
|
pub fn bounds(self) -> CGRect {
|
||||||
unsafe { CGDisplayBounds(self.0) }
|
unsafe { CGDisplayBounds(self.0) }
|
||||||
}
|
}
|
||||||
|
@ -193,6 +193,7 @@ extern "C" {
|
|||||||
pub fn CGDisplayIsOnline(display: u32) -> i32;
|
pub fn CGDisplayIsOnline(display: u32) -> i32;
|
||||||
|
|
||||||
pub fn CGDisplayBounds(display: u32) -> CGRect;
|
pub fn CGDisplayBounds(display: u32) -> CGRect;
|
||||||
|
pub fn BackingScaleFactor() -> f32;
|
||||||
|
|
||||||
// IOSurface
|
// IOSurface
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user