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