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 | 9 |
10 SkNativeGLContext::AutoContextRestore::AutoContextRestore() { | 10 SkNativeGLContext::AutoContextRestore::AutoContextRestore() { |
(...skipping 18 matching lines...) Expand all Loading... |
29 if (NULL != fContext) { | 29 if (NULL != fContext) { |
30 CGLReleaseContext(fContext); | 30 CGLReleaseContext(fContext); |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 const GrGLInterface* SkNativeGLContext::createGLContext() { | 34 const GrGLInterface* SkNativeGLContext::createGLContext() { |
35 SkASSERT(NULL == fContext); | 35 SkASSERT(NULL == fContext); |
36 | 36 |
37 CGLPixelFormatAttribute attributes[] = { | 37 CGLPixelFormatAttribute attributes[] = { |
38 #if 0 | 38 #if 0 |
39 kCGLPFAOpenGLProfile, kCGLOGLPVersion_3_2_Core, | 39 kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core
, |
40 #endif | 40 #endif |
41 (CGLPixelFormatAttribute)0 | 41 (CGLPixelFormatAttribute)0 |
42 }; | 42 }; |
43 CGLPixelFormatObj pixFormat; | 43 CGLPixelFormatObj pixFormat; |
44 GLint npix; | 44 GLint npix; |
45 | 45 |
46 CGLChoosePixelFormat(attributes, &pixFormat, &npix); | 46 CGLChoosePixelFormat(attributes, &pixFormat, &npix); |
47 | 47 |
48 if (NULL == pixFormat) { | 48 if (NULL == pixFormat) { |
49 SkDebugf("CGLChoosePixelFormat failed."); | 49 SkDebugf("CGLChoosePixelFormat failed."); |
(...skipping 16 matching lines...) Expand all Loading... |
66 this->destroyGLContext(); | 66 this->destroyGLContext(); |
67 return NULL; | 67 return NULL; |
68 } | 68 } |
69 | 69 |
70 return interface; | 70 return interface; |
71 } | 71 } |
72 | 72 |
73 void SkNativeGLContext::makeCurrent() const { | 73 void SkNativeGLContext::makeCurrent() const { |
74 CGLSetCurrentContext(fContext); | 74 CGLSetCurrentContext(fContext); |
75 } | 75 } |
OLD | NEW |