Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(674)

Side by Side Diff: src/views/win/SkOSWindow_win.cpp

Issue 1845473004: Revert of Move SkGLContext and some GrGLInterface implementations to skgputest module (Closed) Base URL: https://chromium.googlesource.com/skia.git@debugobject
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp ('k') | tests/EGLImageTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "SkTypes.h" 7 #include "SkTypes.h"
8 8
9 #if defined(SK_BUILD_FOR_WIN) 9 #if defined(SK_BUILD_FOR_WIN)
10 10
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 388 }
389 389
390 void SkOSWindow::presentGL() { 390 void SkOSWindow::presentGL() {
391 HDC dc = GetDC((HWND)fHWND); 391 HDC dc = GetDC((HWND)fHWND);
392 SwapBuffers(dc); 392 SwapBuffers(dc);
393 ReleaseDC((HWND)fHWND, dc); 393 ReleaseDC((HWND)fHWND, dc);
394 } 394 }
395 395
396 #if SK_ANGLE 396 #if SK_ANGLE
397 397
398 void* get_angle_egl_display(void* nativeDisplay) {
399 PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT;
400 eglGetPlatformDisplayEXT =
401 (PFNEGLGETPLATFORMDISPLAYEXTPROC)eglGetProcAddress("eglGetPlatformDispla yEXT");
402
403 // We expect ANGLE to support this extension
404 if (!eglGetPlatformDisplayEXT) {
405 return EGL_NO_DISPLAY;
406 }
407
408 EGLDisplay display = EGL_NO_DISPLAY;
409 // Try for an ANGLE D3D11 context, fall back to D3D9, and finally GL.
410 EGLint attribs[3][3] = {
411 {
412 EGL_PLATFORM_ANGLE_TYPE_ANGLE,
413 EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
414 EGL_NONE
415 },
416 {
417 EGL_PLATFORM_ANGLE_TYPE_ANGLE,
418 EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE,
419 EGL_NONE
420 },
421 };
422 for (int i = 0; i < 3 && display == EGL_NO_DISPLAY; ++i) {
423 display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE,nativeDispla y, attribs[i]);
424 }
425 return display;
426 }
427
428 bool create_ANGLE(EGLNativeWindowType hWnd, 398 bool create_ANGLE(EGLNativeWindowType hWnd,
429 int msaaSampleCount, 399 int msaaSampleCount,
430 EGLDisplay* eglDisplay, 400 EGLDisplay* eglDisplay,
431 EGLContext* eglContext, 401 EGLContext* eglContext,
432 EGLSurface* eglSurface, 402 EGLSurface* eglSurface,
433 EGLConfig* eglConfig) { 403 EGLConfig* eglConfig) {
434 static const EGLint contextAttribs[] = { 404 static const EGLint contextAttribs[] = {
435 EGL_CONTEXT_CLIENT_VERSION, 2, 405 EGL_CONTEXT_CLIENT_VERSION, 2,
436 EGL_NONE, EGL_NONE 406 EGL_NONE, EGL_NONE
437 }; 407 };
438 static const EGLint configAttribList[] = { 408 static const EGLint configAttribList[] = {
439 EGL_RED_SIZE, 8, 409 EGL_RED_SIZE, 8,
440 EGL_GREEN_SIZE, 8, 410 EGL_GREEN_SIZE, 8,
441 EGL_BLUE_SIZE, 8, 411 EGL_BLUE_SIZE, 8,
442 EGL_ALPHA_SIZE, 8, 412 EGL_ALPHA_SIZE, 8,
443 EGL_DEPTH_SIZE, 8, 413 EGL_DEPTH_SIZE, 8,
444 EGL_STENCIL_SIZE, 8, 414 EGL_STENCIL_SIZE, 8,
445 EGL_NONE 415 EGL_NONE
446 }; 416 };
447 static const EGLint surfaceAttribList[] = { 417 static const EGLint surfaceAttribList[] = {
448 EGL_NONE, EGL_NONE 418 EGL_NONE, EGL_NONE
449 }; 419 };
450 420
451 EGLDisplay display = get_angle_egl_display(GetDC(hWnd), false); 421 EGLDisplay display = SkANGLEGLContext::GetD3DEGLDisplay(GetDC(hWnd), false);
452 422
453 if (EGL_NO_DISPLAY == display) { 423 if (EGL_NO_DISPLAY == display) {
454 SkDebugf("Could not create ANGLE egl display!\n"); 424 SkDebugf("Could not create ANGLE egl display!\n");
455 return false; 425 return false;
456 } 426 }
457 427
458 // Initialize EGL 428 // Initialize EGL
459 EGLint majorVersion, minorVersion; 429 EGLint majorVersion, minorVersion;
460 if (!eglInitialize(display, &majorVersion, &minorVersion)) { 430 if (!eglInitialize(display, &majorVersion, &minorVersion)) {
461 return false; 431 return false;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 } 770 }
801 771
802 void SkOSWindow::closeWindow() { 772 void SkOSWindow::closeWindow() {
803 DestroyWindow((HWND)fHWND); 773 DestroyWindow((HWND)fHWND);
804 if (fFullscreen) { 774 if (fFullscreen) {
805 DestroyWindow((HWND)fSavedWindowState.fHWND); 775 DestroyWindow((HWND)fSavedWindowState.fHWND);
806 } 776 }
807 gHwndToOSWindowMap.remove(fHWND); 777 gHwndToOSWindowMap.remove(fHWND);
808 } 778 }
809 #endif 779 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp ('k') | tests/EGLImageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698