diff options
author | msarett <msarett@google.com> | 2016-06-15 12:12:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-15 12:12:48 -0700 |
commit | 04d35bd80dde7cace866781037cbbdcab14ab683 (patch) | |
tree | fc093d646c0c96d99e8c472ac512db20fe727f07 /include | |
parent | a7d1e2a57aef2aa4913d4380646d60bbab761318 (diff) |
Keep SkColorSpace and SkColorProfileType in sync
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2068743003
Review-Url: https://codereview.chromium.org/2068743003
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkImageInfo.h | 12 |
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); } /** |