| 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/SkANGLEGLContext.h" | 9 #include "gl/SkANGLEGLContext.h" |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 if (fSurface) { | 45 if (fSurface) { |
| 46 eglDestroySurface(fDisplay, fSurface); | 46 eglDestroySurface(fDisplay, fSurface); |
| 47 fSurface = EGL_NO_SURFACE; | 47 fSurface = EGL_NO_SURFACE; |
| 48 } | 48 } |
| 49 | 49 |
| 50 //TODO should we close the display? | 50 //TODO should we close the display? |
| 51 fDisplay = EGL_NO_DISPLAY; | 51 fDisplay = EGL_NO_DISPLAY; |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 const GrGLInterface* SkANGLEGLContext::createGLContext(GrGLStandard forcedGpuAPI
) { | 55 const GrGLInterface* SkANGLEGLContext::createGLContext() { |
| 56 if (kGL_GrGLStandard == forcedGpuAPI) { | |
| 57 return NULL; | |
| 58 } | |
| 59 | 56 |
| 60 fDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); | 57 fDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); |
| 61 | 58 |
| 62 EGLint majorVersion; | 59 EGLint majorVersion; |
| 63 EGLint minorVersion; | 60 EGLint minorVersion; |
| 64 eglInitialize(fDisplay, &majorVersion, &minorVersion); | 61 eglInitialize(fDisplay, &majorVersion, &minorVersion); |
| 65 | 62 |
| 66 EGLint numConfigs; | 63 EGLint numConfigs; |
| 67 static const EGLint configAttribs[] = { | 64 static const EGLint configAttribs[] = { |
| 68 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, | 65 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { | 104 if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { |
| 108 SkDebugf("Could not set the context.\n"); | 105 SkDebugf("Could not set the context.\n"); |
| 109 } | 106 } |
| 110 } | 107 } |
| 111 | 108 |
| 112 void SkANGLEGLContext::swapBuffers() const { | 109 void SkANGLEGLContext::swapBuffers() const { |
| 113 if (!eglSwapBuffers(fDisplay, fSurface)) { | 110 if (!eglSwapBuffers(fDisplay, fSurface)) { |
| 114 SkDebugf("Could not complete eglSwapBuffers.\n"); | 111 SkDebugf("Could not complete eglSwapBuffers.\n"); |
| 115 } | 112 } |
| 116 } | 113 } |
| OLD | NEW |