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

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

Issue 1456783005: Fix nearly-vertical gradient assert (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 | tests/GradientTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkLinearGradient.cpp
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index b60ee971f8fe6bae5d102668bfc034abaf3a92dc..7b2683c7bc9c4c9c9f7f8f7114b4b38e1f088a6b 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -892,7 +892,7 @@ void SkLinearGradient::LinearGradientContext::shade4_clamp(int x, int y, SkPMCol
const float dither[2] = { dither0, dither1 };
const float invDx = 1 / dx;
- if (!SkScalarIsFinite(invDx)) { // dx is effectively zero, gradient is vertical
+ if (SkScalarNearlyZero(dx)) { // gradient is vertical
Sk4f c = lerp_color(fx, find_forward(fRecs.begin(), SkTPin(fx, 0.0f, 1.0f)));
if (fApplyAlphaAfterInterp) {
fill<true>(dstC, count, c + dither0, c + dither1);
« no previous file with comments | « no previous file | tests/GradientTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698