bump product version to 7.6.3.2-android
[LibreOffice.git] / external / skia / source / skia_opts.cxx
blob7c2dace6d5f00adc6733c40cb951e186a8aa5261
1 /*
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
6 #include <skia_opts.hxx>
8 #include "include/private/base/SkOnce.h"
10 #if defined __GNUC__
11 #pragma GCC diagnostic push
12 #pragma GCC diagnostic ignored "-Wshadow"
13 #endif
14 #include "src/core/SkCpu.h"
15 #include "src/core/SkOpts.h"
16 #if defined __GNUC__
17 #pragma GCC diagnostic pop
18 #endif
20 void SkConvertRGBToRGBA(uint32_t* dest, const uint8_t* src, int count)
22 SkOpts::RGB_to_RGB1(dest, src, count);
25 void SkConvertGrayToRGBA(uint32_t* dest, const uint8_t* src, int count)
27 SkOpts::gray_to_RGB1(dest, src, count);
30 void SkConvertRGBAToRGB(uint8_t* dest, const uint32_t* src, int count)
32 SkLoOpts::RGB1_to_RGB(dest, src, count);
35 void SkConvertRGBAToR(uint8_t* dest, const uint32_t* src, int count)
37 SkLoOpts::RGB1_to_R(dest, src, count);
40 // The rest is mostly based on Skia's SkOpts.cpp, reduced to only SSSE3 so far.
42 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSSE3
43 #define SK_OPTS_NS ssse3
44 #else
45 #define SK_OPTS_NS portable
46 #endif
48 #include "skia_opts_internal.hxx"
50 namespace SkLoOpts {
51 // Define default function pointer values here...
52 // If our global compile options are set high enough, these defaults might even be
53 // CPU-specialized, e.g. a typical x86-64 machine might start with SSE2 defaults.
54 // They'll still get a chance to be replaced with even better ones, e.g. using SSE4.1.
55 #define DEFINE_DEFAULT(name) decltype(name) name = SK_OPTS_NS::name
56 DEFINE_DEFAULT(RGB1_to_RGB);
57 DEFINE_DEFAULT(RGB1_to_R);
58 #undef DEFINE_DEFAULT
60 // Each Init_foo() is defined in its own file.
61 void Init_ssse3();
63 static void init() {
64 #if !defined(SK_BUILD_NO_OPTS)
65 #if defined(SK_CPU_X86)
66 #if SK_CPU_SSE_LEVEL < SK_CPU_SSE_LEVEL_SSSE3
67 if (SkCpu::Supports(SkCpu::SSSE3)) { Init_ssse3(); }
68 #endif
69 #endif
70 #endif
73 void Init() {
74 static SkOnce once;
75 once(init);
77 } // namespace SkLoOpts