| 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 |
| 11 #include <EGL/egl.h> |
| 12 |
| 11 #define EGL_PLATFORM_ANGLE_ANGLE 0x3201 | 13 #define EGL_PLATFORM_ANGLE_ANGLE 0x3201 |
| 12 #define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202 | 14 #define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202 |
| 13 #define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3206 | 15 #define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3206 |
| 14 #define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3207 | 16 #define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3207 |
| 15 | 17 |
| 16 EGLDisplay SkANGLEGLContext::GetD3DEGLDisplay(EGLNativeDisplayType nativeDisplay
) { | 18 void* SkANGLEGLContext::GetD3DEGLDisplay(void* nativeDisplay) { |
| 17 | 19 |
| 18 typedef EGLDisplay (*EGLGetPlatformDisplayEXT)(EGLenum platform, | 20 typedef EGLDisplay (*EGLGetPlatformDisplayEXT)(EGLenum platform, |
| 19 void *native_display, | 21 void *native_display, |
| 20 const EGLint *attrib_list); | 22 const EGLint *attrib_list); |
| 21 EGLGetPlatformDisplayEXT eglGetPlatformDisplayEXT; | 23 EGLGetPlatformDisplayEXT eglGetPlatformDisplayEXT; |
| 22 eglGetPlatformDisplayEXT = | 24 eglGetPlatformDisplayEXT = |
| 23 (EGLGetPlatformDisplayEXT) eglGetProcAddress("eglGetPlatformDisplayEXT")
; | 25 (EGLGetPlatformDisplayEXT) eglGetProcAddress("eglGetPlatformDisplayEXT")
; |
| 24 | 26 |
| 25 if (!eglGetPlatformDisplayEXT) { | 27 if (!eglGetPlatformDisplayEXT) { |
| 26 return eglGetDisplay(nativeDisplay); | 28 return eglGetDisplay(static_cast<EGLNativeDisplayType>(nativeDisplay)); |
| 27 } | 29 } |
| 28 | 30 |
| 29 // Try for an ANGLE D3D11 context, fall back to D3D9. | 31 // Try for an ANGLE D3D11 context, fall back to D3D9. |
| 30 EGLint attribs[2][3] = { | 32 EGLint attribs[2][3] = { |
| 31 { | 33 { |
| 32 EGL_PLATFORM_ANGLE_TYPE_ANGLE, | 34 EGL_PLATFORM_ANGLE_TYPE_ANGLE, |
| 33 EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, | 35 EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, |
| 34 EGL_NONE | 36 EGL_NONE |
| 35 }, | 37 }, |
| 36 { | 38 { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { | 137 if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { |
| 136 SkDebugf("Could not set the context.\n"); | 138 SkDebugf("Could not set the context.\n"); |
| 137 } | 139 } |
| 138 } | 140 } |
| 139 | 141 |
| 140 void SkANGLEGLContext::swapBuffers() const { | 142 void SkANGLEGLContext::swapBuffers() const { |
| 141 if (!eglSwapBuffers(fDisplay, fSurface)) { | 143 if (!eglSwapBuffers(fDisplay, fSurface)) { |
| 142 SkDebugf("Could not complete eglSwapBuffers.\n"); | 144 SkDebugf("Could not complete eglSwapBuffers.\n"); |
| 143 } | 145 } |
| 144 } | 146 } |
| OLD | NEW |