diff options
author | 2017-02-24 16:04:47 -0700 | |
---|---|---|
committer | 2017-02-27 16:46:34 +0000 | |
commit | 578f064a60b63ddfb00831e9e59a47060bfcefe0 (patch) | |
tree | c38f7fe730f7933d322c4455c45c9531d539c77d /tools/viewer/sk_app/GLWindowContext.cpp | |
parent | ab8e02a4dee79fc4300c5eec0fbbc44d07f433d3 (diff) |
Add msaa flag and UI to viewer
BUG=skia:
Change-Id: I0a24d5e6a4271f84ea5c82eb6d9ede9a1e63f86a
Reviewed-on: https://skia-review.googlesource.com/8787
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'tools/viewer/sk_app/GLWindowContext.cpp')
-rw-r--r-- | tools/viewer/sk_app/GLWindowContext.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tools/viewer/sk_app/GLWindowContext.cpp b/tools/viewer/sk_app/GLWindowContext.cpp index fac0c328c4..89cd858bc1 100644 --- a/tools/viewer/sk_app/GLWindowContext.cpp +++ b/tools/viewer/sk_app/GLWindowContext.cpp @@ -19,6 +19,7 @@ #include "SkCanvas.h" #include "SkImage_Base.h" +#include "SkMathPriv.h" namespace sk_app { @@ -27,6 +28,9 @@ GLWindowContext::GLWindowContext(const DisplayParams& params) , fBackendContext(nullptr) , fSurface(nullptr) { fDisplayParams = params; + fDisplayParams.fMSAASampleCount = fDisplayParams.fMSAASampleCount ? + GrNextPow2(fDisplayParams.fMSAASampleCount) : + 0; } void GLWindowContext::initializeContext() { @@ -38,11 +42,20 @@ void GLWindowContext::initializeContext() { fBackendContext.reset(GrGLCreateNativeInterface()); fContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)fBackendContext.get(), ctxOptions); + if (!fContext && fDisplayParams.fMSAASampleCount) { + fDisplayParams.fMSAASampleCount /= 2; + this->initializeContext(); + return; + } - // We may not have real sRGB support (ANGLE, in particular), so check for - // that, and fall back to L32: - fPixelConfig = fContext->caps()->srgbSupport() && fDisplayParams.fColorSpace - ? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig; + if (fContext) { + // We may not have real sRGB support (ANGLE, in particular), so check for + // that, and fall back to L32: + fPixelConfig = fContext->caps()->srgbSupport() && fDisplayParams.fColorSpace + ? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig; + } else { + fPixelConfig = kUnknown_GrPixelConfig; + } } void GLWindowContext::destroyContext() { |