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

Unified Diff: src/core/SkColorSpace_ICC.cpp

Issue 2315863003: Revert of More robust check for sRGB gamma tables (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 | « no previous file | 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 92dcc0fcf5389985faf0f2d005eefdd7089b7d57..9ab1da007d16e8dee5aa5dae7b0a358d65effcb9 100755
--- a/src/core/SkColorSpace_ICC.cpp
+++ b/src/core/SkColorSpace_ICC.cpp
@@ -260,14 +260,6 @@
static float read_big_endian_16_dot_16(const uint8_t buf[4]) {
// It just so happens that SkFixed is also 16.16!
return SkFixedToFloat(read_big_endian_i32(buf));
-}
-
-static inline float srgb_fn(float x) {
- if (x <= 0.04045f) {
- return x * (1.0f / 12.92f);
- }
-
- return powf(x * (1.0f / 1.055f) + (0.055f / 1.055f), 2.4f);
}
/**
@@ -378,35 +370,9 @@
}
}
- // Perform a more robust check for sRGB. See if the table is a close
- // match to an sRGB table. This is in addition to the previous sRGB
- // checks for a couple reasons:
- // (1) It is much slower.
- // (2) The 26 entry "sRGB" curve is actually so inaccurate that it fails
- // this check. But it still wants to be sRGB.
- float x = 0.0f;
- float dx = 1.0f / ((float) (count - 1));
- for (uint32_t i = 0; i < count; i++) {
- float y = srgb_fn(x);
-
- // Convert y to the same format as the table (0.16 fixed point), so we can
- // compare values.
- uint16_t srgbY = sk_float_round2int(y * (float) (1 << 16));
- uint16_t actualY = read_big_endian_u16((const uint8_t*) &table[i]);
-
- // We allow "off by 1" curves to try to not be affected by rounding decisions.
- if (SkTAbs((int32_t) srgbY - (int32_t) actualY) > 1) {
- // Curve is not sRGB, will use table representation.
- outData->fTable.fSize = count;
- return SkGammas::Type::kTable_Type;
- }
-
- x += dx;
- }
-
- outData->fNamed = SkColorSpace::kSRGB_GammaNamed;
- return SkGammas::Type::kNamed_Type;
-
+ // Otherwise, we will represent gamma with a table.
+ outData->fTable.fSize = count;
+ return SkGammas::Type::kTable_Type;
}
case kTAG_ParaCurveType: {
enum ParaCurveType {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698