OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
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 #ifndef SkSwizzler_opts_DEFINED | 8 #ifndef SkSwizzler_opts_DEFINED |
9 #define SkSwizzler_opts_DEFINED | 9 #define SkSwizzler_opts_DEFINED |
10 | 10 |
11 #include "SkColorPriv.h" | 11 #include "SkColorPriv.h" |
12 | 12 |
| 13 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSSE3 |
| 14 #include <immintrin.h> |
| 15 #elif defined(SK_ARM_HAS_NEON) |
| 16 #include <arm_neon.h> |
| 17 #endif |
| 18 |
13 namespace SK_OPTS_NS { | 19 namespace SK_OPTS_NS { |
14 | 20 |
15 static void RGBA_to_rgbA_portable(uint32_t* dst, const void* vsrc, int count) { | 21 static void RGBA_to_rgbA_portable(uint32_t* dst, const void* vsrc, int count) { |
16 auto src = (const uint32_t*)vsrc; | 22 auto src = (const uint32_t*)vsrc; |
17 for (int i = 0; i < count; i++) { | 23 for (int i = 0; i < count; i++) { |
18 uint8_t a = src[i] >> 24, | 24 uint8_t a = src[i] >> 24, |
19 b = src[i] >> 16, | 25 b = src[i] >> 16, |
20 g = src[i] >> 8, | 26 g = src[i] >> 8, |
21 r = src[i] >> 0; | 27 r = src[i] >> 0; |
22 b = (b*a+127)/255; | 28 b = (b*a+127)/255; |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 | 837 |
832 static void inverted_CMYK_to_BGR1(uint32_t dst[], const void* src, int count) { | 838 static void inverted_CMYK_to_BGR1(uint32_t dst[], const void* src, int count) { |
833 inverted_CMYK_to_BGR1_portable(dst, src, count); | 839 inverted_CMYK_to_BGR1_portable(dst, src, count); |
834 } | 840 } |
835 | 841 |
836 #endif | 842 #endif |
837 | 843 |
838 } | 844 } |
839 | 845 |
840 #endif // SkSwizzler_opts_DEFINED | 846 #endif // SkSwizzler_opts_DEFINED |
OLD | NEW |