aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/gradients
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-08-21 11:52:36 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-21 11:52:36 -0700
commit55de40b38c8771b6853dfef783d6eaa4ea495f23 (patch)
tree585a94fd6d41d83a403a89b27a27a1392093cfd6 /src/effects/gradients
parent7daaaa4425ea083df437eea95ba6b38315ce98ad (diff)
Does this fix things?
NOTREECHECKS=true CQ_EXTRA_TRYBOTS=tryserver.skia:Test-Win7-ShuttleA-HD2000-x86-Debug-Trybot BUG=skia: R=mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/492343002
Diffstat (limited to 'src/effects/gradients')
-rw-r--r--src/effects/gradients/SkGradientShader.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 502d73383a..c84e46a641 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -161,10 +161,11 @@ SkGradientShaderBase::SkGradientShaderBase(const Descriptor& desc)
curr = SkScalarPin(desc.fPos[i], 0, 1);
}
*origPosPtr++ = curr;
-
+
recs->fPos = SkScalarToFixed(curr);
- if (curr > prev) {
- recs->fScale = (1 << 24) / SkScalarToFixed(curr - prev);
+ SkFixed diff = SkScalarToFixed(curr - prev);
+ if (diff > 0) {
+ recs->fScale = (1 << 24) / diff;
} else {
recs->fScale = 0; // ignore this segment
}