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

Side by Side Diff: src/effects/gradients/SkRadialGradient.cpp

Issue 1109913002: Split rsqrt into rsqrt{0,1,2}, with increasing cost and precision on ARM (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: arm64 typos Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/core/SkNx.h ('k') | src/opts/SkNx_neon.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
382 static inline Sk4f fast_sqrt(const Sk4f& R) { 380 static inline Sk4f fast_sqrt(const Sk4f& R) {
383 return R * R.rsqrt(); 381 // R * R.rsqrt0() is much faster, but it's non-monotonic, which isn't so pre tty for gradients.
382 return R * R.rsqrt1();
384 } 383 }
385 384
386 static inline Sk4f sum_squares(const Sk4f& a, const Sk4f& b) { 385 static inline Sk4f sum_squares(const Sk4f& a, const Sk4f& b) {
387 return a * a + b * b; 386 return a * a + b * b;
388 } 387 }
389 388
390 void shadeSpan_radial_clamp2(SkScalar sfx, SkScalar sdx, SkScalar sfy, SkScalar sdy, 389 void shadeSpan_radial_clamp2(SkScalar sfx, SkScalar sdx, SkScalar sfy, SkScalar sdy,
391 SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RE STRICT cache, 390 SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RE STRICT cache,
392 int count, int toggle) { 391 int count, int toggle) {
393 if (radial_completely_pinned(sfx, sdx, sfy, sdy)) { 392 if (radial_completely_pinned(sfx, sdx, sfy, sdy)) {
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 str->appendScalar(fCenter.fY); 687 str->appendScalar(fCenter.fY);
689 str->append(") radius: "); 688 str->append(") radius: ");
690 str->appendScalar(fRadius); 689 str->appendScalar(fRadius);
691 str->append(" "); 690 str->append(" ");
692 691
693 this->INHERITED::toString(str); 692 this->INHERITED::toString(str);
694 693
695 str->append(")"); 694 str->append(")");
696 } 695 }
697 #endif 696 #endif
OLDNEW
« no previous file with comments | « src/core/SkNx.h ('k') | src/opts/SkNx_neon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698