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

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

Issue 1767163003: Use float rather than SkFixed for gradient TileProcs. (Closed) Base URL: https://skia.googlesource.com/skia@scalar-pin-to-fixed
Patch Set: Created 4 years, 9 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 | « src/effects/gradients/SkLinearGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient.h » ('j') | 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 d175f238cd60a9ac67b97eda59fc3587f1718944..ad92b5659beae5321389f992ac3cea4cae3a65f8 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -12,11 +12,11 @@
namespace {
// GCC doesn't like using static functions as template arguments. So force these to be non-static.
-inline SkFixed mirror_tileproc_nonstatic(SkFixed x) {
+inline unsigned mirror_tileproc_nonstatic(float x) {
return mirror_tileproc(x);
}
-inline SkFixed repeat_tileproc_nonstatic(SkFixed x) {
+inline unsigned repeat_tileproc_nonstatic(float x) {
return repeat_tileproc(x);
}
@@ -159,12 +159,12 @@ void shadeSpan_radial_clamp2(SkScalar sfx, SkScalar sdx, SkScalar sfy, SkScalar
// Unrolling this loop doesn't seem to help (when float); we're stalling to
// get the results of the sqrt (?), and don't have enough extra registers to
// have many in flight.
-template <SkFixed (*TileProc)(SkFixed)>
+template <unsigned (*TileProc)(float)>
void shadeSpan_radial(SkScalar fx, SkScalar dx, SkScalar fy, SkScalar dy,
SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RESTRICT cache,
int count, int toggle) {
do {
- const SkFixed dist = SkFloatToFixed(sk_float_sqrt(fx*fx + fy*fy));
+ const float dist = sk_float_sqrt(fx*fx + fy*fy);
const unsigned fi = TileProc(dist);
SkASSERT(fi <= 0xFFFF);
*dstC++ = cache[toggle + (fi >> SkGradientShaderBase::kCache32Shift)];
@@ -228,7 +228,7 @@ void SkRadialGradient::RadialGradientContext::shadeSpan(int x, int y,
SkScalar dstY = SkIntToScalar(y);
do {
dstProc(fDstToIndex, dstX, dstY, &srcPt);
- unsigned fi = proc(SkScalarToFixed(srcPt.length()));
+ unsigned fi = proc(SkScalarToFloat(srcPt.length()));
SkASSERT(fi <= 0xFFFF);
*dstC++ = cache[fi >> SkGradientShaderBase::kCache32Shift];
dstX += SK_Scalar1;
« no previous file with comments | « src/effects/gradients/SkLinearGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698