| 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 14 matching lines...) Expand all Loading... |
| 25 SkNativeGLContext::~SkNativeGLContext() { | 25 SkNativeGLContext::~SkNativeGLContext() { |
| 26 this->destroyGLContext(); | 26 this->destroyGLContext(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void SkNativeGLContext::destroyGLContext() { | 29 void SkNativeGLContext::destroyGLContext() { |
| 30 if (NULL != fContext) { | 30 if (NULL != fContext) { |
| 31 CGLReleaseContext(fContext); | 31 CGLReleaseContext(fContext); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 const GrGLInterface* SkNativeGLContext::createGLContext() { | 35 const GrGLInterface* SkNativeGLContext::createGLContext(GrGLStandard forcedStand
ard) { |
| 36 SkASSERT(NULL == fContext); | 36 SkASSERT(NULL == fContext); |
| 37 if (kGLES_GrGLStandard == forcedStandard) { |
| 38 return NULL; |
| 39 } |
| 37 | 40 |
| 38 CGLPixelFormatAttribute attributes[] = { | 41 CGLPixelFormatAttribute attributes[] = { |
| 39 #if MAC_OS_X_VERSION_10_7 | 42 #if MAC_OS_X_VERSION_10_7 |
| 40 kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core
, | 43 kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core
, |
| 41 #endif | 44 #endif |
| 42 kCGLPFADoubleBuffer, | 45 kCGLPFADoubleBuffer, |
| 43 (CGLPixelFormatAttribute)0 | 46 (CGLPixelFormatAttribute)0 |
| 44 }; | 47 }; |
| 45 CGLPixelFormatObj pixFormat; | 48 CGLPixelFormatObj pixFormat; |
| 46 GLint npix; | 49 GLint npix; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 72 return interface; | 75 return interface; |
| 73 } | 76 } |
| 74 | 77 |
| 75 void SkNativeGLContext::makeCurrent() const { | 78 void SkNativeGLContext::makeCurrent() const { |
| 76 CGLSetCurrentContext(fContext); | 79 CGLSetCurrentContext(fContext); |
| 77 } | 80 } |
| 78 | 81 |
| 79 void SkNativeGLContext::swapBuffers() const { | 82 void SkNativeGLContext::swapBuffers() const { |
| 80 CGLFlushDrawable(fContext); | 83 CGLFlushDrawable(fContext); |
| 81 } | 84 } |
| OLD | NEW |