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

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: 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/WindowContext.h ('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..721639a09904c100b42053a56a2673d781192bd8 100755
--- a/tools/viewer/sk_app/WindowContext.cpp
+++ b/tools/viewer/sk_app/WindowContext.cpp
@@ -21,12 +21,13 @@
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);
Brian Osman 2016/06/15 13:41:59 Need to also set this flag if sRGB is true: ((GrP
liyuqian 2016/06/15 14:09:15 Done.
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 +36,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
msarett 2016/06/15 13:48:10 Sorry I don't understand what you're saying here?
liyuqian 2016/06/15 14:09:15 I was referring to the previous implementation bef
msarett 2016/06/15 14:20:40 Depends on whether what you are drawing is opaque
+ // CheckAlphaTypeAndGetFlags
+ kOpaque_SkAlphaType,
+ sRGB ? kSRGB_SkColorProfileType
msarett 2016/06/15 13:48:10 Please use a SkColorSpace object here instead of t
liyuqian 2016/06/15 14:09:15 The difficulty here is that DisplayParams maintain
msarett 2016/06/15 14:20:40 SGTM. I still think it's possible to use SkColorS
liyuqian 2016/06/15 16:43:12 Done. I've adopted your approach.
+ : 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/WindowContext.h ('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