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

Unified Diff: src/core/SkColorSpace_ICC.cpp

Issue 2306123002: Delete kInvalid_GammaNamed (part 2) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 3 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorSpace_ICC.cpp
diff --git a/src/core/SkColorSpace_ICC.cpp b/src/core/SkColorSpace_ICC.cpp
index 88fd1b345be78dc0ec6bb3eb1f606537d9859d08..f819d569a0ada46793aedcb06bf3d36d47259094 100755
--- a/src/core/SkColorSpace_ICC.cpp
+++ b/src/core/SkColorSpace_ICC.cpp
@@ -594,7 +594,9 @@ static size_t gamma_alloc_size(SkGammas::Type type, const SkGammas::Data& data)
static void handle_invalid_gamma(SkGammas::Type* type, SkGammas::Data* data) {
if (SkGammas::Type::kNone_Type == *type) {
*type = SkGammas::Type::kNamed_Type;
- data->fNamed = SkColorSpace::kInvalid_GammaNamed;
+
+ // Guess sRGB in the case of a malformed transfer function.
+ data->fNamed = SkColorSpace::kSRGB_GammaNamed;
}
}
@@ -892,7 +894,8 @@ static bool load_a2b0(sk_sp<SkColorLookUpTable>* colorLUT, SkColorSpace::GammaNa
(*gammas)->fBlueData = bData;
}
} else {
- *gammaNamed = SkColorSpace::kInvalid_GammaNamed;
+ // Guess sRGB if the chunk is missing a transfer function.
+ *gammaNamed = SkColorSpace::kSRGB_GammaNamed;
}
if (SkColorSpace::kNonStandard_GammaNamed == *gammaNamed) {
@@ -1092,7 +1095,8 @@ sk_sp<SkColorSpace> SkColorSpace::NewICC(const void* input, size_t len) {
gammas->fBlueData = bData;
}
} else {
- gammaNamed = kInvalid_GammaNamed;
+ // Guess sRGB if the profile is missing transfer functions.
+ gammaNamed = kSRGB_GammaNamed;
}
if (kNonStandard_GammaNamed == gammaNamed) {
« no previous file with comments | « include/core/SkColorSpace.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698