diff options
author | 2016-05-05 12:24:31 -0700 | |
---|---|---|
committer | 2016-05-05 12:24:31 -0700 | |
commit | 2d1ee7936e3536e45c963db004e3b512bb415fd8 (patch) | |
tree | edefade2fbe8c19d10abae08f3a658f202bbb5c1 /src/views | |
parent | d215a95882485026d176a81bf58871276b21c89c (diff) |
Added --deepColor option to SampleApp, triggers creation of a ten-bit/channel
buffer. (Only on Windows at the moment). Uses new effect to do the final
gamma adjustment
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1919993002
Review-Url: https://codereview.chromium.org/1919993002
Diffstat (limited to 'src/views')
-rw-r--r-- | src/views/SkWindow.cpp | 11 | ||||
-rwxr-xr-x | src/views/ios/SkOSWindow_iOS.mm | 1 | ||||
-rw-r--r-- | src/views/mac/SkOSWindow_Mac.mm | 3 | ||||
-rw-r--r-- | src/views/sdl/SkOSWindow_SDL.cpp | 3 | ||||
-rw-r--r-- | src/views/unix/SkOSWindow_Unix.cpp | 3 | ||||
-rw-r--r-- | src/views/win/SkOSWindow_win.cpp | 13 |
6 files changed, 23 insertions, 11 deletions
diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp index 244bc49742..d06d6bb9eb 100644 --- a/src/views/SkWindow.cpp +++ b/src/views/SkWindow.cpp @@ -340,9 +340,14 @@ GrRenderTarget* SkWindow::renderTarget(const AttachmentInfo& attachmentInfo, // // Also, we may not have real sRGB support (ANGLE, in particular), so check for // that, and fall back to L32: - desc.fConfig = grContext->caps()->srgbSupport() && SkImageInfoIsGammaCorrect(info()) - ? kSkiaGamma8888_GrPixelConfig - : kSkia8888_GrPixelConfig; + // + // ... and, if we're using a 10-bit/channel FB0, it doesn't do sRGB conversion on write, + // so pretend that it's non-sRGB 8888: + desc.fConfig = + grContext->caps()->srgbSupport() && + SkImageInfoIsGammaCorrect(info()) && + (attachmentInfo.fColorBits != 30) + ? kSkiaGamma8888_GrPixelConfig : kSkia8888_GrPixelConfig; desc.fOrigin = kBottomLeft_GrSurfaceOrigin; desc.fSampleCnt = attachmentInfo.fSampleCount; desc.fStencilBits = attachmentInfo.fStencilBits; diff --git a/src/views/ios/SkOSWindow_iOS.mm b/src/views/ios/SkOSWindow_iOS.mm index 2a74ed6b2c..aa7d3759bd 100755 --- a/src/views/ios/SkOSWindow_iOS.mm +++ b/src/views/ios/SkOSWindow_iOS.mm @@ -59,6 +59,7 @@ void SkOSWindow::onUpdateMenu(SkOSMenu* menu) { bool SkOSWindow::attach(SkBackEndTypes /* attachType */, int /* msaaSampleCount */, + bool /* deepColor */, AttachmentInfo* info) { [(SkUIView*)fHWND getAttachmentInfo:info]; bool success = true; diff --git a/src/views/mac/SkOSWindow_Mac.mm b/src/views/mac/SkOSWindow_Mac.mm index ee5372113d..faf1bbafd2 100644 --- a/src/views/mac/SkOSWindow_Mac.mm +++ b/src/views/mac/SkOSWindow_Mac.mm @@ -65,7 +65,8 @@ void SkOSWindow::onUpdateMenu(const SkOSMenu* menu) { [(SkNSView*)fHWND onUpdateMenu:menu]; } -bool SkOSWindow::attach(SkBackEndTypes attachType, int sampleCount, AttachmentInfo* info) { +bool SkOSWindow::attach(SkBackEndTypes attachType, int sampleCount, bool /*deepColor*/, + AttachmentInfo* info) { return [(SkNSView*)fHWND attach:attachType withMSAASampleCount:sampleCount andGetInfo:info]; } diff --git a/src/views/sdl/SkOSWindow_SDL.cpp b/src/views/sdl/SkOSWindow_SDL.cpp index 76d43498e8..88b8353b6c 100644 --- a/src/views/sdl/SkOSWindow_SDL.cpp +++ b/src/views/sdl/SkOSWindow_SDL.cpp @@ -57,7 +57,8 @@ void SkOSWindow::release() { } } -bool SkOSWindow::attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo* info) { +bool SkOSWindow::attach(SkBackEndTypes attachType, int msaaSampleCount, bool deepColor, + AttachmentInfo* info) { this->createWindow(msaaSampleCount); if (!fWindow) { return false; diff --git a/src/views/unix/SkOSWindow_Unix.cpp b/src/views/unix/SkOSWindow_Unix.cpp index 7f9d168cb8..2f195927e0 100644 --- a/src/views/unix/SkOSWindow_Unix.cpp +++ b/src/views/unix/SkOSWindow_Unix.cpp @@ -348,7 +348,8 @@ static void glXSwapInterval(Display* dsp, GLXDrawable drawable, int interval) { ///////////////////////////////////////////////////////////////////////// -bool SkOSWindow::attach(SkBackEndTypes, int msaaSampleCount, AttachmentInfo* info) { +bool SkOSWindow::attach(SkBackEndTypes, int msaaSampleCount, bool deepColor, + AttachmentInfo* info) { this->initWindow(msaaSampleCount, info); if (nullptr == fUnixWindow.fDisplay) { diff --git a/src/views/win/SkOSWindow_win.cpp b/src/views/win/SkOSWindow_win.cpp index a8d05d96f7..a5aafd05d1 100644 --- a/src/views/win/SkOSWindow_win.cpp +++ b/src/views/win/SkOSWindow_win.cpp @@ -339,10 +339,10 @@ void SkEvent::SignalQueueTimer(SkMSec delay) #if SK_SUPPORT_GPU -bool SkOSWindow::attachGL(int msaaSampleCount, AttachmentInfo* info) { +bool SkOSWindow::attachGL(int msaaSampleCount, bool deepColor, AttachmentInfo* info) { HDC dc = GetDC((HWND)fHWND); if (NULL == fHGLRC) { - fHGLRC = SkCreateWGLContext(dc, msaaSampleCount, + fHGLRC = SkCreateWGLContext(dc, msaaSampleCount, deepColor, kGLPreferCompatibilityProfile_SkWGLContextRequest); if (NULL == fHGLRC) { return false; @@ -353,11 +353,13 @@ bool SkOSWindow::attachGL(int msaaSampleCount, AttachmentInfo* info) { glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT); } if (wglMakeCurrent(dc, (HGLRC)fHGLRC)) { - // use DescribePixelFormat to get the stencil bit depth. + // use DescribePixelFormat to get the stencil and color bit depth. int pixelFormat = GetPixelFormat(dc); PIXELFORMATDESCRIPTOR pfd; DescribePixelFormat(dc, pixelFormat, sizeof(pfd), &pfd); info->fStencilBits = pfd.cStencilBits; + // pfd.cColorBits includes alpha, so it will be 32 in 8/8/8/8 and 10/10/10/2 + info->fColorBits = pfd.cRedBits + pfd.cGreenBits + pfd.cBlueBits; // Get sample count if the MSAA WGL extension is present SkWGLExtensions extensions; @@ -651,7 +653,8 @@ void SkOSWindow::presentCommandBuffer() { #endif // SK_SUPPORT_GPU // return true on success -bool SkOSWindow::attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo* info) { +bool SkOSWindow::attach(SkBackEndTypes attachType, int msaaSampleCount, bool deepColor, + AttachmentInfo* info) { // attach doubles as "windowResize" so we need to allo // already bound states to pass through again @@ -665,7 +668,7 @@ bool SkOSWindow::attach(SkBackEndTypes attachType, int msaaSampleCount, Attachme break; #if SK_SUPPORT_GPU case kNativeGL_BackEndType: - result = attachGL(msaaSampleCount, info); + result = attachGL(msaaSampleCount, deepColor, info); break; #if SK_ANGLE case kANGLE_BackEndType: |