| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkBlitRow.h" | 8 #include "SkBlitRow.h" |
| 9 #include "SkCoreBlitters.h" | 9 #include "SkCoreBlitters.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| 11 #include "SkDither.h" | 11 #include "SkDither.h" |
| 12 #include "SkShader.h" | 12 #include "SkShader.h" |
| 13 #include "SkUtils.h" | 13 #include "SkUtils.h" |
| 14 #include "SkUtilsArm.h" | 14 #include "SkUtilsArm.h" |
| 15 #include "SkXfermode.h" | 15 #include "SkXfermode.h" |
| 16 | 16 |
| 17 #if SK_MIPS_HAS_DSP | 17 #if defined(__mips_dsp) |
| 18 extern void blitmask_d565_opaque_mips(int width, int height, uint16_t* device, | 18 extern void blitmask_d565_opaque_mips(int width, int height, uint16_t* device, |
| 19 unsigned deviceRB, const uint8_t* alpha, | 19 unsigned deviceRB, const uint8_t* alpha, |
| 20 uint32_t expanded32, unsigned maskRB); | 20 uint32_t expanded32, unsigned maskRB); |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) | 23 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) |
| 24 #include <arm_neon.h> | 24 #include <arm_neon.h> |
| 25 extern void SkRGB16BlitterBlitV_neon(uint16_t* device, | 25 extern void SkRGB16BlitterBlitV_neon(uint16_t* device, |
| 26 int height, | 26 int height, |
| 27 size_t deviceRB, | 27 size_t deviceRB, |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 if (mask & 0x01) dst[7] = color; \ | 367 if (mask & 0x01) dst[7] = color; \ |
| 368 } while (0) | 368 } while (0) |
| 369 | 369 |
| 370 #define SK_BLITBWMASK_NAME SkRGB16_BlitBW | 370 #define SK_BLITBWMASK_NAME SkRGB16_BlitBW |
| 371 #define SK_BLITBWMASK_ARGS , uint16_t color | 371 #define SK_BLITBWMASK_ARGS , uint16_t color |
| 372 #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) |
| 373 #define SK_BLITBWMASK_GETADDR writable_addr16 | 373 #define SK_BLITBWMASK_GETADDR writable_addr16 |
| 374 #define SK_BLITBWMASK_DEVTYPE uint16_t | 374 #define SK_BLITBWMASK_DEVTYPE uint16_t |
| 375 #include "SkBlitBWMaskTemplate.h" | 375 #include "SkBlitBWMaskTemplate.h" |
| 376 | 376 |
| 377 #if !defined(SK_MIPS_HAS_DSP) | 377 #if !defined(__mips_dsp) |
| 378 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) { |
| 379 return SkCompact_rgb_16(dst32 + ((src32 - dst32) * scale5 >> 5)); | 379 return SkCompact_rgb_16(dst32 + ((src32 - dst32) * scale5 >> 5)); |
| 380 } | 380 } |
| 381 #endif | 381 #endif |
| 382 | 382 |
| 383 void SkRGB16_Opaque_Blitter::blitMask(const SkMask& mask, | 383 void SkRGB16_Opaque_Blitter::blitMask(const SkMask& mask, |
| 384 const SkIRect& clip) { | 384 const SkIRect& clip) { |
| 385 if (mask.fFormat == SkMask::kBW_Format) { | 385 if (mask.fFormat == SkMask::kBW_Format) { |
| 386 SkRGB16_BlitBW(fDevice, mask, clip, fColor16); | 386 SkRGB16_BlitBW(fDevice, mask, clip, fColor16); |
| 387 return; | 387 return; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 while (w > 0) { | 458 while (w > 0) { |
| 459 *device = blend_compact(expanded32, SkExpand_rgb_16(*device), | 459 *device = blend_compact(expanded32, SkExpand_rgb_16(*device), |
| 460 SkAlpha255To256(*alpha++) >> 3); | 460 SkAlpha255To256(*alpha++) >> 3); |
| 461 device += 1; | 461 device += 1; |
| 462 --w; | 462 --w; |
| 463 } | 463 } |
| 464 device = (uint16_t*)((char*)device + deviceRB); | 464 device = (uint16_t*)((char*)device + deviceRB); |
| 465 alpha += maskRB; | 465 alpha += maskRB; |
| 466 } while (--height != 0); | 466 } while (--height != 0); |
| 467 #undef UNROLL | 467 #undef UNROLL |
| 468 #elif SK_MIPS_HAS_DSP | 468 #elif defined(__mips_dsp) |
| 469 blitmask_d565_opaque_mips(width, height, device, deviceRB, alpha, expanded32
, maskRB); | 469 blitmask_d565_opaque_mips(width, height, device, deviceRB, alpha, expanded32
, maskRB); |
| 470 #else // non-neon code | 470 #else // non-neon code |
| 471 do { | 471 do { |
| 472 int w = width; | 472 int w = width; |
| 473 do { | 473 do { |
| 474 *device = blend_compact(expanded32, SkExpand_rgb_16(*device), | 474 *device = blend_compact(expanded32, SkExpand_rgb_16(*device), |
| 475 SkAlpha255To256(*alpha++) >> 3); | 475 SkAlpha255To256(*alpha++) >> 3); |
| 476 device += 1; | 476 device += 1; |
| 477 } while (--w != 0); | 477 } while (--w != 0); |
| 478 device = (uint16_t*)((char*)device + deviceRB); | 478 device = (uint16_t*)((char*)device + deviceRB); |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 #endif | 1063 #endif |
| 1064 } else if (0xFF == SkColorGetA(color)) { | 1064 } else if (0xFF == SkColorGetA(color)) { |
| 1065 blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint); | 1065 blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint); |
| 1066 } else { | 1066 } else { |
| 1067 blitter = allocator->createT<SkRGB16_Blitter>(device, paint); | 1067 blitter = allocator->createT<SkRGB16_Blitter>(device, paint); |
| 1068 } | 1068 } |
| 1069 } | 1069 } |
| 1070 | 1070 |
| 1071 return blitter; | 1071 return blitter; |
| 1072 } | 1072 } |
| OLD | NEW |