| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 void EGLGLContext::destroyEGLImage(GrEGLImage image) const { | 223 void EGLGLContext::destroyEGLImage(GrEGLImage image) const { |
| 224 GR_GL_CALL(this->gl(), EGLDestroyImage(fDisplay, image)); | 224 GR_GL_CALL(this->gl(), EGLDestroyImage(fDisplay, image)); |
| 225 } | 225 } |
| 226 | 226 |
| 227 GrGLuint EGLGLContext::eglImageToExternalTexture(GrEGLImage image) const { | 227 GrGLuint EGLGLContext::eglImageToExternalTexture(GrEGLImage image) const { |
| 228 GrGLClearErr(this->gl()); | 228 GrGLClearErr(this->gl()); |
| 229 if (!this->gl()->hasExtension("GL_OES_EGL_image_external")) { | 229 if (!this->gl()->hasExtension("GL_OES_EGL_image_external")) { |
| 230 return 0; | 230 return 0; |
| 231 } | 231 } |
| 232 GrGLEGLImageTargetTexture2DProc glEGLImageTargetTexture2D = | 232 typedef GrGLvoid (*EGLImageTargetTexture2DProc)(GrGLenum, GrGLeglImage); |
| 233 (GrGLEGLImageTargetTexture2DProc) eglGetProcAddress("glEGLImageTarge
tTexture2DOES"); | 233 |
| 234 EGLImageTargetTexture2DProc glEGLImageTargetTexture2D = |
| 235 (EGLImageTargetTexture2DProc) eglGetProcAddress("glEGLImageTargetTexture
2DOES"); |
| 234 if (!glEGLImageTargetTexture2D) { | 236 if (!glEGLImageTargetTexture2D) { |
| 235 return 0; | 237 return 0; |
| 236 } | 238 } |
| 237 GrGLuint texID; | 239 GrGLuint texID; |
| 238 glGenTextures(1, &texID); | 240 glGenTextures(1, &texID); |
| 239 if (!texID) { | 241 if (!texID) { |
| 240 return 0; | 242 return 0; |
| 241 } | 243 } |
| 242 glBindTexture(GR_GL_TEXTURE_EXTERNAL, texID); | 244 glBindTexture(GR_GL_TEXTURE_EXTERNAL, texID); |
| 243 if (glGetError() != GR_GL_NO_ERROR) { | 245 if (glGetError() != GR_GL_NO_ERROR) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 return nullptr; | 326 return nullptr; |
| 325 } | 327 } |
| 326 EGLGLContext* ctx = new EGLGLContext(forcedGpuAPI); | 328 EGLGLContext* ctx = new EGLGLContext(forcedGpuAPI); |
| 327 if (!ctx->isValid()) { | 329 if (!ctx->isValid()) { |
| 328 delete ctx; | 330 delete ctx; |
| 329 return nullptr; | 331 return nullptr; |
| 330 } | 332 } |
| 331 return ctx; | 333 return ctx; |
| 332 } | 334 } |
| 333 | 335 |
| OLD | NEW |