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 "SkTypes.h" | 8 #include "SkTypes.h" |
9 | 9 |
10 #if defined(SK_BUILD_FOR_WIN) | 10 #if defined(SK_BUILD_FOR_WIN) |
11 | 11 |
12 #include <GL/gl.h> | 12 #include <GL/gl.h> |
13 #include <WindowsX.h> | 13 #include <WindowsX.h> |
14 #include "win/SkWGL.h" | 14 #include "win/SkWGL.h" |
15 #include "SkWindow.h" | 15 #include "SkWindow.h" |
16 #include "SkCanvas.h" | 16 #include "SkCanvas.h" |
17 #include "SkOSMenu.h" | 17 #include "SkOSMenu.h" |
18 #include "SkTime.h" | 18 #include "SkTime.h" |
19 #include "SkUtils.h" | 19 #include "SkUtils.h" |
20 | 20 |
21 #include "SkGraphics.h" | 21 #include "SkGraphics.h" |
22 | 22 |
23 #if SK_ANGLE | 23 #if SK_ANGLE |
| 24 #include "gl/angle/SkANGLEGLContext.h" |
24 #include "gl/GrGLInterface.h" | 25 #include "gl/GrGLInterface.h" |
25 | |
26 #include "GLES2/gl2.h" | 26 #include "GLES2/gl2.h" |
27 | 27 |
28 #define ANGLE_GL_CALL(IFACE, X) \ | 28 #define ANGLE_GL_CALL(IFACE, X) \ |
29 do { \ | 29 do { \ |
30 (IFACE)->fFunctions.f##X; \ | 30 (IFACE)->fFunctions.f##X; \ |
31 } while (false) | 31 } while (false) |
32 | 32 |
33 #endif | 33 #endif |
34 | 34 |
35 #define INVALIDATE_DELAY_MS 200 | 35 #define INVALIDATE_DELAY_MS 200 |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 } | 377 } |
378 | 378 |
379 void SkOSWindow::presentGL() { | 379 void SkOSWindow::presentGL() { |
380 glFlush(); | 380 glFlush(); |
381 HDC dc = GetDC((HWND)fHWND); | 381 HDC dc = GetDC((HWND)fHWND); |
382 SwapBuffers(dc); | 382 SwapBuffers(dc); |
383 ReleaseDC((HWND)fHWND, dc); | 383 ReleaseDC((HWND)fHWND, dc); |
384 } | 384 } |
385 | 385 |
386 #if SK_ANGLE | 386 #if SK_ANGLE |
| 387 |
387 bool create_ANGLE(EGLNativeWindowType hWnd, | 388 bool create_ANGLE(EGLNativeWindowType hWnd, |
388 int msaaSampleCount, | 389 int msaaSampleCount, |
389 EGLDisplay* eglDisplay, | 390 EGLDisplay* eglDisplay, |
390 EGLContext* eglContext, | 391 EGLContext* eglContext, |
391 EGLSurface* eglSurface, | 392 EGLSurface* eglSurface, |
392 EGLConfig* eglConfig) { | 393 EGLConfig* eglConfig) { |
393 static const EGLint contextAttribs[] = { | 394 static const EGLint contextAttribs[] = { |
394 EGL_CONTEXT_CLIENT_VERSION, 2, | 395 EGL_CONTEXT_CLIENT_VERSION, 2, |
395 EGL_NONE, EGL_NONE | 396 EGL_NONE, EGL_NONE |
396 }; | 397 }; |
397 static const EGLint configAttribList[] = { | 398 static const EGLint configAttribList[] = { |
398 EGL_RED_SIZE, 8, | 399 EGL_RED_SIZE, 8, |
399 EGL_GREEN_SIZE, 8, | 400 EGL_GREEN_SIZE, 8, |
400 EGL_BLUE_SIZE, 8, | 401 EGL_BLUE_SIZE, 8, |
401 EGL_ALPHA_SIZE, 8, | 402 EGL_ALPHA_SIZE, 8, |
402 EGL_DEPTH_SIZE, 8, | 403 EGL_DEPTH_SIZE, 8, |
403 EGL_STENCIL_SIZE, 8, | 404 EGL_STENCIL_SIZE, 8, |
404 EGL_NONE | 405 EGL_NONE |
405 }; | 406 }; |
406 static const EGLint surfaceAttribList[] = { | 407 static const EGLint surfaceAttribList[] = { |
407 EGL_NONE, EGL_NONE | 408 EGL_NONE, EGL_NONE |
408 }; | 409 }; |
409 | 410 |
410 EGLDisplay display = eglGetDisplay(GetDC(hWnd)); | 411 EGLDisplay display = SkANGLEGLContext::GetD3DEGLDisplay(GetDC(hWnd)); |
411 if (display == EGL_NO_DISPLAY ) { | 412 |
412 return false; | 413 if (EGL_NO_DISPLAY == display) { |
| 414 SkDebugf("Could not create ANGLE egl display!\n"); |
| 415 return false; |
413 } | 416 } |
414 | 417 |
415 // Initialize EGL | 418 // Initialize EGL |
416 EGLint majorVersion, minorVersion; | 419 EGLint majorVersion, minorVersion; |
417 if (!eglInitialize(display, &majorVersion, &minorVersion)) { | 420 if (!eglInitialize(display, &majorVersion, &minorVersion)) { |
418 return false; | 421 return false; |
419 } | 422 } |
420 | 423 |
421 EGLint numConfigs; | 424 EGLint numConfigs; |
422 if (!eglGetConfigs(display, NULL, 0, &numConfigs)) { | 425 if (!eglGetConfigs(display, NULL, 0, &numConfigs)) { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 break; | 613 break; |
611 #endif // SK_ANGLE | 614 #endif // SK_ANGLE |
612 #endif // SK_SUPPORT_GPU | 615 #endif // SK_SUPPORT_GPU |
613 default: | 616 default: |
614 SkASSERT(false); | 617 SkASSERT(false); |
615 break; | 618 break; |
616 } | 619 } |
617 } | 620 } |
618 | 621 |
619 #endif | 622 #endif |
OLD | NEW |