From faa8dc5be4452ffc0e189e44734c075652158d7d Mon Sep 17 00:00:00 2001 From: Derek Sollenberger Date: Fri, 21 Sep 2012 11:22:57 -0400 Subject: Reduce tolerance for going into our fast path for gradients. bug: 6897797 Change-Id: If7bce42f5347bc78f10c55d5041389b983813c2a --- src/effects/SkGradientShader.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/effects/SkGradientShader.cpp b/src/effects/SkGradientShader.cpp index 4bbc96c..24ed445 100644 --- a/src/effects/SkGradientShader.cpp +++ b/src/effects/SkGradientShader.cpp @@ -1046,7 +1046,9 @@ void Linear_Gradient::shadeSpan(int x, int y, SkPMColor* SK_RESTRICT dstC, } LinearShadeProc shadeProc = shadeSpan_linear_repeat; - if (SkFixedNearlyZero(dx)) { + // We really should check the endpoint colors, but short of that change + // we reduce the tolerance of SkFixedNearlyZero to be more restrictive. + if (SkFixedNearlyZero(dx, (SK_Fixed1 >> 14))) { #ifdef SK_SIMPLE_TWOCOLOR_VERTICAL_GRADIENTS if (fColorCount > 2) { shadeProc = shadeSpan_linear_vertical_lerp; -- cgit v1.1