Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(786)

Unified Diff: src/effects/gradients/SkGradientShader.cpp

Issue 492343002: Does this fix things? (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkGradientShader.cpp
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 502d73383af2b3e7b5744cf8ad715f2132281c4f..c84e46a641f21ae16c41a29609db4546af096bd7 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
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698