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

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

Issue 1526523003: Unify some SkNx code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: typo Created 5 years 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/effects/gradients/SkLinearGradient.cpp ('k') | src/opts/SkColorCubeFilter_opts.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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 Sk4f R = sum_squares(fx4, fy4); 300 Sk4f R = sum_squares(fx4, fy4);
301 Sk4f dR = tmpxy + tmpxy + tmpdxdy; 301 Sk4f dR = tmpxy + tmpxy + tmpdxdy;
302 const Sk4f ddR = tmpdxdy + tmpdxdy; 302 const Sk4f ddR = tmpdxdy + tmpdxdy;
303 303
304 for (int i = 0; i < (count >> 2); ++i) { 304 for (int i = 0; i < (count >> 2); ++i) {
305 Sk4f dist = Sk4f::Min(fast_sqrt(R), max); 305 Sk4f dist = Sk4f::Min(fast_sqrt(R), max);
306 R = R + dR; 306 R = R + dR;
307 dR = dR + ddR; 307 dR = dR + ddR;
308 308
309 uint8_t fi[4]; 309 uint8_t fi[4];
310 dist.toBytes(fi); 310 SkNx_cast<uint8_t>(dist).store(fi);
311 311
312 for (int i = 0; i < 4; i++) { 312 for (int i = 0; i < 4; i++) {
313 *dstC++ = cache[toggle + fi[i]]; 313 *dstC++ = cache[toggle + fi[i]];
314 toggle = next_dither_toggle(toggle); 314 toggle = next_dither_toggle(toggle);
315 } 315 }
316 } 316 }
317 count &= 3; 317 count &= 3;
318 if (count) { 318 if (count) {
319 Sk4f dist = Sk4f::Min(fast_sqrt(R), max); 319 Sk4f dist = Sk4f::Min(fast_sqrt(R), max);
320 320
321 uint8_t fi[4]; 321 uint8_t fi[4];
322 dist.toBytes(fi); 322 SkNx_cast<uint8_t>(dist).store(fi);
323 for (int i = 0; i < count; i++) { 323 for (int i = 0; i < count; i++) {
324 *dstC++ = cache[toggle + fi[i]]; 324 *dstC++ = cache[toggle + fi[i]];
325 toggle = next_dither_toggle(toggle); 325 toggle = next_dither_toggle(toggle);
326 } 326 }
327 } 327 }
328 } 328 }
329 } 329 }
330 330
331 // Unrolling this loop doesn't seem to help (when float); we're stalling to 331 // Unrolling this loop doesn't seem to help (when float); we're stalling to
332 // get the results of the sqrt (?), and don't have enough extra registers to 332 // get the results of the sqrt (?), and don't have enough extra registers to
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 str->appendScalar(fCenter.fY); 551 str->appendScalar(fCenter.fY);
552 str->append(") radius: "); 552 str->append(") radius: ");
553 str->appendScalar(fRadius); 553 str->appendScalar(fRadius);
554 str->append(" "); 554 str->append(" ");
555 555
556 this->INHERITED::toString(str); 556 this->INHERITED::toString(str);
557 557
558 str->append(")"); 558 str->append(")");
559 } 559 }
560 #endif 560 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkLinearGradient.cpp ('k') | src/opts/SkColorCubeFilter_opts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698