OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "SkCpu.h" | 8 #include "SkCpu.h" |
9 #include "SkHalf.h" | 9 #include "SkHalf.h" |
10 #include "SkOnce.h" | 10 #include "SkOnce.h" |
11 #include "SkOpts.h" | 11 #include "SkOpts.h" |
12 | 12 |
13 #define SK_OPTS_NS sk_default | 13 #define SK_OPTS_NS sk_default |
14 #include "SkBlend_opts.h" | 14 #include "SkBlend_opts.h" |
15 #include "SkBlitMask_opts.h" | 15 #include "SkBlitMask_opts.h" |
16 #include "SkBlitRow_opts.h" | 16 #include "SkBlitRow_opts.h" |
17 #include "SkBlurImageFilter_opts.h" | 17 #include "SkBlurImageFilter_opts.h" |
18 #include "SkColorCubeFilter_opts.h" | 18 #include "SkColorCubeFilter_opts.h" |
| 19 #include "SkColorXform_opts.h" |
19 #include "SkMorphologyImageFilter_opts.h" | 20 #include "SkMorphologyImageFilter_opts.h" |
20 #include "SkSwizzler_opts.h" | 21 #include "SkSwizzler_opts.h" |
21 #include "SkTextureCompressor_opts.h" | 22 #include "SkTextureCompressor_opts.h" |
22 #include "SkXfermode_opts.h" | 23 #include "SkXfermode_opts.h" |
23 | 24 |
24 namespace SK_OPTS_NS { | 25 namespace SK_OPTS_NS { |
25 static void float_to_half(uint16_t dst[], const float src[], int n) { | 26 static void float_to_half(uint16_t dst[], const float src[], int n) { |
26 while (n-->0) { | 27 while (n-->0) { |
27 *dst++ = SkFloatToHalf(*src++); | 28 *dst++ = SkFloatToHalf(*src++); |
28 } | 29 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 decltype(grayA_to_RGBA) grayA_to_RGBA = sk_default::grayA_to
_RGBA; | 70 decltype(grayA_to_RGBA) grayA_to_RGBA = sk_default::grayA_to
_RGBA; |
70 decltype(grayA_to_rgbA) grayA_to_rgbA = sk_default::grayA_to
_rgbA; | 71 decltype(grayA_to_rgbA) grayA_to_rgbA = sk_default::grayA_to
_rgbA; |
71 decltype(inverted_CMYK_to_RGB1) inverted_CMYK_to_RGB1 = sk_default::inverted
_CMYK_to_RGB1; | 72 decltype(inverted_CMYK_to_RGB1) inverted_CMYK_to_RGB1 = sk_default::inverted
_CMYK_to_RGB1; |
72 decltype(inverted_CMYK_to_BGR1) inverted_CMYK_to_BGR1 = sk_default::inverted
_CMYK_to_BGR1; | 73 decltype(inverted_CMYK_to_BGR1) inverted_CMYK_to_BGR1 = sk_default::inverted
_CMYK_to_BGR1; |
73 | 74 |
74 decltype(half_to_float) half_to_float = sk_default::half_to_float; | 75 decltype(half_to_float) half_to_float = sk_default::half_to_float; |
75 decltype(float_to_half) float_to_half = sk_default::float_to_half; | 76 decltype(float_to_half) float_to_half = sk_default::float_to_half; |
76 | 77 |
77 decltype(srcover_srgb_srgb) srcover_srgb_srgb = sk_default::srcover_srgb_srg
b; | 78 decltype(srcover_srgb_srgb) srcover_srgb_srgb = sk_default::srcover_srgb_srg
b; |
78 | 79 |
| 80 decltype(color_xform_2Dot2_RGBA_to_8888) color_xform_2Dot2_RGBA_to_8888 = |
| 81 sk_default::color_xform_2Dot2_RGBA_to_8888; |
| 82 |
79 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. | 83 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. |
80 void Init_ssse3(); | 84 void Init_ssse3(); |
81 void Init_sse41(); | 85 void Init_sse41(); |
82 void Init_sse42() {} | 86 void Init_sse42() {} |
83 void Init_avx() {} | 87 void Init_avx() {} |
84 void Init_avx2() {} | 88 void Init_avx2() {} |
85 | 89 |
86 static void init() { | 90 static void init() { |
87 #if defined(SK_CPU_X86) && !defined(SK_BUILD_NO_OPTS) | 91 #if defined(SK_CPU_X86) && !defined(SK_BUILD_NO_OPTS) |
88 if (SkCpu::Supports(SkCpu::SSSE3)) { Init_ssse3(); } | 92 if (SkCpu::Supports(SkCpu::SSSE3)) { Init_ssse3(); } |
89 if (SkCpu::Supports(SkCpu::SSE41)) { Init_sse41(); } | 93 if (SkCpu::Supports(SkCpu::SSE41)) { Init_sse41(); } |
90 if (SkCpu::Supports(SkCpu::SSE42)) { Init_sse42(); } | 94 if (SkCpu::Supports(SkCpu::SSE42)) { Init_sse42(); } |
91 if (SkCpu::Supports(SkCpu::AVX )) { Init_avx(); } | 95 if (SkCpu::Supports(SkCpu::AVX )) { Init_avx(); } |
92 if (SkCpu::Supports(SkCpu::AVX2 )) { Init_avx2(); } | 96 if (SkCpu::Supports(SkCpu::AVX2 )) { Init_avx2(); } |
93 #endif | 97 #endif |
94 } | 98 } |
95 | 99 |
96 void Init() { | 100 void Init() { |
97 static SkOnce once; | 101 static SkOnce once; |
98 once(init); | 102 once(init); |
99 } | 103 } |
100 } // namespace SkOpts | 104 } // namespace SkOpts |
OLD | NEW |