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 "SkTemplatesPriv.h" | 15 #include "SkTemplatesPriv.h" |
16 #include "SkUtils.h" | 16 #include "SkUtils.h" |
17 #include "SkXfermode.h" | 17 #include "SkXfermode.h" |
18 | 18 |
19 #if defined(__ARM_HAVE_NEON) && defined(SK_CPU_LENDIAN) | 19 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) |
djsollen
2014/03/20 14:40:16
can we do this in a separate CL since it doesn't s
kevin.petit
2014/03/20 16:05:09
You're right. I've uploaded https://codereview.chr
| |
20 #define SK_USE_NEON | |
21 #include <arm_neon.h> | 20 #include <arm_neon.h> |
22 #else | 21 #else |
23 // if we don't have neon, then our black blitter is worth the extra code | 22 // if we don't have neon, then our black blitter is worth the extra code |
24 #define USE_BLACK_BLITTER | 23 #define USE_BLACK_BLITTER |
25 #endif | 24 #endif |
26 | 25 |
27 void sk_dither_memset16(uint16_t dst[], uint16_t value, uint16_t other, | 26 void sk_dither_memset16(uint16_t dst[], uint16_t value, uint16_t other, |
28 int count) { | 27 int count) { |
29 if (count > 0) { | 28 if (count > 0) { |
30 // see if we need to write one short before we can cast to an 4byte ptr | 29 // 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... | |
378 } | 377 } |
379 | 378 |
380 uint16_t* SK_RESTRICT device = fDevice.getAddr16(clip.fLeft, clip.fTop); | 379 uint16_t* SK_RESTRICT device = fDevice.getAddr16(clip.fLeft, clip.fTop); |
381 const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop); | 380 const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop); |
382 int width = clip.width(); | 381 int width = clip.width(); |
383 int height = clip.height(); | 382 int height = clip.height(); |
384 size_t deviceRB = fDevice.rowBytes() - (width << 1); | 383 size_t deviceRB = fDevice.rowBytes() - (width << 1); |
385 unsigned maskRB = mask.fRowBytes - width; | 384 unsigned maskRB = mask.fRowBytes - width; |
386 uint32_t expanded32 = fExpandedRaw16; | 385 uint32_t expanded32 = fExpandedRaw16; |
387 | 386 |
388 #ifdef SK_USE_NEON | 387 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) |
389 #define UNROLL 8 | 388 #define UNROLL 8 |
390 do { | 389 do { |
391 int w = width; | 390 int w = width; |
392 if (w >= UNROLL) { | 391 if (w >= UNROLL) { |
393 uint32x4_t color, dev_lo, dev_hi; | 392 uint32x4_t color, dev_lo, dev_hi; |
394 uint32x4_t wn1, wn2, tmp; | 393 uint32x4_t wn1, wn2, tmp; |
395 uint32x4_t vmask_g16, vmask_ng16; | 394 uint32x4_t vmask_g16, vmask_ng16; |
396 uint16x8_t valpha, vdev; | 395 uint16x8_t valpha, vdev; |
397 uint16x4_t odev_lo, odev_hi, valpha_lo, valpha_hi; | 396 uint16x4_t odev_lo, odev_hi, valpha_lo, valpha_hi; |
398 | 397 |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1046 SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Opaque_Blitter, storage, | 1045 SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Opaque_Blitter, storage, |
1047 storageSize, (device, paint)); | 1046 storageSize, (device, paint)); |
1048 } else { | 1047 } else { |
1049 SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Blitter, storage, | 1048 SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Blitter, storage, |
1050 storageSize, (device, paint)); | 1049 storageSize, (device, paint)); |
1051 } | 1050 } |
1052 } | 1051 } |
1053 | 1052 |
1054 return blitter; | 1053 return blitter; |
1055 } | 1054 } |
OLD | NEW |