From 60f1d83f65df16defe516ad41b76584da5aa6fea Mon Sep 17 00:00:00 2001 From: "skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com" Date: Fri, 27 Jul 2018 14:43:30 +0000 Subject: Roll skia/third_party/skcms 4642d9fe69e1..23e7777f421d (1 commits) https://skia.googlesource.com/skcms.git/+log/4642d9fe69e1..23e7777f421d 2018-07-27 mtklein@google.com clamp before premul The AutoRoll server is located here: https://skcms-skia-roll.skia.org 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=benjaminwagner@google.com Change-Id: Ia9898102aae04ad07057e1a5af1de8ad108d9631 Reviewed-on: https://skia-review.googlesource.com/143735 Reviewed-by: skcms-skia-autoroll Commit-Queue: skcms-skia-autoroll --- third_party/skcms/skcms.cc | 12 +++++++++--- third_party/skcms/version.sha1 | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/third_party/skcms/skcms.cc b/third_party/skcms/skcms.cc index e81f94919a..0a820629ad 100644 --- a/third_party/skcms/skcms.cc +++ b/third_party/skcms/skcms.cc @@ -2285,6 +2285,15 @@ bool skcms_Transform(const void* src, if (!is_identity_tf(&inv_dst_tf_b)) { *ops++ = Op_tf_b; *args++ = &inv_dst_tf_b; } } + // Clamp here before premul to make sure we're clamping to fixed-point values _and_ gamut, + // not just to values that fit in the fixed point representation. + // + // E.g. r = 1.1, a = 0.5 would fit fine in fixed point after premul (ra=0.55,a=0.5), + // but would be carrying r > 1, which is really unexpected for downstream consumers. + // TODO(mtklein): add a unit test + if (dstFmt < skcms_PixelFormat_RGB_hhh) { + *ops++ = Op_clamp; + } if (dstAlpha == skcms_AlphaFormat_Opaque) { *ops++ = Op_force_opaque; } else if (dstAlpha == skcms_AlphaFormat_PremulAsEncoded) { @@ -2293,9 +2302,6 @@ bool skcms_Transform(const void* src, if (dstFmt & 1) { *ops++ = Op_swap_rb; } - if (dstFmt < skcms_PixelFormat_RGB_hhh) { - *ops++ = Op_clamp; - } switch (dstFmt >> 1) { default: return false; case skcms_PixelFormat_A_8 >> 1: *ops++ = Op_store_a8; break; diff --git a/third_party/skcms/version.sha1 b/third_party/skcms/version.sha1 index 7aabdabaf9..746a312baf 100755 --- a/third_party/skcms/version.sha1 +++ b/third_party/skcms/version.sha1 @@ -1 +1 @@ -4642d9fe69e1ace1bb565a39f38fea9f776d8adb \ No newline at end of file +23e7777f421d11992e8245771641141aa273556b \ No newline at end of file -- cgit v1.2.3