OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "gl/SkNativeGLContext.h" | 8 #include "gl/SkNativeGLContext.h" |
9 #include "AvailabilityMacros.h" | 9 #include "AvailabilityMacros.h" |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 const GrGLInterface* SkNativeGLContext::createGLContext() { | 35 const GrGLInterface* SkNativeGLContext::createGLContext() { |
36 SkASSERT(NULL == fContext); | 36 SkASSERT(NULL == fContext); |
37 | 37 |
38 CGLPixelFormatAttribute attributes[] = { | 38 CGLPixelFormatAttribute attributes[] = { |
39 #if MAC_OS_X_VERSION_10_7 | 39 #if MAC_OS_X_VERSION_10_7 |
40 kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core
, | 40 kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core
, |
41 #endif | 41 #endif |
| 42 kCGLPFADoubleBuffer, |
42 (CGLPixelFormatAttribute)0 | 43 (CGLPixelFormatAttribute)0 |
43 }; | 44 }; |
44 CGLPixelFormatObj pixFormat; | 45 CGLPixelFormatObj pixFormat; |
45 GLint npix; | 46 GLint npix; |
46 | 47 |
47 CGLChoosePixelFormat(attributes, &pixFormat, &npix); | 48 CGLChoosePixelFormat(attributes, &pixFormat, &npix); |
48 | 49 |
49 if (NULL == pixFormat) { | 50 if (NULL == pixFormat) { |
50 SkDebugf("CGLChoosePixelFormat failed."); | 51 SkDebugf("CGLChoosePixelFormat failed."); |
51 return NULL; | 52 return NULL; |
(...skipping 15 matching lines...) Expand all Loading... |
67 this->destroyGLContext(); | 68 this->destroyGLContext(); |
68 return NULL; | 69 return NULL; |
69 } | 70 } |
70 | 71 |
71 return interface; | 72 return interface; |
72 } | 73 } |
73 | 74 |
74 void SkNativeGLContext::makeCurrent() const { | 75 void SkNativeGLContext::makeCurrent() const { |
75 CGLSetCurrentContext(fContext); | 76 CGLSetCurrentContext(fContext); |
76 } | 77 } |
| 78 |
| 79 void SkNativeGLContext::swapBuffers() const { |
| 80 CGLFlushDrawable(fContext); |
| 81 } |
OLD | NEW |