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

Unified Diff: src/core/SkImageInfo.cpp

Issue 2052943002: SkPixmap::setColorSpace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: std::move() 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 | « src/core/SkDraw.cpp ('k') | src/core/SkPixmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageInfo.cpp
diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp
index 7a2558ebd3f992ea0c34a1523cc2eeb33cf37231..88f1ed65c6704f2347b0dc540e48804b64c5db1c 100644
--- a/src/core/SkImageInfo.cpp
+++ b/src/core/SkImageInfo.cpp
@@ -32,7 +32,13 @@ static bool color_type_is_valid(SkColorType colorType) {
SkImageInfo SkImageInfo::Make(int width, int height, SkColorType ct, SkAlphaType at,
sk_sp<SkColorSpace> cs) {
- return SkImageInfo(width, height, ct, at, SkDefaultColorProfile(), std::move(cs));
+ SkColorProfileType pt = SkDefaultColorProfile();
+ // try to keep the enum and the colorspace in sync.
+ // TODO: eliminate the enum entirely, now that we have colorspace objects
+ if (cs && (SkColorSpace::kLinear_GammaNamed != cs->gammaNamed())) {
+ pt = kSRGB_SkColorProfileType;
+ }
+ return SkImageInfo(width, height, ct, at, pt, std::move(cs));
}
SkImageInfo SkImageInfo::MakeS32(int width, int height, SkAlphaType at) {
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/core/SkPixmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698