OLD | NEW |
| 1 /* |
| 2 * Copyright 2008 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 // The copyright below was added in 2009, but I see no record of moto contributi
ons...? |
| 9 |
1 /* NEON optimized code (C) COPYRIGHT 2009 Motorola | 10 /* NEON optimized code (C) COPYRIGHT 2009 Motorola |
2 * | 11 * |
3 * Use of this source code is governed by a BSD-style license that can be | 12 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 13 * found in the LICENSE file. |
5 */ | 14 */ |
6 | 15 |
7 #include "SkBitmapProcState.h" | 16 #include "SkBitmapProcState.h" |
8 #include "SkPerspIter.h" | 17 #include "SkPerspIter.h" |
9 #include "SkShader.h" | 18 #include "SkShader.h" |
10 #include "SkUtils.h" | 19 #include "SkUtils.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 } | 323 } |
315 #endif | 324 #endif |
316 } | 325 } |
317 | 326 |
318 static int nofilter_trans_preamble(const SkBitmapProcState& s, uint32_t** xy, | 327 static int nofilter_trans_preamble(const SkBitmapProcState& s, uint32_t** xy, |
319 int x, int y) { | 328 int x, int y) { |
320 SkPoint pt; | 329 SkPoint pt; |
321 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, | 330 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, |
322 SkIntToScalar(y) + SK_ScalarHalf, &pt); | 331 SkIntToScalar(y) + SK_ScalarHalf, &pt); |
323 **xy = s.fIntTileProcY(SkScalarToFixed(pt.fY) >> 16, | 332 **xy = s.fIntTileProcY(SkScalarToFixed(pt.fY) >> 16, |
324 s.fBitmap->height()); | 333 s.fPixmap.height()); |
325 *xy += 1; // bump the ptr | 334 *xy += 1; // bump the ptr |
326 // return our starting X position | 335 // return our starting X position |
327 return SkScalarToFixed(pt.fX) >> 16; | 336 return SkScalarToFixed(pt.fX) >> 16; |
328 } | 337 } |
329 | 338 |
330 static void clampx_nofilter_trans(const SkBitmapProcState& s, | 339 static void clampx_nofilter_trans(const SkBitmapProcState& s, |
331 uint32_t xy[], int count, int x, int y) { | 340 uint32_t xy[], int count, int x, int y) { |
332 SkASSERT((s.fInvType & ~SkMatrix::kTranslate_Mask) == 0); | 341 SkASSERT((s.fInvType & ~SkMatrix::kTranslate_Mask) == 0); |
333 | 342 |
334 int xpos = nofilter_trans_preamble(s, &xy, x, y); | 343 int xpos = nofilter_trans_preamble(s, &xy, x, y); |
335 const int width = s.fBitmap->width(); | 344 const int width = s.fPixmap.width(); |
336 if (1 == width) { | 345 if (1 == width) { |
337 // all of the following X values must be 0 | 346 // all of the following X values must be 0 |
338 memset(xy, 0, count * sizeof(uint16_t)); | 347 memset(xy, 0, count * sizeof(uint16_t)); |
339 return; | 348 return; |
340 } | 349 } |
341 | 350 |
342 uint16_t* xptr = reinterpret_cast<uint16_t*>(xy); | 351 uint16_t* xptr = reinterpret_cast<uint16_t*>(xy); |
343 int n; | 352 int n; |
344 | 353 |
345 // fill before 0 as needed | 354 // fill before 0 as needed |
(...skipping 27 matching lines...) Expand all Loading... |
373 | 382 |
374 // fill the remaining with the max value | 383 // fill the remaining with the max value |
375 sk_memset16(xptr, width - 1, count); | 384 sk_memset16(xptr, width - 1, count); |
376 } | 385 } |
377 | 386 |
378 static void repeatx_nofilter_trans(const SkBitmapProcState& s, | 387 static void repeatx_nofilter_trans(const SkBitmapProcState& s, |
379 uint32_t xy[], int count, int x, int y) { | 388 uint32_t xy[], int count, int x, int y) { |
380 SkASSERT((s.fInvType & ~SkMatrix::kTranslate_Mask) == 0); | 389 SkASSERT((s.fInvType & ~SkMatrix::kTranslate_Mask) == 0); |
381 | 390 |
382 int xpos = nofilter_trans_preamble(s, &xy, x, y); | 391 int xpos = nofilter_trans_preamble(s, &xy, x, y); |
383 const int width = s.fBitmap->width(); | 392 const int width = s.fPixmap.width(); |
384 if (1 == width) { | 393 if (1 == width) { |
385 // all of the following X values must be 0 | 394 // all of the following X values must be 0 |
386 memset(xy, 0, count * sizeof(uint16_t)); | 395 memset(xy, 0, count * sizeof(uint16_t)); |
387 return; | 396 return; |
388 } | 397 } |
389 | 398 |
390 uint16_t* xptr = reinterpret_cast<uint16_t*>(xy); | 399 uint16_t* xptr = reinterpret_cast<uint16_t*>(xy); |
391 int start = sk_int_mod(xpos, width); | 400 int start = sk_int_mod(xpos, width); |
392 int n = width - start; | 401 int n = width - start; |
393 if (n > count) { | 402 if (n > count) { |
(...skipping 19 matching lines...) Expand all Loading... |
413 SkASSERT(pos >= 0); | 422 SkASSERT(pos >= 0); |
414 xptr[i] = pos--; | 423 xptr[i] = pos--; |
415 } | 424 } |
416 } | 425 } |
417 | 426 |
418 static void mirrorx_nofilter_trans(const SkBitmapProcState& s, | 427 static void mirrorx_nofilter_trans(const SkBitmapProcState& s, |
419 uint32_t xy[], int count, int x, int y) { | 428 uint32_t xy[], int count, int x, int y) { |
420 SkASSERT((s.fInvType & ~SkMatrix::kTranslate_Mask) == 0); | 429 SkASSERT((s.fInvType & ~SkMatrix::kTranslate_Mask) == 0); |
421 | 430 |
422 int xpos = nofilter_trans_preamble(s, &xy, x, y); | 431 int xpos = nofilter_trans_preamble(s, &xy, x, y); |
423 const int width = s.fBitmap->width(); | 432 const int width = s.fPixmap.width(); |
424 if (1 == width) { | 433 if (1 == width) { |
425 // all of the following X values must be 0 | 434 // all of the following X values must be 0 |
426 memset(xy, 0, count * sizeof(uint16_t)); | 435 memset(xy, 0, count * sizeof(uint16_t)); |
427 return; | 436 return; |
428 } | 437 } |
429 | 438 |
430 uint16_t* xptr = reinterpret_cast<uint16_t*>(xy); | 439 uint16_t* xptr = reinterpret_cast<uint16_t*>(xy); |
431 // need to know our start, and our initial phase (forward or backward) | 440 // need to know our start, and our initial phase (forward or backward) |
432 bool forward; | 441 bool forward; |
433 int n; | 442 int n; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 } | 509 } |
501 | 510 |
502 if (SkShader::kClamp_TileMode == fTileModeX && SkShader::kClamp_TileMode ==
fTileModeY) { | 511 if (SkShader::kClamp_TileMode == fTileModeX && SkShader::kClamp_TileMode ==
fTileModeY) { |
503 // clamp gets special version of filterOne | 512 // clamp gets special version of filterOne |
504 fFilterOneX = SK_Fixed1; | 513 fFilterOneX = SK_Fixed1; |
505 fFilterOneY = SK_Fixed1; | 514 fFilterOneY = SK_Fixed1; |
506 return SK_ARM_NEON_WRAP(ClampX_ClampY_Procs)[index]; | 515 return SK_ARM_NEON_WRAP(ClampX_ClampY_Procs)[index]; |
507 } | 516 } |
508 | 517 |
509 // all remaining procs use this form for filterOne | 518 // all remaining procs use this form for filterOne |
510 fFilterOneX = SK_Fixed1 / fBitmap->width(); | 519 fFilterOneX = SK_Fixed1 / fPixmap.width(); |
511 fFilterOneY = SK_Fixed1 / fBitmap->height(); | 520 fFilterOneY = SK_Fixed1 / fPixmap.height(); |
512 | 521 |
513 if (SkShader::kRepeat_TileMode == fTileModeX && SkShader::kRepeat_TileMode =
= fTileModeY) { | 522 if (SkShader::kRepeat_TileMode == fTileModeX && SkShader::kRepeat_TileMode =
= fTileModeY) { |
514 return SK_ARM_NEON_WRAP(RepeatX_RepeatY_Procs)[index]; | 523 return SK_ARM_NEON_WRAP(RepeatX_RepeatY_Procs)[index]; |
515 } | 524 } |
516 | 525 |
517 fTileProcX = choose_tile_proc(fTileModeX); | 526 fTileProcX = choose_tile_proc(fTileModeX); |
518 fTileProcY = choose_tile_proc(fTileModeY); | 527 fTileProcY = choose_tile_proc(fTileModeY); |
519 fTileLowBitsProcX = choose_tile_lowbits_proc(fTileModeX); | 528 fTileLowBitsProcX = choose_tile_lowbits_proc(fTileModeX); |
520 fTileLowBitsProcY = choose_tile_lowbits_proc(fTileModeY); | 529 fTileLowBitsProcY = choose_tile_lowbits_proc(fTileModeY); |
521 return GeneralXY_Procs[index]; | 530 return GeneralXY_Procs[index]; |
522 } | 531 } |
OLD | NEW |