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

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: 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
« no previous file with comments | « no previous file | tests/SurfaceTest.cpp » ('j') | tests/SurfaceTest.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkSurface_Raster.cpp
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index 90f26becb2327864f0173fc37b1f863f72314db9..828d3ddf4bdf58b14430048819d15156d576bd86 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -49,12 +49,22 @@ 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() &&
+ SkColorSpace::kLinear_GammaNamed != info.colorSpace()->gammaNamed()) {
Brian Osman 2016/08/23 13:25:56 Matt mentioned that if someone constructs a color
msarett 2016/08/23 13:46:11 What I was trying to say is that we won't catch IC
+ return false;
+ }
shift = 2;
break;
case kRGBA_F16_SkColorType:
« no previous file with comments | « no previous file | tests/SurfaceTest.cpp » ('j') | tests/SurfaceTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698