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

Unified Diff: src/image/SkSurface_Raster.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
Index: src/image/SkSurface_Raster.cpp
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index 90f26becb2327864f0173fc37b1f863f72314db9..9309487c2b5f5f60f6a62c20056e9cf86444d19f 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -49,15 +49,28 @@ bool SkSurface_Raster::Valid(const SkImageInfo& info, size_t rowBytes) {
int shift = 0;
switch (info.colorType()) {
case kAlpha_8_SkColorType:
+ if (info.colorSpace()) {
+ return false;
+ }
shift = 0;
break;
case kRGB_565_SkColorType:
+ if (info.colorSpace()) {
+ return false;
+ }
shift = 1;
break;
case kN32_SkColorType:
+ if (info.colorSpace() && !info.colorSpace()->gammaCloseToSRGB()) {
+ return false;
+ }
shift = 2;
break;
case kRGBA_F16_SkColorType:
+ if (!info.colorSpace() ||
+ SkColorSpace::kLinear_GammaNamed != info.colorSpace()->gammaNamed()) {
+ return false;
+ }
shift = 3;
break;
default:
« no previous file with comments | « src/image/SkSurface_Gpu.cpp ('k') | tests/SurfaceTest.cpp » ('j') | tests/SurfaceTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698