| 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/angle/SkANGLEGLContext.h" | 9 #include "gl/angle/SkANGLEGLContext.h" |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 EGLint minorVersion; | 73 EGLint minorVersion; |
| 74 eglInitialize(fDisplay, &majorVersion, &minorVersion); | 74 eglInitialize(fDisplay, &majorVersion, &minorVersion); |
| 75 | 75 |
| 76 EGLConfig surfaceConfig; | 76 EGLConfig surfaceConfig; |
| 77 eglChooseConfig(fDisplay, configAttribs, &surfaceConfig, 1, &numConfigs); | 77 eglChooseConfig(fDisplay, configAttribs, &surfaceConfig, 1, &numConfigs); |
| 78 | 78 |
| 79 static const EGLint contextAttribs[] = { | 79 static const EGLint contextAttribs[] = { |
| 80 EGL_CONTEXT_CLIENT_VERSION, 2, | 80 EGL_CONTEXT_CLIENT_VERSION, 2, |
| 81 EGL_NONE | 81 EGL_NONE |
| 82 }; | 82 }; |
| 83 fContext = eglCreateContext(fDisplay, surfaceConfig, NULL, contextAttribs); | 83 fContext = eglCreateContext(fDisplay, surfaceConfig, nullptr, contextAttribs
); |
| 84 | 84 |
| 85 | 85 |
| 86 static const EGLint surfaceAttribs[] = { | 86 static const EGLint surfaceAttribs[] = { |
| 87 EGL_WIDTH, 1, | 87 EGL_WIDTH, 1, |
| 88 EGL_HEIGHT, 1, | 88 EGL_HEIGHT, 1, |
| 89 EGL_NONE | 89 EGL_NONE |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 fSurface = eglCreatePbufferSurface(fDisplay, surfaceConfig, surfaceAttribs); | 92 fSurface = eglCreatePbufferSurface(fDisplay, surfaceConfig, surfaceAttribs); |
| 93 | 93 |
| 94 eglMakeCurrent(fDisplay, fSurface, fSurface, fContext); | 94 eglMakeCurrent(fDisplay, fSurface, fSurface, fContext); |
| 95 | 95 |
| 96 SkAutoTUnref<const GrGLInterface> gl(GrGLCreateANGLEInterface()); | 96 SkAutoTUnref<const GrGLInterface> gl(GrGLCreateANGLEInterface()); |
| 97 if (NULL == gl.get()) { | 97 if (nullptr == gl.get()) { |
| 98 SkDebugf("Could not create ANGLE GL interface!\n"); | 98 SkDebugf("Could not create ANGLE GL interface!\n"); |
| 99 this->destroyGLContext(); | 99 this->destroyGLContext(); |
| 100 return; | 100 return; |
| 101 } | 101 } |
| 102 if (!gl->validate()) { | 102 if (!gl->validate()) { |
| 103 SkDebugf("Could not validate ANGLE GL interface!\n"); | 103 SkDebugf("Could not validate ANGLE GL interface!\n"); |
| 104 this->destroyGLContext(); | 104 this->destroyGLContext(); |
| 105 return; | 105 return; |
| 106 } | 106 } |
| 107 | 107 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 void SkANGLEGLContext::onPlatformSwapBuffers() const { | 141 void SkANGLEGLContext::onPlatformSwapBuffers() const { |
| 142 if (!eglSwapBuffers(fDisplay, fSurface)) { | 142 if (!eglSwapBuffers(fDisplay, fSurface)) { |
| 143 SkDebugf("Could not complete eglSwapBuffers.\n"); | 143 SkDebugf("Could not complete eglSwapBuffers.\n"); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 GrGLFuncPtr SkANGLEGLContext::onPlatformGetProcAddress(const char* name) const { | 147 GrGLFuncPtr SkANGLEGLContext::onPlatformGetProcAddress(const char* name) const { |
| 148 return eglGetProcAddress(name); | 148 return eglGetProcAddress(name); |
| 149 } | 149 } |
| OLD | NEW |