OLD | NEW |
1 /* NEON optimized code (C) COPYRIGHT 2009 Motorola | 1 /* NEON optimized code (C) COPYRIGHT 2009 Motorola |
2 * | 2 * |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 * Modifications done in-house at Motorola | 8 * Modifications done in-house at Motorola |
9 * | 9 * |
10 * this is a clone of SkBitmapProcState_matrix.h | 10 * this is a clone of SkBitmapProcState_matrix.h |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | | 58 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | |
59 SkMatrix::kScale_Mask)) == 0); | 59 SkMatrix::kScale_Mask)) == 0); |
60 | 60 |
61 PREAMBLE(s); | 61 PREAMBLE(s); |
62 // we store y, x, x, x, x, x | 62 // we store y, x, x, x, x, x |
63 | 63 |
64 const unsigned maxX = s.fBitmap->width() - 1; | 64 const unsigned maxX = s.fBitmap->width() - 1; |
65 SkFixed fx; | 65 SkFixed fx; |
66 { | 66 { |
67 SkPoint pt; | 67 SkPoint pt; |
68 s.fInvProc(*s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, | 68 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, |
69 SkIntToScalar(y) + SK_ScalarHalf, &pt); | 69 SkIntToScalar(y) + SK_ScalarHalf, &pt); |
70 fx = SkScalarToFixed(pt.fY); | 70 fx = SkScalarToFixed(pt.fY); |
71 const unsigned maxY = s.fBitmap->height() - 1; | 71 const unsigned maxY = s.fBitmap->height() - 1; |
72 *xy++ = TILEY_PROCF(fx, maxY); | 72 *xy++ = TILEY_PROCF(fx, maxY); |
73 fx = SkScalarToFixed(pt.fX); | 73 fx = SkScalarToFixed(pt.fX); |
74 } | 74 } |
75 | 75 |
76 if (0 == maxX) { | 76 if (0 == maxX) { |
77 // all of the following X values must be 0 | 77 // all of the following X values must be 0 |
78 memset(xy, 0, count * sizeof(uint16_t)); | 78 memset(xy, 0, count * sizeof(uint16_t)); |
79 return; | 79 return; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 static void AFFINE_NOFILTER_NAME(const SkBitmapProcState& s, | 161 static void AFFINE_NOFILTER_NAME(const SkBitmapProcState& s, |
162 uint32_t xy[], int count, int x, int y) { | 162 uint32_t xy[], int count, int x, int y) { |
163 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); | 163 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); |
164 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | | 164 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | |
165 SkMatrix::kScale_Mask | | 165 SkMatrix::kScale_Mask | |
166 SkMatrix::kAffine_Mask)) == 0); | 166 SkMatrix::kAffine_Mask)) == 0); |
167 | 167 |
168 PREAMBLE(s); | 168 PREAMBLE(s); |
169 SkPoint srcPt; | 169 SkPoint srcPt; |
170 s.fInvProc(*s.fInvMatrix, | 170 s.fInvProc(s.fInvMatrix, |
171 SkIntToScalar(x) + SK_ScalarHalf, | 171 SkIntToScalar(x) + SK_ScalarHalf, |
172 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); | 172 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); |
173 | 173 |
174 SkFixed fx = SkScalarToFixed(srcPt.fX); | 174 SkFixed fx = SkScalarToFixed(srcPt.fX); |
175 SkFixed fy = SkScalarToFixed(srcPt.fY); | 175 SkFixed fy = SkScalarToFixed(srcPt.fY); |
176 SkFixed dx = s.fInvSx; | 176 SkFixed dx = s.fInvSx; |
177 SkFixed dy = s.fInvKy; | 177 SkFixed dy = s.fInvKy; |
178 int maxX = s.fBitmap->width() - 1; | 178 int maxX = s.fBitmap->width() - 1; |
179 int maxY = s.fBitmap->height() - 1; | 179 int maxY = s.fBitmap->height() - 1; |
180 | 180 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 277 |
278 static void PERSP_NOFILTER_NAME(const SkBitmapProcState& s, | 278 static void PERSP_NOFILTER_NAME(const SkBitmapProcState& s, |
279 uint32_t* SK_RESTRICT xy, | 279 uint32_t* SK_RESTRICT xy, |
280 int count, int x, int y) { | 280 int count, int x, int y) { |
281 SkASSERT(s.fInvType & SkMatrix::kPerspective_Mask); | 281 SkASSERT(s.fInvType & SkMatrix::kPerspective_Mask); |
282 | 282 |
283 PREAMBLE(s); | 283 PREAMBLE(s); |
284 int maxX = s.fBitmap->width() - 1; | 284 int maxX = s.fBitmap->width() - 1; |
285 int maxY = s.fBitmap->height() - 1; | 285 int maxY = s.fBitmap->height() - 1; |
286 | 286 |
287 SkPerspIter iter(*s.fInvMatrix, | 287 SkPerspIter iter(s.fInvMatrix, |
288 SkIntToScalar(x) + SK_ScalarHalf, | 288 SkIntToScalar(x) + SK_ScalarHalf, |
289 SkIntToScalar(y) + SK_ScalarHalf, count); | 289 SkIntToScalar(y) + SK_ScalarHalf, count); |
290 | 290 |
291 while ((count = iter.next()) != 0) { | 291 while ((count = iter.next()) != 0) { |
292 const SkFixed* SK_RESTRICT srcXY = iter.getXY(); | 292 const SkFixed* SK_RESTRICT srcXY = iter.getXY(); |
293 | 293 |
294 /* RBE: */ | 294 /* RBE: */ |
295 /* TILEX_PROCF(fx, max) (((fx) & 0xFFFF) * ((max) + 1) >> 16) */ | 295 /* TILEX_PROCF(fx, max) (((fx) & 0xFFFF) * ((max) + 1) >> 16) */ |
296 /* it's a little more complicated than what I did for the | 296 /* it's a little more complicated than what I did for the |
297 * clamp case -- where I could immediately snip to the top | 297 * clamp case -- where I could immediately snip to the top |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 | 415 |
416 PREAMBLE(s); | 416 PREAMBLE(s); |
417 | 417 |
418 const unsigned maxX = s.fBitmap->width() - 1; | 418 const unsigned maxX = s.fBitmap->width() - 1; |
419 const SkFixed one = s.fFilterOneX; | 419 const SkFixed one = s.fFilterOneX; |
420 const SkFractionalInt dx = s.fInvSxFractionalInt; | 420 const SkFractionalInt dx = s.fInvSxFractionalInt; |
421 SkFractionalInt fx; | 421 SkFractionalInt fx; |
422 | 422 |
423 { | 423 { |
424 SkPoint pt; | 424 SkPoint pt; |
425 s.fInvProc(*s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, | 425 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, |
426 SkIntToScalar(y) + SK_ScalarHalf, &pt); | 426 SkIntToScalar(y) + SK_ScalarHalf, &pt); |
427 const SkFixed fy = SkScalarToFixed(pt.fY) - (s.fFilterOneY >> 1); | 427 const SkFixed fy = SkScalarToFixed(pt.fY) - (s.fFilterOneY >> 1); |
428 const unsigned maxY = s.fBitmap->height() - 1; | 428 const unsigned maxY = s.fBitmap->height() - 1; |
429 // compute our two Y values up front | 429 // compute our two Y values up front |
430 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y); | 430 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y); |
431 // now initialize fx | 431 // now initialize fx |
432 fx = SkScalarToFractionalInt(pt.fX) - (SkFixedToFractionalInt(one) >> 1)
; | 432 fx = SkScalarToFractionalInt(pt.fX) - (SkFixedToFractionalInt(one) >> 1)
; |
433 } | 433 } |
434 | 434 |
435 #ifdef CHECK_FOR_DECAL | 435 #ifdef CHECK_FOR_DECAL |
436 // test if we don't need to apply the tile proc | 436 // test if we don't need to apply the tile proc |
(...skipping 13 matching lines...) Expand all Loading... |
450 | 450 |
451 static void AFFINE_FILTER_NAME(const SkBitmapProcState& s, | 451 static void AFFINE_FILTER_NAME(const SkBitmapProcState& s, |
452 uint32_t xy[], int count, int x, int y) { | 452 uint32_t xy[], int count, int x, int y) { |
453 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); | 453 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); |
454 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | | 454 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | |
455 SkMatrix::kScale_Mask | | 455 SkMatrix::kScale_Mask | |
456 SkMatrix::kAffine_Mask)) == 0); | 456 SkMatrix::kAffine_Mask)) == 0); |
457 | 457 |
458 PREAMBLE(s); | 458 PREAMBLE(s); |
459 SkPoint srcPt; | 459 SkPoint srcPt; |
460 s.fInvProc(*s.fInvMatrix, | 460 s.fInvProc(s.fInvMatrix, |
461 SkIntToScalar(x) + SK_ScalarHalf, | 461 SkIntToScalar(x) + SK_ScalarHalf, |
462 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); | 462 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); |
463 | 463 |
464 SkFixed oneX = s.fFilterOneX; | 464 SkFixed oneX = s.fFilterOneX; |
465 SkFixed oneY = s.fFilterOneY; | 465 SkFixed oneY = s.fFilterOneY; |
466 SkFixed fx = SkScalarToFixed(srcPt.fX) - (oneX >> 1); | 466 SkFixed fx = SkScalarToFixed(srcPt.fX) - (oneX >> 1); |
467 SkFixed fy = SkScalarToFixed(srcPt.fY) - (oneY >> 1); | 467 SkFixed fy = SkScalarToFixed(srcPt.fY) - (oneY >> 1); |
468 SkFixed dx = s.fInvSx; | 468 SkFixed dx = s.fInvSx; |
469 SkFixed dy = s.fInvKy; | 469 SkFixed dy = s.fInvKy; |
470 unsigned maxX = s.fBitmap->width() - 1; | 470 unsigned maxX = s.fBitmap->width() - 1; |
(...skipping 15 matching lines...) Expand all Loading... |
486 extern void rbe(void); | 486 extern void rbe(void); |
487 | 487 |
488 PREAMBLE(s); | 488 PREAMBLE(s); |
489 unsigned maxX = s.fBitmap->width() - 1; | 489 unsigned maxX = s.fBitmap->width() - 1; |
490 unsigned maxY = s.fBitmap->height() - 1; | 490 unsigned maxY = s.fBitmap->height() - 1; |
491 SkFixed oneX = s.fFilterOneX; | 491 SkFixed oneX = s.fFilterOneX; |
492 SkFixed oneY = s.fFilterOneY; | 492 SkFixed oneY = s.fFilterOneY; |
493 | 493 |
494 | 494 |
495 | 495 |
496 SkPerspIter iter(*s.fInvMatrix, | 496 SkPerspIter iter(s.fInvMatrix, |
497 SkIntToScalar(x) + SK_ScalarHalf, | 497 SkIntToScalar(x) + SK_ScalarHalf, |
498 SkIntToScalar(y) + SK_ScalarHalf, count); | 498 SkIntToScalar(y) + SK_ScalarHalf, count); |
499 | 499 |
500 while ((count = iter.next()) != 0) { | 500 while ((count = iter.next()) != 0) { |
501 const SkFixed* SK_RESTRICT srcXY = iter.getXY(); | 501 const SkFixed* SK_RESTRICT srcXY = iter.getXY(); |
502 do { | 502 do { |
503 *xy++ = PACK_FILTER_Y_NAME(srcXY[1] - (oneY >> 1), maxY, | 503 *xy++ = PACK_FILTER_Y_NAME(srcXY[1] - (oneY >> 1), maxY, |
504 oneY PREAMBLE_ARG_Y); | 504 oneY PREAMBLE_ARG_Y); |
505 *xy++ = PACK_FILTER_X_NAME(srcXY[0] - (oneX >> 1), maxX, | 505 *xy++ = PACK_FILTER_X_NAME(srcXY[0] - (oneX >> 1), maxX, |
506 oneX PREAMBLE_ARG_X); | 506 oneX PREAMBLE_ARG_X); |
(...skipping 26 matching lines...) Expand all Loading... |
533 #undef PERSP_FILTER_NAME | 533 #undef PERSP_FILTER_NAME |
534 | 534 |
535 #undef PREAMBLE | 535 #undef PREAMBLE |
536 #undef PREAMBLE_PARAM_X | 536 #undef PREAMBLE_PARAM_X |
537 #undef PREAMBLE_PARAM_Y | 537 #undef PREAMBLE_PARAM_Y |
538 #undef PREAMBLE_ARG_X | 538 #undef PREAMBLE_ARG_X |
539 #undef PREAMBLE_ARG_Y | 539 #undef PREAMBLE_ARG_Y |
540 | 540 |
541 #undef TILEX_LOW_BITS | 541 #undef TILEX_LOW_BITS |
542 #undef TILEY_LOW_BITS | 542 #undef TILEY_LOW_BITS |
OLD | NEW |