diff options
author | skia-autoroll@skia-public.iam.gserviceaccount.com <skia-autoroll@skia-public.iam.gserviceaccount.com> | 2018-11-01 15:11:14 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-11-01 15:37:24 +0000 |
commit | dfbbb2b063a778c5080f157a5f1a981052d4441b (patch) | |
tree | fb13d8882a2abaa4970c098381098fc7d9e26cb2 /third_party | |
parent | 3a324f84c22365c902159fd1c1ce0c287f019bc1 (diff) | |
download | skqp-dfbbb2b063a778c5080f157a5f1a981052d4441b.tar.gz |
Roll skia/third_party/skcms 1ce6da5c8d99..26679709b32f (1 commits)
https://skia.googlesource.com/skcms.git/+log/1ce6da5c8d99..26679709b32f
2018-11-01 mtklein@google.com always fit f=0
The AutoRoll server is located here: https://autoroll.skia.org/r/skcms-skia-autoroll
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
If the roll is causing failures, please contact the current sheriff, who should
be CC'd on the roll, and stop the roller if necessary.
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel
TBR=herb@google.com
Change-Id: I220ce2ab45a62e711b0e9c0feaebf009a5f018e0
Reviewed-on: https://skia-review.googlesource.com/c/167405
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/skcms/skcms.cc | 21 | ||||
-rwxr-xr-x | third_party/skcms/version.sha1 | 2 |
2 files changed, 18 insertions, 5 deletions
diff --git a/third_party/skcms/skcms.cc b/third_party/skcms/skcms.cc index 2b1ca692cc..42315274b2 100644 --- a/third_party/skcms/skcms.cc +++ b/third_party/skcms/skcms.cc @@ -720,7 +720,10 @@ static bool read_tag_mab(const skcms_ICCTag* tag, skcms_A2B* a2b, bool pcs_is_xy return true; } -static int fit_linear(const skcms_Curve* curve, int N, float tol, float* c, float* d, float* f) { +// If you pass f, we'll fit a possibly-non-zero value for *f. +// If you pass nullptr, we'll assume you want *f to be treated as zero. +static int fit_linear(const skcms_Curve* curve, int N, float tol, + float* c, float* d, float* f = nullptr) { assert(N > 1); // We iteratively fit the first points to the TF's linear piece. // We want the cx + f line to pass through the first and last points we fit exactly. @@ -735,7 +738,14 @@ static int fit_linear(const skcms_Curve* curve, int N, float tol, float* c, floa const float dx = 1.0f / (N - 1); int lin_points = 1; - *f = eval_curve(curve, 0); + + float f_zero = 0.0f; + if (f) { + *f = eval_curve(curve, 0); + } else { + f = &f_zero; + } + float slope_min = -INFINITY_; float slope_max = +INFINITY_; @@ -797,7 +807,7 @@ static bool read_a2b(const skcms_ICCTag* tag, skcms_A2B* a2b, bool pcs_is_xyz) { if (curve && curve->table_entries && curve->table_entries <= (uint32_t)INT_MAX) { int N = (int)curve->table_entries; - float c,d,f; + float c = 0.0f, d = 0.0f, f = 0.0f; if (N == fit_linear(curve, N, 1.0f/(2*N), &c,&d,&f) && c == 1.0f && f == 0.0f) { @@ -1686,7 +1696,10 @@ bool skcms_ApproximateCurve(const skcms_Curve* curve, for (int t = 0; t < ARRAY_COUNT(kTolerances); t++) { skcms_TransferFunction tf, tf_inv; - int L = fit_linear(curve, N, kTolerances[t], &tf.c, &tf.d, &tf.f); + + // It's problematic to fit curves with non-zero f, so always force it to zero explicitly. + tf.f = 0.0f; + int L = fit_linear(curve, N, kTolerances[t], &tf.c, &tf.d); if (L == N) { // If the entire data set was linear, move the coefficients to the nonlinear portion diff --git a/third_party/skcms/version.sha1 b/third_party/skcms/version.sha1 index 0c4b949f63..c2606f5e4b 100755 --- a/third_party/skcms/version.sha1 +++ b/third_party/skcms/version.sha1 @@ -1 +1 @@ -1ce6da5c8d9968170297b81af2cbff48cc4b9919
\ No newline at end of file +26679709b32f0ec845b69fdb01ca312b24ee1ac3
\ No newline at end of file |