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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 EGL_NONE | 61 EGL_NONE |
62 }; | 62 }; |
63 | 63 |
64 // Try first for OpenGL, then fall back to OpenGL ES. | 64 // Try first for OpenGL, then fall back to OpenGL ES. |
65 EGLint renderableTypeBit = EGL_OPENGL_BIT; | 65 EGLint renderableTypeBit = EGL_OPENGL_BIT; |
66 const EGLint* contextAttribs = kEGLContextAttribsForOpenGL; | 66 const EGLint* contextAttribs = kEGLContextAttribsForOpenGL; |
67 EGLBoolean apiBound = eglBindAPI(EGL_OPENGL_API); | 67 EGLBoolean apiBound = eglBindAPI(EGL_OPENGL_API); |
68 | 68 |
69 if (!apiBound) { | 69 if (!apiBound) { |
70 apiBound = eglBindAPI(EGL_OPENGL_ES_API); | 70 apiBound = eglBindAPI(EGL_OPENGL_ES_API); |
71 renderableTypeBit = EGL_OPENGL_ES_BIT; | 71 renderableTypeBit = EGL_OPENGL_ES2_BIT; |
72 contextAttribs = kEGLContextAttribsForOpenGLES; | 72 contextAttribs = kEGLContextAttribsForOpenGLES; |
73 } | 73 } |
74 | 74 |
75 if (!apiBound) { | 75 if (!apiBound) { |
76 return NULL; | 76 return NULL; |
77 } | 77 } |
78 | 78 |
79 fDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); | 79 fDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); |
80 | 80 |
81 EGLint majorVersion; | 81 EGLint majorVersion; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 } | 132 } |
133 | 133 |
134 return interface; | 134 return interface; |
135 } | 135 } |
136 | 136 |
137 void SkNativeGLContext::makeCurrent() const { | 137 void SkNativeGLContext::makeCurrent() const { |
138 if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { | 138 if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { |
139 SkDebugf("Could not set the context.\n"); | 139 SkDebugf("Could not set the context.\n"); |
140 } | 140 } |
141 } | 141 } |
OLD | NEW |