1
0
Fork 0
forked from wry/wry

portal: implement window capture

This commit is contained in:
Julian Orth 2024-04-19 12:12:49 +02:00
parent f0600917ff
commit 4e10415e5c
27 changed files with 840 additions and 136 deletions

View file

@ -37,6 +37,17 @@ impl Scale {
pub fn to_wl(self) -> u32 {
self.0
}
pub fn pixel_size(self, width: i32, height: i32) -> (i32, i32) {
if self == Scale::default() {
return (width, height);
}
let scale = self.to_f64();
(
(width as f64 * scale).round() as i32,
(height as f64 * scale).round() as i32,
)
}
}
impl PartialEq<u32> for Scale {