OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 | 8 |
9 #include "gl/SkNativeGLContext.h" | 9 #include "gl/SkNativeGLContext.h" |
10 #import <OpenGLES/EAGL.h> | 10 #import <OpenGLES/EAGL.h> |
(...skipping 24 matching lines...) Expand all Loading... |
35 this->destroyGLContext(); | 35 this->destroyGLContext(); |
36 } | 36 } |
37 | 37 |
38 void SkNativeGLContext::destroyGLContext() { | 38 void SkNativeGLContext::destroyGLContext() { |
39 if ([EAGLContext currentContext] == EAGLCTX) { | 39 if ([EAGLContext currentContext] == EAGLCTX) { |
40 [EAGLContext setCurrentContext:nil]; | 40 [EAGLContext setCurrentContext:nil]; |
41 } | 41 } |
42 [EAGLCTX release]; | 42 [EAGLCTX release]; |
43 } | 43 } |
44 | 44 |
45 const GrGLInterface* SkNativeGLContext::createGLContext() { | 45 const GrGLInterface* SkNativeGLContext::createGLContext(GrGLStandard forcedGpuAP
I) { |
| 46 if (kGL_GrGLStandard == forcedGpuAPI) { |
| 47 return NULL; |
| 48 } |
| 49 |
46 fEAGLContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; | 50 fEAGLContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; |
47 [EAGLContext setCurrentContext:EAGLCTX]; | 51 [EAGLContext setCurrentContext:EAGLCTX]; |
48 | 52 |
49 const GrGLInterface* interface = GrGLCreateNativeInterface(); | 53 const GrGLInterface* interface = GrGLCreateNativeInterface(); |
50 if (!interface) { | 54 if (!interface) { |
51 SkDebugf("Failed to create gl interface"); | 55 SkDebugf("Failed to create gl interface"); |
52 this->destroyGLContext(); | 56 this->destroyGLContext(); |
53 return NULL; | 57 return NULL; |
54 } | 58 } |
55 return interface; | 59 return interface; |
56 } | 60 } |
57 | 61 |
58 void SkNativeGLContext::makeCurrent() const { | 62 void SkNativeGLContext::makeCurrent() const { |
59 if (![EAGLContext setCurrentContext:EAGLCTX]) { | 63 if (![EAGLContext setCurrentContext:EAGLCTX]) { |
60 SkDebugf("Could not set the context.\n"); | 64 SkDebugf("Could not set the context.\n"); |
61 } | 65 } |
62 } | 66 } |
63 | 67 |
64 void SkNativeGLContext::swapBuffers() const { } | 68 void SkNativeGLContext::swapBuffers() const { } |
OLD | NEW |