1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-10 12:29:01 +00:00

Merge pull request #246 from TomHarte/MainThreadBackingSize

Ensures self.bounds and -convertSizeToBacking: are called only on the main queue.
This commit is contained in:
Thomas Harte 2017-09-20 20:00:45 -04:00 committed by GitHub
commit 05a93ba237

View File

@ -15,6 +15,7 @@
@implementation CSOpenGLView {
CVDisplayLinkRef _displayLink;
CGSize _backingSize;
}
- (void)prepareOpenGL
@ -68,12 +69,17 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
- (CGSize)backingSize
{
return [self convertSizeToBacking:self.bounds.size];
@synchronized(self) {
return _backingSize;
}
}
- (void)reshape
{
[super reshape];
@synchronized(self) {
_backingSize = [self convertSizeToBacking:self.bounds.size];
}
[self performWithGLContext:^{
CGSize viewSize = [self backingSize];