| 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 "SkRadialGradient_Table.h" | 10 #include "SkRadialGradient_Table.h" |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 *dstC++ = cache[toggle + (sqrt_table[fi] >> | 370 *dstC++ = cache[toggle + (sqrt_table[fi] >> |
| 371 SkGradientShaderBase::kSqrt32Shift)]; | 371 SkGradientShaderBase::kSqrt32Shift)]; |
| 372 toggle = next_dither_toggle(toggle); | 372 toggle = next_dither_toggle(toggle); |
| 373 fx += dx; | 373 fx += dx; |
| 374 fy += dy; | 374 fy += dy; |
| 375 } while (--count != 0); | 375 } while (--count != 0); |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 } | 378 } |
| 379 | 379 |
| 380 // TODO: can we get away with 0th approximatino of inverse-sqrt (i.e. faster tha
n rsqrt)? |
| 381 // seems like ~10bits is more than enough for our use, since we want a byt
e-index |
| 380 static inline Sk4f fast_sqrt(const Sk4f& R) { | 382 static inline Sk4f fast_sqrt(const Sk4f& R) { |
| 381 // R * R.rsqrt0() is much faster, but it's non-monotonic, which isn't so pre
tty for gradients. | 383 return R * R.rsqrt(); |
| 382 return R * R.rsqrt1(); | |
| 383 } | 384 } |
| 384 | 385 |
| 385 static inline Sk4f sum_squares(const Sk4f& a, const Sk4f& b) { | 386 static inline Sk4f sum_squares(const Sk4f& a, const Sk4f& b) { |
| 386 return a * a + b * b; | 387 return a * a + b * b; |
| 387 } | 388 } |
| 388 | 389 |
| 389 void shadeSpan_radial_clamp2(SkScalar sfx, SkScalar sdx, SkScalar sfy, SkScalar
sdy, | 390 void shadeSpan_radial_clamp2(SkScalar sfx, SkScalar sdx, SkScalar sfy, SkScalar
sdy, |
| 390 SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RE
STRICT cache, | 391 SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RE
STRICT cache, |
| 391 int count, int toggle) { | 392 int count, int toggle) { |
| 392 if (radial_completely_pinned(sfx, sdx, sfy, sdy)) { | 393 if (radial_completely_pinned(sfx, sdx, sfy, sdy)) { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 str->appendScalar(fCenter.fY); | 688 str->appendScalar(fCenter.fY); |
| 688 str->append(") radius: "); | 689 str->append(") radius: "); |
| 689 str->appendScalar(fRadius); | 690 str->appendScalar(fRadius); |
| 690 str->append(" "); | 691 str->append(" "); |
| 691 | 692 |
| 692 this->INHERITED::toString(str); | 693 this->INHERITED::toString(str); |
| 693 | 694 |
| 694 str->append(")"); | 695 str->append(")"); |
| 695 } | 696 } |
| 696 #endif | 697 #endif |
| OLD | NEW |