aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-06-15 12:12:48 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-15 12:12:48 -0700
commit04d35bd80dde7cace866781037cbbdcab14ab683 (patch)
treefc093d646c0c96d99e8c472ac512db20fe727f07 /include
parenta7d1e2a57aef2aa4913d4380646d60bbab761318 (diff)
Keep SkColorSpace and SkColorProfileType in sync
Diffstat (limited to 'include')
-rw-r--r--include/core/SkImageInfo.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
index 2be04ff5a7..c0e0be13f9 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);
}
/**