@@ -52,18 +52,18 @@ - (void)viewDidAppear
5252 [self resume ];
5353}
5454
55- - (void )windowWillClose:(NSNotification *)notification
55+ - (void )windowWillClose:(NSNotification *)notification
5656{
5757 NSLog (@" MGLKViewController windowWillClose:" );
5858 [self releaseTimer ];
5959}
6060
6161static CVReturn CVFrameDisplayCallback (CVDisplayLinkRef displayLink,
62- const CVTimeStamp* now,
63- const CVTimeStamp* outputTime,
62+ const CVTimeStamp * now,
63+ const CVTimeStamp * outputTime,
6464 CVOptionFlags flagsIn,
65- CVOptionFlags* flagsOut,
66- void * displayLinkContext)
65+ CVOptionFlags * flagsOut,
66+ void * displayLinkContext)
6767{
6868 // 'CVFrameDisplayCallback' is always called on a secondary thread. Merge the dispatch source
6969 // setup for the main queue so that rendering occurs on the main thread
@@ -119,10 +119,11 @@ - (void)resume
119119 // to execute rendering on the main thread.
120120 if (!_displaySource)
121121 {
122- _displaySource = dispatch_source_create (DISPATCH_SOURCE_TYPE_DATA_ADD, 0 , 0 , dispatch_get_main_queue ());
123- __weak MGLKViewController* weakSelf = self;
124- dispatch_source_set_event_handler (_displaySource, ^(){
125- [weakSelf frameStep ];
122+ _displaySource = dispatch_source_create (DISPATCH_SOURCE_TYPE_DATA_ADD, 0 , 0 ,
123+ dispatch_get_main_queue ());
124+ __weak MGLKViewController *weakSelf = self;
125+ dispatch_source_set_event_handler (_displaySource, ^() {
126+ [weakSelf frameStep ];
126127 });
127128 dispatch_resume (_displaySource);
128129
@@ -138,10 +139,12 @@ - (void)resume
138139 if (!_displayLink)
139140 {
140141 CVDisplayLinkCreateWithActiveCGDisplays (&_displayLink);
141- CVDisplayLinkSetOutputCallback (_displayLink, CVFrameDisplayCallback, (__bridge void *)_displaySource);
142+ CVDisplayLinkSetOutputCallback (_displayLink, CVFrameDisplayCallback,
143+ (__bridge void *)_displaySource);
142144 }
143- CGDirectDisplayID displayID = (CGDirectDisplayID) [window.screen.deviceDescription[@" NSScreenNumber" ]
144- unsignedIntegerValue ];
145+ CGDirectDisplayID displayID =
146+ (CGDirectDisplayID)[window.screen
147+ .deviceDescription[@" NSScreenNumber" ] unsignedIntegerValue ];
145148 CVDisplayLinkSetCurrentCGDisplay (_displayLink, displayID);
146149
147150 CVDisplayLinkStart (_displayLink);
@@ -152,7 +155,8 @@ - (void)resume
152155 _needDisableVsync = YES ;
153156
154157 ASSERT (!_displayTimer);
155- NSTimeInterval frameInterval = (_preferredFramesPerSecond <= 0 ) ? 0 : (1.0 / _preferredFramesPerSecond);
158+ NSTimeInterval frameInterval =
159+ (_preferredFramesPerSecond <= 0 ) ? 0 : (1.0 / _preferredFramesPerSecond);
156160 _displayTimer = [NSTimer scheduledTimerWithTimeInterval: frameInterval
157161 target: self
158162 selector: @selector (frameStep )
0 commit comments