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: |