Remove SK_SUPPORT_LEGACY_GRADIENT_ALPHATRUNC dead code
The guard is no longer used in Chrome.
(https://chromium-review.googlesource.com/c/539715)
Change-Id: Ib78527a11002a2992af71adce4ed4b8261ed8ead
Reviewed-on: https://skia-review.googlesource.com/20281
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/src/shaders/gradients/SkLinearGradient.cpp b/src/shaders/gradients/SkLinearGradient.cpp
index e8a68f6..d6875ce 100644
--- a/src/shaders/gradients/SkLinearGradient.cpp
+++ b/src/shaders/gradients/SkLinearGradient.cpp
@@ -560,9 +560,6 @@
SkPMColor c;
Sk4f c4f255 = x;
if (apply_alpha) {
-#ifdef SK_SUPPORT_LEGACY_GRADIENT_ALPHATRUNC
- static constexpr float alphaScale = 1;
-#else
// Due to use of multiplication by the 1/255 reciprocal instead of division by 255,
// non-integer alpha values very close to their ceiling can push the color values
// above the alpha value, which will become an invalid premultiplied color. So nudge
@@ -572,7 +569,7 @@
// scaled by the alpha value, we need to scale the epsilon by 255 to get a safe
// upper bound on the error.
static constexpr float alphaScale = 1 + 255*std::numeric_limits<float>::epsilon();
-#endif
+
const float scale = x[SkPM4f::A] * (1 / 255.f);
c4f255 *= Sk4f(scale, scale, scale, alphaScale);
}