Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

linux: Fix blurry rendering on Wayland when using fractional scaling (#33087)

Smit Barmase7812985d3c42
diff --git a/crates/gpui/src/geometry.rs b/crates/gpui/src/geometry.rs
index a0b46567c2e..30283c8dded 100644
--- a/crates/gpui/src/geometry.rs
+++ b/crates/gpui/src/geometry.rs
@@ -1590,11 +1590,11 @@ impl Size<DevicePixels> {
}
impl Size<Pixels> {
- /// Converts the size from physical to logical pixels.
+ /// Converts the size from logical to physical pixels.
pub(crate) fn to_device_pixels(self, scale_factor: f32) -> Size<DevicePixels> {
size(
- DevicePixels((self.width.0 * scale_factor) as i32),
- DevicePixels((self.height.0 * scale_factor) as i32),
+ DevicePixels((self.width.0 * scale_factor).round() as i32),
+ DevicePixels((self.height.0 * scale_factor).round() as i32),
)
}
}
@@ -1641,8 +1641,8 @@ impl Bounds<Pixels> {
pub fn to_device_pixels(&self, factor: f32) -> Bounds<DevicePixels> {
Bounds {
origin: point(
- DevicePixels((self.origin.x.0 * factor) as i32),
- DevicePixels((self.origin.y.0 * factor) as i32),
+ DevicePixels((self.origin.x.0 * factor).round() as i32),
+ DevicePixels((self.origin.y.0 * factor).round() as i32),
),
size: self.size.to_device_pixels(factor),
}