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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
174 glEGLImageTargetTexture2D(GR_GL_TEXTURE_EXTERNAL, image); | 174 glEGLImageTargetTexture2D(GR_GL_TEXTURE_EXTERNAL, image); |
175 if (GR_GL_GET_ERROR(this->gl()) != GR_GL_NO_ERROR) { | 175 if (GR_GL_GET_ERROR(this->gl()) != GR_GL_NO_ERROR) { |
176 GR_GL_CALL(this->gl(), DeleteTextures(1, &texID)); | 176 GR_GL_CALL(this->gl(), DeleteTextures(1, &texID)); |
177 return 0; | 177 return 0; |
178 } | 178 } |
179 return texID; | 179 return texID; |
180 } | 180 } |
181 | 181 |
182 SkGLContext* SkANGLEGLContext::createNew() const { | 182 SkGLContext* SkANGLEGLContext::createNew() const { |
183 #ifdef SK_BUILD_FOR_WIN | 183 SkGLContext* ctx = SkANGLEGLContext::Create(this->gl()->fStandard, fIsGLBack
end); |
184 SkGLContext* ctx = fIsGLBackend ? SkANGLEGLContext::CreateOpenGL() | |
185 : SkANGLEGLContext::CreateDirectX(); | |
186 #else | |
187 SkGLContext* ctx = SkANGLEGLContext::CreateOpenGL(); | |
188 #endif | |
189 if (ctx) { | 184 if (ctx) { |
190 ctx->makeCurrent(); | 185 ctx->makeCurrent(); |
191 } | 186 } |
192 return ctx; | 187 return ctx; |
193 } | 188 } |
194 | 189 |
195 void SkANGLEGLContext::destroyGLContext() { | 190 void SkANGLEGLContext::destroyGLContext() { |
196 if (fDisplay) { | 191 if (fDisplay) { |
197 eglMakeCurrent(fDisplay, 0, 0, 0); | 192 eglMakeCurrent(fDisplay, 0, 0, 0); |
198 | 193 |
(...skipping 20 matching lines...) Expand all Loading... |
219 | 214 |
220 void SkANGLEGLContext::onPlatformSwapBuffers() const { | 215 void SkANGLEGLContext::onPlatformSwapBuffers() const { |
221 if (!eglSwapBuffers(fDisplay, fSurface)) { | 216 if (!eglSwapBuffers(fDisplay, fSurface)) { |
222 SkDebugf("Could not complete eglSwapBuffers.\n"); | 217 SkDebugf("Could not complete eglSwapBuffers.\n"); |
223 } | 218 } |
224 } | 219 } |
225 | 220 |
226 GrGLFuncPtr SkANGLEGLContext::onPlatformGetProcAddress(const char* name) const { | 221 GrGLFuncPtr SkANGLEGLContext::onPlatformGetProcAddress(const char* name) const { |
227 return eglGetProcAddress(name); | 222 return eglGetProcAddress(name); |
228 } | 223 } |
OLD | NEW |