Skip to content

Commit 44d1aba

Browse files
committed
CALayer: place buffer in top left instead of scaling to window
1 parent ba3b823 commit 44d1aba

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/cg.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use core_graphics::geometry::CGSize;
77
use core_graphics::image::CGImage;
88

99
use cocoa::base::id;
10-
use cocoa::quartzcore::CALayer;
10+
use cocoa::quartzcore::{CALayer, ContentsGravity};
1111
use foreign_types::ForeignType;
1212

1313
pub struct CGImpl {
@@ -18,6 +18,7 @@ impl CGImpl {
1818
pub unsafe fn new<W: HasRawWindowHandle>(handle: AppKitHandle) -> Result<Self, SoftBufferError<W>> {
1919
let view = handle.ns_view as id;
2020
let layer = CALayer::new();
21+
layer.set_contents_gravity(ContentsGravity::TopLeft);
2122
let _: () = msg_send![view, setLayer:layer.clone()];
2223
Ok(Self{layer})
2324
}

0 commit comments

Comments
 (0)