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

Unified Diff: tools/viewer/sk_app/WindowContext.cpp

Issue 2069653002: Use Offscreen Surface for Split Screen (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix nits Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« tools/viewer/sk_app/Window.cpp ('K') | « tools/viewer/sk_app/WindowContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/viewer/sk_app/WindowContext.cpp
diff --git a/tools/viewer/sk_app/WindowContext.cpp b/tools/viewer/sk_app/WindowContext.cpp
index 41bbd14576b37f604c8f65d7001b8de076932553..44fd91458f9326b8a9c9d233ebd151a4bd042f65 100755
--- a/tools/viewer/sk_app/WindowContext.cpp
+++ b/tools/viewer/sk_app/WindowContext.cpp
@@ -21,12 +21,14 @@
namespace sk_app {
-sk_sp<SkSurface> WindowContext::createRenderSurface(sk_sp<GrRenderTarget> rt, int colorBits) {
+sk_sp<SkSurface> WindowContext::createRenderSurface(
+ sk_sp<GrRenderTarget> rt, int colorBits, bool offscreen, bool sRGB) {
auto flags = (fSurfaceProps.flags() & ~SkSurfaceProps::kGammaCorrect_Flag) |
- (GrPixelConfigIsSRGB(fPixelConfig) ? SkSurfaceProps::kGammaCorrect_Flag : 0);
+ (GrPixelConfigIsSRGB(fPixelConfig) || sRGB ?
+ SkSurfaceProps::kGammaCorrect_Flag : 0);
SkSurfaceProps props(flags, fSurfaceProps.pixelGeometry());
- if (!this->isGpuContext() || colorBits > 24 ||
+ if (!this->isGpuContext() || colorBits > 24 || offscreen ||
kRGBA_F16_SkColorType == fDisplayParams.fColorType) {
// If we're rendering to F16, we need an off-screen surface - the current render
// target is most likely the wrong format.
@@ -35,10 +37,17 @@ sk_sp<SkSurface> WindowContext::createRenderSurface(sk_sp<GrRenderTarget> rt, in
// need an off-screen surface. 10-bit, in particular, has strange gamma behavior.
SkImageInfo info = SkImageInfo::Make(fWidth, fHeight,
fDisplayParams.fColorType,
- kUnknown_SkAlphaType,
- fDisplayParams.fProfileType);
- return SkSurface::MakeRenderTarget(fContext, SkBudgeted::kNo, info,
- fDisplayParams.fMSAASampleCount, &props);
+ // kUnknown_SkAlphaType won't pass
+ // CheckAlphaTypeAndGetFlags
+ kOpaque_SkAlphaType,
Brian Osman 2016/06/15 15:32:03 kOpaque is probably okay, although kPremul is prob
liyuqian 2016/06/15 16:43:12 Done. Ok, I'll change both kOpaque to kPremul.
+ sRGB ? kSRGB_SkColorProfileType
+ : fDisplayParams.fProfileType);
+ if (this->isGpuContext()) {
+ return SkSurface::MakeRenderTarget(fContext, SkBudgeted::kNo, info,
+ fDisplayParams.fMSAASampleCount, &props);
+ } else {
+ return SkSurface::MakeRaster(info, &props);
+ }
} else {
return SkSurface::MakeRenderTargetDirect(rt.get(), &props);
}
« tools/viewer/sk_app/Window.cpp ('K') | « tools/viewer/sk_app/WindowContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698