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

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

Issue 1892113002: Fix ANGLE in SampleApp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
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 | « no previous file | no next file » | 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 }; 417 };
418 for (int i = 0; i < 3 && display == EGL_NO_DISPLAY; ++i) { 418 for (int i = 0; i < 3 && display == EGL_NO_DISPLAY; ++i) {
419 display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE,nativeDispla y, attribs[i]); 419 display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE,nativeDispla y, attribs[i]);
420 } 420 }
421 return display; 421 return display;
422 } 422 }
423 423
424 struct ANGLEAssembleContext { 424 struct ANGLEAssembleContext {
425 ANGLEAssembleContext() { 425 ANGLEAssembleContext() {
426 fEGL = GetModuleHandle("libEGL.dll"); 426 fEGL = GetModuleHandle("libEGL.dll");
427 fGL = GetModuleHandle("libEGLESv2.dll"); 427 fGL = GetModuleHandle("libGLESv2.dll");
428 } 428 }
429 429
430 bool isValid() const { return SkToBool(fEGL) && SkToBool(fGL); } 430 bool isValid() const { return SkToBool(fEGL) && SkToBool(fGL); }
431 431
432 HMODULE fEGL; 432 HMODULE fEGL;
433 HMODULE fGL; 433 HMODULE fGL;
434 }; 434 };
435 435
436 static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) { 436 static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) {
437 const ANGLEAssembleContext& context = *reinterpret_cast<const ANGLEAssembleC ontext*>(ctx); 437 const ANGLEAssembleContext& context = *reinterpret_cast<const ANGLEAssembleC ontext*>(ctx);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 return false; 560 return false;
561 } 561 }
562 fANGLEInterface.reset(get_angle_gl_interface()); 562 fANGLEInterface.reset(get_angle_gl_interface());
563 if (!fANGLEInterface) { 563 if (!fANGLEInterface) {
564 this->detachANGLE(); 564 this->detachANGLE();
565 return false; 565 return false;
566 } 566 }
567 GL_CALL(fANGLEInterface, ClearStencil(0)); 567 GL_CALL(fANGLEInterface, ClearStencil(0));
568 GL_CALL(fANGLEInterface, ClearColor(0, 0, 0, 0)); 568 GL_CALL(fANGLEInterface, ClearColor(0, 0, 0, 0));
569 GL_CALL(fANGLEInterface, StencilMask(0xffffffff)); 569 GL_CALL(fANGLEInterface, StencilMask(0xffffffff));
570 GL_CALL(fANGLEInterface, Clear(GL_STENCIL_BUFFER_BIT |GL_COLOR_BUFFER_BI T)); 570 GL_CALL(fANGLEInterface, Clear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_B IT));
571 if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { 571 }
572 this->detachANGLE(); 572 if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) {
573 return false; 573 this->detachANGLE();
574 } 574 return false;
575 eglGetConfigAttrib(fDisplay, fConfig, EGL_STENCIL_SIZE, &info->fStencilB its); 575 }
576 eglGetConfigAttrib(fDisplay, fConfig, EGL_SAMPLES, &info->fSampleCount); 576 eglGetConfigAttrib(fDisplay, fConfig, EGL_STENCIL_SIZE, &info->fStencilBits) ;
577 eglGetConfigAttrib(fDisplay, fConfig, EGL_SAMPLES, &info->fSampleCount);
577 578
578 GL_CALL(fANGLEInterface, Viewport(0, 0, SkScalarRoundToInt(this->width() ), 579 GL_CALL(fANGLEInterface, Viewport(0, 0, SkScalarRoundToInt(this->width()),
579 SkScalarRoundToInt(this->height( )))); 580 SkScalarRoundToInt(this->height())));
580 return true; 581 return true;
581 }
582 return false;
583 } 582 }
584 583
585 void SkOSWindow::detachANGLE() { 584 void SkOSWindow::detachANGLE() {
586 fANGLEInterface.reset(nullptr); 585 fANGLEInterface.reset(nullptr);
587 eglMakeCurrent(fDisplay, EGL_NO_SURFACE , EGL_NO_SURFACE , EGL_NO_CONTEXT); 586 eglMakeCurrent(fDisplay, EGL_NO_SURFACE , EGL_NO_SURFACE , EGL_NO_CONTEXT);
588 587
589 eglDestroyContext(fDisplay, fContext); 588 eglDestroyContext(fDisplay, fContext);
590 fContext = EGL_NO_CONTEXT; 589 fContext = EGL_NO_CONTEXT;
591 590
592 eglDestroySurface(fDisplay, fSurface); 591 eglDestroySurface(fDisplay, fSurface);
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 } 822 }
824 823
825 void SkOSWindow::closeWindow() { 824 void SkOSWindow::closeWindow() {
826 DestroyWindow((HWND)fHWND); 825 DestroyWindow((HWND)fHWND);
827 if (fFullscreen) { 826 if (fFullscreen) {
828 DestroyWindow((HWND)fSavedWindowState.fHWND); 827 DestroyWindow((HWND)fSavedWindowState.fHWND);
829 } 828 }
830 gHwndToOSWindowMap.remove(fHWND); 829 gHwndToOSWindowMap.remove(fHWND);
831 } 830 }
832 #endif 831 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698