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

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

Issue 1919993002: Added --deepColor option to SampleApp, triggers creation of a ten-bit/channel buffer on Windows. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More cleanup Created 4 years, 7 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
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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 } 332 }
333 if (delay) 333 if (delay)
334 { 334 {
335 gTimer = SetTimer(NULL, 0, delay, sk_timer_proc); 335 gTimer = SetTimer(NULL, 0, delay, sk_timer_proc);
336 //SkDebugf("SetTimer of %d returned %d\n", delay, gTimer); 336 //SkDebugf("SetTimer of %d returned %d\n", delay, gTimer);
337 } 337 }
338 } 338 }
339 339
340 #if SK_SUPPORT_GPU 340 #if SK_SUPPORT_GPU
341 341
342 bool SkOSWindow::attachGL(int msaaSampleCount, AttachmentInfo* info) { 342 bool SkOSWindow::attachGL(int msaaSampleCount, bool tenBitColor, AttachmentInfo* info) {
343 HDC dc = GetDC((HWND)fHWND); 343 HDC dc = GetDC((HWND)fHWND);
344 if (NULL == fHGLRC) { 344 if (NULL == fHGLRC) {
345 fHGLRC = SkCreateWGLContext(dc, msaaSampleCount, 345 fHGLRC = SkCreateWGLContext(dc, msaaSampleCount, tenBitColor,
346 kGLPreferCompatibilityProfile_SkWGLContextRequest); 346 kGLPreferCompatibilityProfile_SkWGLContextRequest);
347 if (NULL == fHGLRC) { 347 if (NULL == fHGLRC) {
348 return false; 348 return false;
349 } 349 }
350 glClearStencil(0); 350 glClearStencil(0);
351 glClearColor(0, 0, 0, 0); 351 glClearColor(0, 0, 0, 0);
352 glStencilMask(0xffffffff); 352 glStencilMask(0xffffffff);
353 glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT); 353 glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
354 } 354 }
355 if (wglMakeCurrent(dc, (HGLRC)fHGLRC)) { 355 if (wglMakeCurrent(dc, (HGLRC)fHGLRC)) {
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 } 644 }
645 645
646 void SkOSWindow::presentCommandBuffer() { 646 void SkOSWindow::presentCommandBuffer() {
647 fCommandBuffer->presentCommandBuffer(); 647 fCommandBuffer->presentCommandBuffer();
648 } 648 }
649 #endif // SK_COMMAND_BUFFER 649 #endif // SK_COMMAND_BUFFER
650 650
651 #endif // SK_SUPPORT_GPU 651 #endif // SK_SUPPORT_GPU
652 652
653 // return true on success 653 // return true on success
654 bool SkOSWindow::attach(SkBackEndTypes attachType, int msaaSampleCount, Attachme ntInfo* info) { 654 bool SkOSWindow::attach(SkBackEndTypes attachType, int msaaSampleCount, bool ten BitColor,
655 AttachmentInfo* info) {
655 656
656 // attach doubles as "windowResize" so we need to allo 657 // attach doubles as "windowResize" so we need to allo
657 // already bound states to pass through again 658 // already bound states to pass through again
658 // TODO: split out the resize functionality 659 // TODO: split out the resize functionality
659 // SkASSERT(kNone_BackEndType == fAttached); 660 // SkASSERT(kNone_BackEndType == fAttached);
660 bool result = true; 661 bool result = true;
661 662
662 switch (attachType) { 663 switch (attachType) {
663 case kNone_BackEndType: 664 case kNone_BackEndType:
664 // nothing to do 665 // nothing to do
665 break; 666 break;
666 #if SK_SUPPORT_GPU 667 #if SK_SUPPORT_GPU
667 case kNativeGL_BackEndType: 668 case kNativeGL_BackEndType:
668 result = attachGL(msaaSampleCount, info); 669 result = attachGL(msaaSampleCount, tenBitColor, info);
669 break; 670 break;
670 #if SK_ANGLE 671 #if SK_ANGLE
671 case kANGLE_BackEndType: 672 case kANGLE_BackEndType:
672 result = attachANGLE(msaaSampleCount, info); 673 result = attachANGLE(msaaSampleCount, info);
673 break; 674 break;
674 #endif // SK_ANGLE 675 #endif // SK_ANGLE
675 #if SK_COMMAND_BUFFER 676 #if SK_COMMAND_BUFFER
676 case kCommandBuffer_BackEndType: 677 case kCommandBuffer_BackEndType:
677 result = attachCommandBuffer(msaaSampleCount, info); 678 result = attachCommandBuffer(msaaSampleCount, info);
678 break; 679 break;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 } 827 }
827 828
828 void SkOSWindow::closeWindow() { 829 void SkOSWindow::closeWindow() {
829 DestroyWindow((HWND)fHWND); 830 DestroyWindow((HWND)fHWND);
830 if (fFullscreen) { 831 if (fFullscreen) {
831 DestroyWindow((HWND)fSavedWindowState.fHWND); 832 DestroyWindow((HWND)fSavedWindowState.fHWND);
832 } 833 }
833 gHwndToOSWindowMap.remove(fHWND); 834 gHwndToOSWindowMap.remove(fHWND);
834 } 835 }
835 #endif 836 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698