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

Unified Diff: include/core/SkImageInfo.h

Issue 2068743003: Keep SkColorSpace and SkColorProfileType in sync (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix roll using SK_API 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
« no previous file with comments | « include/core/SkColorSpace.h ('k') | tests/ImageIsOpaqueTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImageInfo.h
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
index 2be04ff5a7a966d7b4e1cb6f94a3b6d0c3a68438..c0e0be13f93d394712e4ca7131e16a1458d0c7a6 100644
--- a/include/core/SkImageInfo.h
+++ b/include/core/SkImageInfo.h
@@ -198,7 +198,9 @@ public:
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at,
SkColorProfileType pt = kLinear_SkColorProfileType) {
- return SkImageInfo(width, height, ct, at, pt, nullptr);
+ sk_sp<SkColorSpace> cs = (kSRGB_SkColorProfileType == pt) ?
+ SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) : nullptr;
+ return SkImageInfo(width, height, ct, at, pt, cs);
}
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at,
@@ -209,7 +211,9 @@ public:
*/
static SkImageInfo MakeN32(int width, int height, SkAlphaType at,
SkColorProfileType pt = kLinear_SkColorProfileType) {
- return SkImageInfo(width, height, kN32_SkColorType, at, pt, nullptr);
+ sk_sp<SkColorSpace> cs = (kSRGB_SkColorProfileType == pt) ?
+ SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) : nullptr;
+ return SkImageInfo(width, height, kN32_SkColorType, at, pt, cs);
}
/**
@@ -217,7 +221,9 @@ public:
*/
static SkImageInfo MakeN32Premul(int width, int height,
SkColorProfileType pt = kLinear_SkColorProfileType) {
- return SkImageInfo(width, height, kN32_SkColorType, kPremul_SkAlphaType, pt, nullptr);
+ sk_sp<SkColorSpace> cs = (kSRGB_SkColorProfileType == pt) ?
+ SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) : nullptr;
+ return SkImageInfo(width, height, kN32_SkColorType, kPremul_SkAlphaType, pt, cs);
}
/**
« no previous file with comments | « include/core/SkColorSpace.h ('k') | tests/ImageIsOpaqueTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698