| 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/SkGLContext.h" | 8 #include "gl/SkGLContext.h" |
| 9 | 9 |
| 10 #include <GLES2/gl2.h> | 10 #include <GLES2/gl2.h> |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 if (!eglSwapBuffers(fDisplay, fSurface)) { | 270 if (!eglSwapBuffers(fDisplay, fSurface)) { |
| 271 SkDebugf("Could not complete eglSwapBuffers.\n"); | 271 SkDebugf("Could not complete eglSwapBuffers.\n"); |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 | 274 |
| 275 GrGLFuncPtr EGLGLContext::onPlatformGetProcAddress(const char* procName) const { | 275 GrGLFuncPtr EGLGLContext::onPlatformGetProcAddress(const char* procName) const { |
| 276 return eglGetProcAddress(procName); | 276 return eglGetProcAddress(procName); |
| 277 } | 277 } |
| 278 | 278 |
| 279 static bool supports_egl_extension(EGLDisplay display, const char* extension) { | 279 static bool supports_egl_extension(EGLDisplay display, const char* extension) { |
| 280 int extensionLength = strlen(extension); | 280 size_t extensionLength = strlen(extension); |
| 281 const char* extensionsStr = eglQueryString(display, EGL_EXTENSIONS); | 281 const char* extensionsStr = eglQueryString(display, EGL_EXTENSIONS); |
| 282 while (const char* match = strstr(extensionsStr, extension)) { | 282 while (const char* match = strstr(extensionsStr, extension)) { |
| 283 // Ensure the string we found is its own extension, not a substring of a
larger extension | 283 // Ensure the string we found is its own extension, not a substring of a
larger extension |
| 284 // (e.g. GL_ARB_occlusion_query / GL_ARB_occlusion_query2). | 284 // (e.g. GL_ARB_occlusion_query / GL_ARB_occlusion_query2). |
| 285 if ((match == extensionsStr || match[-1] == ' ') && | 285 if ((match == extensionsStr || match[-1] == ' ') && |
| 286 (match[extensionLength] == ' ' || match[extensionLength] == '\0')) { | 286 (match[extensionLength] == ' ' || match[extensionLength] == '\0')) { |
| 287 return true; | 287 return true; |
| 288 } | 288 } |
| 289 extensionsStr = match + extensionLength; | 289 extensionsStr = match + extensionLength; |
| 290 } | 290 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 319 | 319 |
| 320 SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) { | 320 SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) { |
| 321 EGLGLContext* ctx = new EGLGLContext(forcedGpuAPI); | 321 EGLGLContext* ctx = new EGLGLContext(forcedGpuAPI); |
| 322 if (!ctx->isValid()) { | 322 if (!ctx->isValid()) { |
| 323 delete ctx; | 323 delete ctx; |
| 324 return nullptr; | 324 return nullptr; |
| 325 } | 325 } |
| 326 return ctx; | 326 return ctx; |
| 327 } | 327 } |
| 328 | 328 |
| OLD | NEW |