OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #import "SkNSView.h" | 8 #import "SkNSView.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkSurface.h" | 10 #include "SkSurface.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 //it must NOT be deferred or should have been on screen at least once) | 379 //it must NOT be deferred or should have been on screen at least once) |
380 if ([fGLContext view] != self && nil != self.window) { | 380 if ([fGLContext view] != self && nil != self.window) { |
381 [fGLContext setView:self]; | 381 [fGLContext setView:self]; |
382 } | 382 } |
383 } | 383 } |
384 - (bool)attach:(SkOSWindow::SkBackEndTypes)attachType | 384 - (bool)attach:(SkOSWindow::SkBackEndTypes)attachType |
385 withMSAASampleCount:(int) sampleCount | 385 withMSAASampleCount:(int) sampleCount |
386 andGetInfo:(SkOSWindow::AttachmentInfo*) info { | 386 andGetInfo:(SkOSWindow::AttachmentInfo*) info { |
387 if (nil == fGLContext) { | 387 if (nil == fGLContext) { |
388 CGLContextObj ctx = createGLContext(sampleCount); | 388 CGLContextObj ctx = createGLContext(sampleCount); |
| 389 SkASSERT(ctx); |
389 fGLContext = [[NSOpenGLContext alloc] initWithCGLContextObj:ctx]; | 390 fGLContext = [[NSOpenGLContext alloc] initWithCGLContextObj:ctx]; |
390 CGLReleaseContext(ctx); | 391 CGLReleaseContext(ctx); |
391 if (NULL == fGLContext) { | 392 if (NULL == fGLContext) { |
392 return false; | 393 return false; |
393 } | 394 } |
394 [fGLContext setView:self]; | 395 [fGLContext setView:self]; |
395 } | 396 } |
396 | 397 |
397 [fGLContext makeCurrentContext]; | 398 [fGLContext makeCurrentContext]; |
398 CGLPixelFormatObj format = CGLGetPixelFormat((CGLContextObj)[fGLContext CGLC
ontextObj]); | 399 CGLPixelFormatObj format = CGLGetPixelFormat((CGLContextObj)[fGLContext CGLC
ontextObj]); |
(...skipping 14 matching lines...) Expand all Loading... |
413 [fGLContext release]; | 414 [fGLContext release]; |
414 fGLContext = nil; | 415 fGLContext = nil; |
415 } | 416 } |
416 | 417 |
417 - (void)present { | 418 - (void)present { |
418 if (nil != fGLContext) { | 419 if (nil != fGLContext) { |
419 [fGLContext flushBuffer]; | 420 [fGLContext flushBuffer]; |
420 } | 421 } |
421 } | 422 } |
422 @end | 423 @end |
OLD | NEW |