| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "SkRadialGradient.h" | 9 #include "SkRadialGradient.h" |
| 10 #include "SkNx.h" | 10 #include "SkNx.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 bool yClamped = (fy >= 1 && dy >= 0) || (fy <= -1 && dy <= 0); | 87 bool yClamped = (fy >= 1 && dy >= 0) || (fy <= -1 && dy <= 0); |
| 88 return xClamped || yClamped; | 88 return xClamped || yClamped; |
| 89 } | 89 } |
| 90 | 90 |
| 91 typedef void (* RadialShadeProc)(SkScalar sfx, SkScalar sdx, | 91 typedef void (* RadialShadeProc)(SkScalar sfx, SkScalar sdx, |
| 92 SkScalar sfy, SkScalar sdy, | 92 SkScalar sfy, SkScalar sdy, |
| 93 SkPMColor* dstC, const SkPMColor* cache, | 93 SkPMColor* dstC, const SkPMColor* cache, |
| 94 int count, int toggle); | 94 int count, int toggle); |
| 95 | 95 |
| 96 static inline Sk4f fast_sqrt(const Sk4f& R) { | 96 static inline Sk4f fast_sqrt(const Sk4f& R) { |
| 97 // R * R.rsqrt0() is much faster, but it's non-monotonic, which isn't so pre
tty for gradients. | 97 return R * R.rsqrt(); |
| 98 return R * R.rsqrt1(); | |
| 99 } | 98 } |
| 100 | 99 |
| 101 static inline Sk4f sum_squares(const Sk4f& a, const Sk4f& b) { | 100 static inline Sk4f sum_squares(const Sk4f& a, const Sk4f& b) { |
| 102 return a * a + b * b; | 101 return a * a + b * b; |
| 103 } | 102 } |
| 104 | 103 |
| 105 void shadeSpan_radial_clamp2(SkScalar sfx, SkScalar sdx, SkScalar sfy, SkScalar
sdy, | 104 void shadeSpan_radial_clamp2(SkScalar sfx, SkScalar sdx, SkScalar sfy, SkScalar
sdy, |
| 106 SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RE
STRICT cache, | 105 SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RE
STRICT cache, |
| 107 int count, int toggle) { | 106 int count, int toggle) { |
| 108 if (radial_completely_pinned(sfx, sdx, sfy, sdy)) { | 107 if (radial_completely_pinned(sfx, sdx, sfy, sdy)) { |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 str->appendScalar(fCenter.fY); | 375 str->appendScalar(fCenter.fY); |
| 377 str->append(") radius: "); | 376 str->append(") radius: "); |
| 378 str->appendScalar(fRadius); | 377 str->appendScalar(fRadius); |
| 379 str->append(" "); | 378 str->append(" "); |
| 380 | 379 |
| 381 this->INHERITED::toString(str); | 380 this->INHERITED::toString(str); |
| 382 | 381 |
| 383 str->append(")"); | 382 str->append(")"); |
| 384 } | 383 } |
| 385 #endif | 384 #endif |
| OLD | NEW |