diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-02-20 19:26:29 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-02-20 21:14:44 +0100 |
commit | 5ca979b1e283fdc25f014c62ea3c95232cac12e6 (patch) | |
tree | e7da687220abd67be86fba442c84ae3b72b94f82 /src/video/cocoa | |
parent | f3c192c63d77de641c84fd2d808e11418b9c15fd (diff) | |
download | openttd-5ca979b1e283fdc25f014c62ea3c95232cac12e6.tar.xz |
Fix: [OSX] Don't wait on the event loop for drawing.
Diffstat (limited to 'src/video/cocoa')
-rw-r--r-- | src/video/cocoa/cocoa_v.mm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm index c84fd1a98..b174a3e8c 100644 --- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -21,6 +21,7 @@ #define Rect OTTDRect #define Point OTTDPoint #import <Cocoa/Cocoa.h> +#import <QuartzCore/QuartzCore.h> #undef Rect #undef Point @@ -486,10 +487,12 @@ void VideoDriver_Cocoa::Paint() dirtyrect.size.width = this->dirty_rect.right - this->dirty_rect.left; dirtyrect.size.height = this->dirty_rect.bottom - this->dirty_rect.top; - /* Normally drawRect will be automatically called by Mac OS X during next update cycle, - * and then blitting will occur. */ + /* Notify OS X that we have new content to show. */ [ this->cocoaview setNeedsDisplayInRect:[ this->cocoaview getVirtualRect:dirtyrect ] ]; + /* Tell the OS to get our contents to screen as soon as possible. */ + [ CATransaction flush ]; + this->dirty_rect = {}; } @@ -674,6 +677,7 @@ void VideoDriver_Cocoa::GameLoop() self.wantsLayer = YES; self.layer.magnificationFilter = kCAFilterNearest; + self.layer.opaque = YES; } return self; } |