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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |