| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 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 | 9 |
| 10 #include "SkBlitRow.h" | 10 #include "SkBlitRow.h" |
| 11 #include "SkCoreBlitters.h" | 11 #include "SkCoreBlitters.h" |
| 12 #include "SkColorPriv.h" | 12 #include "SkColorPriv.h" |
| 13 #include "SkDither.h" | 13 #include "SkDither.h" |
| 14 #include "SkShader.h" | 14 #include "SkShader.h" |
| 15 #include "SkUtils.h" | 15 #include "SkUtils.h" |
| 16 #include "SkUtilsArm.h" | 16 #include "SkUtilsArm.h" |
| 17 #include "SkXfermode.h" | 17 #include "SkXfermode.h" |
| 18 | 18 |
| 19 #if SK_MIPS_HAS_DSP |
| 20 extern void blitmask_d565_opaque_mips(int width, int height, uint16_t* device, |
| 21 unsigned deviceRB, const uint8_t* alpha, |
| 22 uint32_t expanded32, unsigned maskRB); |
| 23 #endif |
| 24 |
| 19 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) | 25 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) |
| 20 #include <arm_neon.h> | 26 #include <arm_neon.h> |
| 21 #else | 27 #else |
| 22 // if we don't have neon, then our black blitter is worth the extra code | 28 // if we don't have neon, then our black blitter is worth the extra code |
| 23 #define USE_BLACK_BLITTER | 29 #define USE_BLACK_BLITTER |
| 24 #endif | 30 #endif |
| 25 | 31 |
| 26 void sk_dither_memset16(uint16_t dst[], uint16_t value, uint16_t other, | 32 void sk_dither_memset16(uint16_t dst[], uint16_t value, uint16_t other, |
| 27 int count) { | 33 int count) { |
| 28 if (count > 0) { | 34 if (count > 0) { |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 if (mask & 0x01) dst[7] = color; \ | 367 if (mask & 0x01) dst[7] = color; \ |
| 362 } while (0) | 368 } while (0) |
| 363 | 369 |
| 364 #define SK_BLITBWMASK_NAME SkRGB16_BlitBW | 370 #define SK_BLITBWMASK_NAME SkRGB16_BlitBW |
| 365 #define SK_BLITBWMASK_ARGS , uint16_t color | 371 #define SK_BLITBWMASK_ARGS , uint16_t color |
| 366 #define SK_BLITBWMASK_BLIT8(mask, dst) solid_8_pixels(mask, dst, color) | 372 #define SK_BLITBWMASK_BLIT8(mask, dst) solid_8_pixels(mask, dst, color) |
| 367 #define SK_BLITBWMASK_GETADDR getAddr16 | 373 #define SK_BLITBWMASK_GETADDR getAddr16 |
| 368 #define SK_BLITBWMASK_DEVTYPE uint16_t | 374 #define SK_BLITBWMASK_DEVTYPE uint16_t |
| 369 #include "SkBlitBWMaskTemplate.h" | 375 #include "SkBlitBWMaskTemplate.h" |
| 370 | 376 |
| 377 #if !defined(SK_MIPS_HAS_DSP) |
| 371 static U16CPU blend_compact(uint32_t src32, uint32_t dst32, unsigned scale5) { | 378 static U16CPU blend_compact(uint32_t src32, uint32_t dst32, unsigned scale5) { |
| 372 return SkCompact_rgb_16(dst32 + ((src32 - dst32) * scale5 >> 5)); | 379 return SkCompact_rgb_16(dst32 + ((src32 - dst32) * scale5 >> 5)); |
| 373 } | 380 } |
| 381 #endif |
| 374 | 382 |
| 375 void SkRGB16_Opaque_Blitter::blitMask(const SkMask& mask, | 383 void SkRGB16_Opaque_Blitter::blitMask(const SkMask& mask, |
| 376 const SkIRect& clip) { | 384 const SkIRect& clip) { |
| 377 if (mask.fFormat == SkMask::kBW_Format) { | 385 if (mask.fFormat == SkMask::kBW_Format) { |
| 378 SkRGB16_BlitBW(fDevice, mask, clip, fColor16); | 386 SkRGB16_BlitBW(fDevice, mask, clip, fColor16); |
| 379 return; | 387 return; |
| 380 } | 388 } |
| 381 | 389 |
| 382 uint16_t* SK_RESTRICT device = fDevice.getAddr16(clip.fLeft, clip.fTop); | 390 uint16_t* SK_RESTRICT device = fDevice.getAddr16(clip.fLeft, clip.fTop); |
| 383 const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop); | 391 const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 while (w > 0) { | 458 while (w > 0) { |
| 451 *device = blend_compact(expanded32, SkExpand_rgb_16(*device), | 459 *device = blend_compact(expanded32, SkExpand_rgb_16(*device), |
| 452 SkAlpha255To256(*alpha++) >> 3); | 460 SkAlpha255To256(*alpha++) >> 3); |
| 453 device += 1; | 461 device += 1; |
| 454 --w; | 462 --w; |
| 455 } | 463 } |
| 456 device = (uint16_t*)((char*)device + deviceRB); | 464 device = (uint16_t*)((char*)device + deviceRB); |
| 457 alpha += maskRB; | 465 alpha += maskRB; |
| 458 } while (--height != 0); | 466 } while (--height != 0); |
| 459 #undef UNROLL | 467 #undef UNROLL |
| 468 #elif SK_MIPS_HAS_DSP |
| 469 blitmask_d565_opaque_mips(width, height, device, deviceRB, alpha, expanded32
, maskRB); |
| 460 #else // non-neon code | 470 #else // non-neon code |
| 461 do { | 471 do { |
| 462 int w = width; | 472 int w = width; |
| 463 do { | 473 do { |
| 464 *device = blend_compact(expanded32, SkExpand_rgb_16(*device), | 474 *device = blend_compact(expanded32, SkExpand_rgb_16(*device), |
| 465 SkAlpha255To256(*alpha++) >> 3); | 475 SkAlpha255To256(*alpha++) >> 3); |
| 466 device += 1; | 476 device += 1; |
| 467 } while (--w != 0); | 477 } while (--w != 0); |
| 468 device = (uint16_t*)((char*)device + deviceRB); | 478 device = (uint16_t*)((char*)device + deviceRB); |
| 469 alpha += maskRB; | 479 alpha += maskRB; |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 #endif | 1060 #endif |
| 1051 } else if (0xFF == SkColorGetA(color)) { | 1061 } else if (0xFF == SkColorGetA(color)) { |
| 1052 blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint); | 1062 blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint); |
| 1053 } else { | 1063 } else { |
| 1054 blitter = allocator->createT<SkRGB16_Blitter>(device, paint); | 1064 blitter = allocator->createT<SkRGB16_Blitter>(device, paint); |
| 1055 } | 1065 } |
| 1056 } | 1066 } |
| 1057 | 1067 |
| 1058 return blitter; | 1068 return blitter; |
| 1059 } | 1069 } |
| OLD | NEW |