aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/viewer/sk_app/GLWindowContext.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-02-08 10:47:28 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-08 17:34:05 +0000
commitf750fbcb699fff2bdd264969515fc4045a1248be (patch)
treea540a926801c5a2b1beccd674236c5e33795f5e1 /tools/viewer/sk_app/GLWindowContext.cpp
parentb782627376c0db63ba42684eb901ff006db7a2b0 (diff)
Simplify viewer's handling of backbuffer surface and color space
WindowContext still supports color spaces, but not other color types. Any off-screen rendering is the app's responsibility. This change also adds (working) F16 support to viewer. Note that the previous 10-bit and FP16 support in WindowContext was broken. There was no code to push the off-screen canvas to the window. If you ever made it to the unreachable off-screen code path in createSurface, it would have simply stopped drawing. The decision to limit the window's gamut to sRGB is mostly driven by my desire to add real-time editing of gamut. This design lets us do that, without tearing down and rebuilding the window for every change. An application could still supply a different gamut via setDisplayParams and render directly to the back buffer with proper color correction. BUG=skia: Change-Id: I94df35c7a42faee396009acc83683e40bb3c284d Reviewed-on: https://skia-review.googlesource.com/8153 Reviewed-by: Jim Van Verth <jvanverth@google.com> Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tools/viewer/sk_app/GLWindowContext.cpp')
-rw-r--r--tools/viewer/sk_app/GLWindowContext.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/tools/viewer/sk_app/GLWindowContext.cpp b/tools/viewer/sk_app/GLWindowContext.cpp
index dd51b7e160..501f272a3e 100644
--- a/tools/viewer/sk_app/GLWindowContext.cpp
+++ b/tools/viewer/sk_app/GLWindowContext.cpp
@@ -39,11 +39,8 @@ void GLWindowContext::initializeContext() {
// We may not have real sRGB support (ANGLE, in particular), so check for
// that, and fall back to L32:
- //
- // ... 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:
- fPixelConfig = fContext->caps()->srgbSupport() && fDisplayParams.fColorSpace &&
- (fColorBits != 30) ? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig;
+ fPixelConfig = fContext->caps()->srgbSupport() && fDisplayParams.fColorSpace
+ ? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig;
}
void GLWindowContext::destroyContext() {
@@ -63,8 +60,6 @@ void GLWindowContext::destroyContext() {
sk_sp<SkSurface> GLWindowContext::getBackbufferSurface() {
if (nullptr == fSurface) {
- fActualColorBits = SkTMax(fColorBits, 24);
-
if (fContext) {
GrBackendRenderTargetDesc desc;
desc.fWidth = this->fWidth;
@@ -77,7 +72,9 @@ sk_sp<SkSurface> GLWindowContext::getBackbufferSurface() {
GR_GL_CALL(fBackendContext.get(), GetIntegerv(GR_GL_FRAMEBUFFER_BINDING, &buffer));
desc.fRenderTargetHandle = buffer;
- fSurface = this->createRenderSurface(desc, fActualColorBits);
+ fSurface = SkSurface::MakeFromBackendRenderTarget(fContext, desc,
+ fDisplayParams.fColorSpace,
+ &fSurfaceProps);
}
}