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

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

Issue 1753133003: Fix SkRadialGradient center discontinuity (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: v2 Created 4 years, 10 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/SkRadialGradient.cpp
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index 466ae045a5bbb9c896dead805727ca646f8c6719..df55c2d9237fe94a51dbd94387a9a839c033b4f2 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -111,6 +111,7 @@ void shadeSpan_radial_clamp2(SkScalar sfx, SkScalar sdx, SkScalar sfy, SkScalar
cache[next_dither_toggle(toggle) + fi],
count);
} else {
+ const Sk4f min(SK_ScalarNearlyZero);
const Sk4f max(255);
const float scale = 255;
sfx *= scale;
@@ -124,13 +125,13 @@ void shadeSpan_radial_clamp2(SkScalar sfx, SkScalar sdx, SkScalar sfy, SkScalar
Sk4f tmpxy = fx4 * dx4 + fy4 * dy4;
Sk4f tmpdxdy = sum_squares(dx4, dy4);
- Sk4f R = sum_squares(fx4, fy4);
+ Sk4f R = Sk4f::Max(sum_squares(fx4, fy4), min);
Sk4f dR = tmpxy + tmpxy + tmpdxdy;
const Sk4f ddR = tmpdxdy + tmpdxdy;
for (int i = 0; i < (count >> 2); ++i) {
Sk4f dist = Sk4f::Min(fast_sqrt(R), max);
- R = R + dR;
+ R = Sk4f::Max(R + dR, min);
dR = dR + ddR;
uint8_t fi[4];
« 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