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 "SkXfermode.h" | 16 #include "SkXfermode.h" |
17 | 17 |
18 #if defined(__ARM_HAVE_NEON) && defined(SK_CPU_LENDIAN) | 18 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) |
19 #define SK_USE_NEON | |
20 #include <arm_neon.h> | 19 #include <arm_neon.h> |
21 #else | 20 #else |
22 // if we don't have neon, then our black blitter is worth the extra code | 21 // if we don't have neon, then our black blitter is worth the extra code |
23 #define USE_BLACK_BLITTER | 22 #define USE_BLACK_BLITTER |
24 #endif | 23 #endif |
25 | 24 |
26 void sk_dither_memset16(uint16_t dst[], uint16_t value, uint16_t other, | 25 void sk_dither_memset16(uint16_t dst[], uint16_t value, uint16_t other, |
27 int count) { | 26 int count) { |
28 if (count > 0) { | 27 if (count > 0) { |
29 // see if we need to write one short before we can cast to an 4byte ptr | 28 // see if we need to write one short before we can cast to an 4byte ptr |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 } | 376 } |
378 | 377 |
379 uint16_t* SK_RESTRICT device = fDevice.getAddr16(clip.fLeft, clip.fTop); | 378 uint16_t* SK_RESTRICT device = fDevice.getAddr16(clip.fLeft, clip.fTop); |
380 const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop); | 379 const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop); |
381 int width = clip.width(); | 380 int width = clip.width(); |
382 int height = clip.height(); | 381 int height = clip.height(); |
383 size_t deviceRB = fDevice.rowBytes() - (width << 1); | 382 size_t deviceRB = fDevice.rowBytes() - (width << 1); |
384 unsigned maskRB = mask.fRowBytes - width; | 383 unsigned maskRB = mask.fRowBytes - width; |
385 uint32_t expanded32 = fExpandedRaw16; | 384 uint32_t expanded32 = fExpandedRaw16; |
386 | 385 |
387 #ifdef SK_USE_NEON | 386 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) |
388 #define UNROLL 8 | 387 #define UNROLL 8 |
389 do { | 388 do { |
390 int w = width; | 389 int w = width; |
391 if (w >= UNROLL) { | 390 if (w >= UNROLL) { |
392 uint32x4_t color, dev_lo, dev_hi; | 391 uint32x4_t color, dev_lo, dev_hi; |
393 uint32x4_t wn1, wn2, tmp; | 392 uint32x4_t wn1, wn2, tmp; |
394 uint32x4_t vmask_g16, vmask_ng16; | 393 uint32x4_t vmask_g16, vmask_ng16; |
395 uint16x8_t valpha, vdev; | 394 uint16x8_t valpha, vdev; |
396 uint16x4_t odev_lo, odev_hi, valpha_lo, valpha_hi; | 395 uint16x4_t odev_lo, odev_hi, valpha_lo, valpha_hi; |
397 | 396 |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 #endif | 1040 #endif |
1042 } else if (0xFF == SkColorGetA(color)) { | 1041 } else if (0xFF == SkColorGetA(color)) { |
1043 blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint); | 1042 blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint); |
1044 } else { | 1043 } else { |
1045 blitter = allocator->createT<SkRGB16_Blitter>(device, paint); | 1044 blitter = allocator->createT<SkRGB16_Blitter>(device, paint); |
1046 } | 1045 } |
1047 } | 1046 } |
1048 | 1047 |
1049 return blitter; | 1048 return blitter; |
1050 } | 1049 } |
OLD | NEW |