File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ use std::sync::Arc;
16
16
17
17
pub struct CGImpl {
18
18
layer : CALayer ,
19
+ window : id ,
19
20
}
20
21
21
22
impl CGImpl {
@@ -27,14 +28,13 @@ impl CGImpl {
27
28
let subview: id = NSView :: alloc ( nil) . initWithFrame_ ( NSView :: frame ( view) ) ;
28
29
layer. set_contents_gravity ( ContentsGravity :: TopLeft ) ;
29
30
layer. set_needs_display_on_bounds_change ( false ) ;
30
- layer. set_contents_scale ( window. backingScaleFactor ( ) ) ;
31
31
subview. setLayer ( layer. id ( ) ) ;
32
32
subview. setAutoresizingMask_ ( NSViewWidthSizable | NSViewHeightSizable ) ;
33
33
34
34
view. addSubview_ ( subview) ; // retains subview (+1) = 2
35
35
let _: ( ) = msg_send ! [ subview, release] ; // releases subview (-1) = 1
36
36
}
37
- Ok ( Self { layer } )
37
+ Ok ( Self { layer, window } )
38
38
}
39
39
40
40
pub ( crate ) unsafe fn set_buffer ( & mut self , buffer : & [ u32 ] , width : u16 , height : u16 ) {
@@ -62,7 +62,11 @@ impl CGImpl {
62
62
transaction:: begin ( ) ;
63
63
transaction:: set_disable_actions ( true ) ;
64
64
65
- unsafe { self . layer . set_contents ( image. as_ptr ( ) as id ) } ;
65
+ unsafe {
66
+ self . layer
67
+ . set_contents_scale ( self . window . backingScaleFactor ( ) ) ;
68
+ self . layer . set_contents ( image. as_ptr ( ) as id ) ;
69
+ } ;
66
70
67
71
transaction:: commit ( ) ;
68
72
}
You can’t perform that action at this time.
0 commit comments