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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 Sk4f tmpdxdy = sum_squares(dx4, dy4); | 299 Sk4f tmpdxdy = sum_squares(dx4, dy4); |
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 int fi[4]; | 309 uint8_t fi[4]; |
310 dist.castTrunc().store(fi); | 310 dist.toBytes(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 int fi[4]; | 321 uint8_t fi[4]; |
322 dist.castTrunc().store(fi); | 322 dist.toBytes(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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 str->appendScalar(fCenter.fY); | 545 str->appendScalar(fCenter.fY); |
546 str->append(") radius: "); | 546 str->append(") radius: "); |
547 str->appendScalar(fRadius); | 547 str->appendScalar(fRadius); |
548 str->append(" "); | 548 str->append(" "); |
549 | 549 |
550 this->INHERITED::toString(str); | 550 this->INHERITED::toString(str); |
551 | 551 |
552 str->append(")"); | 552 str->append(")"); |
553 } | 553 } |
554 #endif | 554 #endif |
OLD | NEW |