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

Unified Diff: tools/skiaserve/Request.cpp

Issue 2270823002: Some tests around surface creation and snapshotting with color space (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 4 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
« tests/SurfaceTest.cpp ('K') | « tools/flags/SkCommonFlagsConfig.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skiaserve/Request.cpp
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp
index e3a0caa6e2dc2e1cd168c0e166c0216b36f86c3f..22fa211abceb854f2ff303072110c64b8fc481ce 100644
--- a/tools/skiaserve/Request.cpp
+++ b/tools/skiaserve/Request.cpp
@@ -174,9 +174,12 @@ ColorAndProfile ColorModes[] = {
SkSurface* Request::createCPUSurface() {
SkIRect bounds = this->getBounds();
ColorAndProfile cap = ColorModes[fColorMode];
- auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
+ auto colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
+ if (kRGBA_F16_SkColorType == cap.fColorType) {
+ colorSpace = colorSpace->makeLinearGamma();
+ }
SkImageInfo info = SkImageInfo::Make(bounds.width(), bounds.height(), cap.fColorType,
- kPremul_SkAlphaType, cap.fSRGB ? srgbColorSpace : nullptr);
+ kPremul_SkAlphaType, cap.fSRGB ? colorSpace : nullptr);
return SkSurface::MakeRaster(info).release();
}
@@ -184,9 +187,12 @@ SkSurface* Request::createGPUSurface() {
GrContext* context = this->getContext();
SkIRect bounds = this->getBounds();
ColorAndProfile cap = ColorModes[fColorMode];
- auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
+ auto colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
+ if (kRGBA_F16_SkColorType == cap.fColorType) {
+ colorSpace = colorSpace->makeLinearGamma();
+ }
SkImageInfo info = SkImageInfo::Make(bounds.width(), bounds.height(), cap.fColorType,
- kPremul_SkAlphaType, cap.fSRGB ? srgbColorSpace : nullptr);
+ kPremul_SkAlphaType, cap.fSRGB ? colorSpace: nullptr);
SkSurface* surface = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info).release();
return surface;
}
« tests/SurfaceTest.cpp ('K') | « tools/flags/SkCommonFlagsConfig.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698