Skip to content

Commit d7a8c52

Browse files
committed
Round size before resizing on macOS
Otherwise the top row of pixels may contain flickering artifacts.
1 parent bc2b2bd commit d7a8c52

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/macos/window.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ impl Window {
320320
}
321321

322322
pub fn resize(&mut self, size: Size) {
323-
let size = NSSize::new(size.width, size.height);
323+
// NOTE: macOS gives you a personal rave if you pass in fractional pixels here. Even though
324+
// the size is in fractional pixels.
325+
let size = NSSize::new(size.width.round(), size.height.round());
324326

325327
unsafe { NSView::setFrameSize(self.ns_view, size) };
326328
unsafe {

0 commit comments

Comments
 (0)