rm SkPreConfig.h and SkPostConfig.h

We treat them as part of SkTypes.h, so let's just merge them in?

Change-Id: Icd6db3913a679ceb9de09027d17eb9361754b016
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268769
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
This commit is contained in:
Mike Klein 2020-02-05 10:17:57 -06:00 committed by Skia Commit-Bot
parent ba8ab23175
commit 81d35a72ae
9 changed files with 420 additions and 490 deletions

View File

@ -65,8 +65,6 @@ skia_core_public = [
"$_include/core/SkPngChunkReader.h",
"$_include/core/SkPoint.h",
"$_include/core/SkPoint3.h",
"$_include/core/SkPostConfig.h",
"$_include/core/SkPreConfig.h",
"$_include/core/SkPromiseImageTexture.h",
"$_include/core/SkRRect.h",
"$_include/core/SkRSXform.h",

View File

@ -464,7 +464,7 @@ def write_config(config_path, defines, platform):
gn_to_bp_utils.WriteUserConfig(config_path, defines)
append_to_file(config_path, '''
// Correct SK_BUILD_FOR flags that may have been set by
// SkPreConfig.h/Android.bp
// SkTypes.h/Android.bp
#ifndef SK_BUILD_FOR_%s
#define SK_BUILD_FOR_%s
#endif

View File

@ -10,19 +10,9 @@
#ifndef SkUserConfig_DEFINED
#define SkUserConfig_DEFINED
/* SkTypes.h, the root of the public header files, includes SkPreConfig.h,
then SkUserConfig.h, then SkPostConfig.h.
SkPreConfig.h runs first, and it is responsible for initializing certain
skia defines.
SkPostConfig.h runs last, and its job is to just check that the final
defines are consistent (i.e. that we don't have mutually conflicting
defines).
SkUserConfig.h (this file) runs in the middle. It gets to change or augment
the list of flags initially set in preconfig, and then postconfig checks
that everything still makes sense.
/* SkTypes.h, the root of the public header files, includes this file
SkUserConfig.h after first initializing certain Skia defines, letting
this file change or augment those flags.
Below are optional defines that add, subtract, or change default behavior
in Skia. Your port can locally edit this file to enable/disable flags as
@ -39,7 +29,7 @@
each 32bit pixel is in premultiplied form). This code can be very useful
during development, but will slow things down in a shipping product.
By default, these mutually exclusive flags are defined in SkPreConfig.h,
By default, these mutually exclusive flags are defined in SkTypes.h,
based on the presence or absence of NDEBUG, but that decision can be changed
here.
*/

View File

@ -1,261 +0,0 @@
/*
* Copyright 2006 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
// IWYU pragma: private, include "SkTypes.h"
#ifndef SkPostConfig_DEFINED
#define SkPostConfig_DEFINED
#if !defined(SK_DEBUG) && !defined(SK_RELEASE)
#ifdef NDEBUG
#define SK_RELEASE
#else
#define SK_DEBUG
#endif
#endif
#if defined(SK_DEBUG) && defined(SK_RELEASE)
# error "cannot define both SK_DEBUG and SK_RELEASE"
#elif !defined(SK_DEBUG) && !defined(SK_RELEASE)
# error "must define either SK_DEBUG or SK_RELEASE"
#endif
#if defined(SK_CPU_LENDIAN) && defined(SK_CPU_BENDIAN)
# error "cannot define both SK_CPU_LENDIAN and SK_CPU_BENDIAN"
#elif !defined(SK_CPU_LENDIAN) && !defined(SK_CPU_BENDIAN)
# error "must define either SK_CPU_LENDIAN or SK_CPU_BENDIAN"
#endif
#if defined(SK_CPU_BENDIAN) && !defined(I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN)
#error "The Skia team is not endian-savvy enough to support big-endian CPUs."
#error "If you still want to use Skia,"
#error "please define I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN."
#endif
#if !defined(SK_ATTRIBUTE)
# if defined(__clang__) || defined(__GNUC__)
# define SK_ATTRIBUTE(attr) __attribute__((attr))
# else
# define SK_ATTRIBUTE(attr)
# endif
#endif
#if !defined(SK_SUPPORT_GPU)
# define SK_SUPPORT_GPU 1
#endif
/**
* If GPU is enabled but no GPU backends are enabled then enable GL by default.
* Traditionally clients have relied on Skia always building with the GL backend
* and opting in to additional backends. TODO: Require explicit opt in for GL.
*/
#if SK_SUPPORT_GPU
# if !defined(SK_GL) && !defined(SK_VULKAN) && !defined(SK_METAL)
# define SK_GL
# endif
#endif
#if !defined(SK_SUPPORT_ATLAS_TEXT)
# define SK_SUPPORT_ATLAS_TEXT 0
#elif SK_SUPPORT_ATLAS_TEXT && !SK_SUPPORT_GPU
# error "SK_SUPPORT_ATLAS_TEXT requires SK_SUPPORT_GPU"
#endif
#if !defined(SkUNREACHABLE)
# if defined(_MSC_VER) && !defined(__clang__)
# define SkUNREACHABLE __assume(false)
# else
# define SkUNREACHABLE __builtin_unreachable()
# endif
#endif
///////////////////////////////////////////////////////////////////////////////
#if defined(SK_BUILD_FOR_GOOGLE3)
void SkDebugfForDumpStackTrace(const char* data, void* unused);
void DumpStackTrace(int skip_count, void w(const char*, void*), void* arg);
# define SK_DUMP_GOOGLE3_STACK() DumpStackTrace(0, SkDebugfForDumpStackTrace, nullptr)
#else
# define SK_DUMP_GOOGLE3_STACK()
#endif
#ifdef SK_BUILD_FOR_WIN
// permits visual studio to follow error back to source
#define SK_DUMP_LINE_FORMAT(message) \
SkDebugf("%s(%d): fatal error: \"%s\"\n", __FILE__, __LINE__, message)
#else
#define SK_DUMP_LINE_FORMAT(message) \
SkDebugf("%s:%d: fatal error: \"%s\"\n", __FILE__, __LINE__, message)
#endif
#ifndef SK_ABORT
# define SK_ABORT(message) \
do { \
SK_DUMP_LINE_FORMAT(message); \
SK_DUMP_GOOGLE3_STACK(); \
sk_abort_no_print(); \
SkUNREACHABLE; \
} while (false)
#endif
// If SK_R32_SHIFT is set, we'll use that to choose RGBA or BGRA.
// If not, we'll default to RGBA everywhere except BGRA on Windows.
#if defined(SK_R32_SHIFT)
static_assert(SK_R32_SHIFT == 0 || SK_R32_SHIFT == 16, "");
#elif defined(SK_BUILD_FOR_WIN)
#define SK_R32_SHIFT 16
#else
#define SK_R32_SHIFT 0
#endif
#if defined(SK_B32_SHIFT)
static_assert(SK_B32_SHIFT == (16-SK_R32_SHIFT), "");
#else
#define SK_B32_SHIFT (16-SK_R32_SHIFT)
#endif
#define SK_G32_SHIFT 8
#define SK_A32_SHIFT 24
/**
* SK_PMCOLOR_BYTE_ORDER can be used to query the byte order of SkPMColor at compile time. The
* relationship between the byte order and shift values depends on machine endianness. If the shift
* order is R=0, G=8, B=16, A=24 then ((char*)&pmcolor)[0] will produce the R channel on a little
* endian machine and the A channel on a big endian machine. Thus, given those shifts values,
* SK_PMCOLOR_BYTE_ORDER(R,G,B,A) will be true on a little endian machine and
* SK_PMCOLOR_BYTE_ORDER(A,B,G,R) will be true on a big endian machine.
*/
#ifdef SK_CPU_BENDIAN
# define SK_PMCOLOR_BYTE_ORDER(C0, C1, C2, C3) \
(SK_ ## C3 ## 32_SHIFT == 0 && \
SK_ ## C2 ## 32_SHIFT == 8 && \
SK_ ## C1 ## 32_SHIFT == 16 && \
SK_ ## C0 ## 32_SHIFT == 24)
#else
# define SK_PMCOLOR_BYTE_ORDER(C0, C1, C2, C3) \
(SK_ ## C0 ## 32_SHIFT == 0 && \
SK_ ## C1 ## 32_SHIFT == 8 && \
SK_ ## C2 ## 32_SHIFT == 16 && \
SK_ ## C3 ## 32_SHIFT == 24)
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
#if defined SK_DEBUG && defined SK_BUILD_FOR_WIN
#ifdef free
#undef free
#endif
#include <crtdbg.h>
#undef free
#endif
//////////////////////////////////////////////////////////////////////
#if !defined(SK_UNUSED)
# if !defined(__clang__) && defined(_MSC_VER)
# define SK_UNUSED __pragma(warning(suppress:4189))
# else
# define SK_UNUSED SK_ATTRIBUTE(unused)
# endif
#endif
/**
* If your judgment is better than the compiler's (i.e. you've profiled it),
* you can use SK_ALWAYS_INLINE to force inlining. E.g.
* inline void someMethod() { ... } // may not be inlined
* SK_ALWAYS_INLINE void someMethod() { ... } // should always be inlined
*/
#if !defined(SK_ALWAYS_INLINE)
# if defined(SK_BUILD_FOR_WIN)
# define SK_ALWAYS_INLINE __forceinline
# else
# define SK_ALWAYS_INLINE SK_ATTRIBUTE(always_inline) inline
# endif
#endif
/**
* If your judgment is better than the compiler's (i.e. you've profiled it),
* you can use SK_NEVER_INLINE to prevent inlining.
*/
#if !defined(SK_NEVER_INLINE)
# if defined(SK_BUILD_FOR_WIN)
# define SK_NEVER_INLINE __declspec(noinline)
# else
# define SK_NEVER_INLINE SK_ATTRIBUTE(noinline)
# endif
#endif
//////////////////////////////////////////////////////////////////////
#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE1
#define SK_PREFETCH(ptr) _mm_prefetch(reinterpret_cast<const char*>(ptr), _MM_HINT_T0)
#elif defined(__GNUC__)
#define SK_PREFETCH(ptr) __builtin_prefetch(ptr)
#else
#define SK_PREFETCH(ptr)
#endif
//////////////////////////////////////////////////////////////////////
#ifndef SK_PRINTF_LIKE
# if defined(__clang__) || defined(__GNUC__)
# define SK_PRINTF_LIKE(A, B) __attribute__((format(printf, (A), (B))))
# else
# define SK_PRINTF_LIKE(A, B)
# endif
#endif
//////////////////////////////////////////////////////////////////////
#ifndef SK_SIZE_T_SPECIFIER
# if defined(_MSC_VER) && !defined(__clang__)
# define SK_SIZE_T_SPECIFIER "%Iu"
# else
# define SK_SIZE_T_SPECIFIER "%zu"
# endif
#endif
//////////////////////////////////////////////////////////////////////
#ifndef SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
#define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0
#endif
//////////////////////////////////////////////////////////////////////
#if !defined(SK_GAMMA_EXPONENT)
#define SK_GAMMA_EXPONENT (0.0f) // SRGB
#endif
//////////////////////////////////////////////////////////////////////
#ifndef GR_TEST_UTILS
# define GR_TEST_UTILS 0
#endif
//////////////////////////////////////////////////////////////////////
#if defined(SK_HISTOGRAM_ENUMERATION) && defined(SK_HISTOGRAM_BOOLEAN)
# define SK_HISTOGRAMS_ENABLED 1
#else
# define SK_HISTOGRAMS_ENABLED 0
#endif
#ifndef SK_HISTOGRAM_BOOLEAN
# define SK_HISTOGRAM_BOOLEAN(name, value)
#endif
#ifndef SK_HISTOGRAM_ENUMERATION
# define SK_HISTOGRAM_ENUMERATION(name, value, boundary_value)
#endif
#ifndef SK_DISABLE_LEGACY_SHADERCONTEXT
#define SK_ENABLE_LEGACY_SHADERCONTEXT
#endif
#endif // SkPostConfig_DEFINED

View File

@ -1,205 +0,0 @@
/*
* Copyright 2006 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
// IWYU pragma: private, include "SkTypes.h"
#ifndef SkPreConfig_DEFINED
#define SkPreConfig_DEFINED
// Allows embedders that want to disable macros that take arguments to just
// define that symbol to be one of these
#define SK_NOTHING_ARG1(arg1)
#define SK_NOTHING_ARG2(arg1, arg2)
#define SK_NOTHING_ARG3(arg1, arg2, arg3)
//////////////////////////////////////////////////////////////////////
#if !defined(SK_BUILD_FOR_ANDROID) && !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_WIN) && \
!defined(SK_BUILD_FOR_UNIX) && !defined(SK_BUILD_FOR_MAC)
#ifdef __APPLE__
#include "TargetConditionals.h"
#endif
#if defined(_WIN32) || defined(__SYMBIAN32__)
#define SK_BUILD_FOR_WIN
#elif defined(ANDROID) || defined(__ANDROID__)
#define SK_BUILD_FOR_ANDROID
#elif defined(linux) || defined(__linux) || defined(__FreeBSD__) || \
defined(__OpenBSD__) || defined(__sun) || defined(__NetBSD__) || \
defined(__DragonFly__) || defined(__Fuchsia__) || \
defined(__GLIBC__) || defined(__GNU__) || defined(__unix__)
#define SK_BUILD_FOR_UNIX
#elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
#define SK_BUILD_FOR_IOS
#else
#define SK_BUILD_FOR_MAC
#endif
#endif
//////////////////////////////////////////////////////////////////////
#if defined(SK_BUILD_FOR_WIN) && !defined(__clang__)
#if !defined(SK_RESTRICT)
#define SK_RESTRICT __restrict
#endif
#if !defined(SK_WARN_UNUSED_RESULT)
#define SK_WARN_UNUSED_RESULT
#endif
#endif
#if !defined(SK_RESTRICT)
#define SK_RESTRICT __restrict__
#endif
#if !defined(SK_WARN_UNUSED_RESULT)
#define SK_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#endif
//////////////////////////////////////////////////////////////////////
#if !defined(SK_CPU_BENDIAN) && !defined(SK_CPU_LENDIAN)
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#define SK_CPU_BENDIAN
#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define SK_CPU_LENDIAN
#elif defined(__sparc) || defined(__sparc__) || \
defined(_POWER) || defined(__powerpc__) || \
defined(__ppc__) || defined(__hppa) || \
defined(__PPC__) || defined(__PPC64__) || \
defined(_MIPSEB) || defined(__ARMEB__) || \
defined(__s390__) || \
(defined(__sh__) && defined(__BIG_ENDIAN__)) || \
(defined(__ia64) && defined(__BIG_ENDIAN__))
#define SK_CPU_BENDIAN
#else
#define SK_CPU_LENDIAN
#endif
#endif
//////////////////////////////////////////////////////////////////////
#if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64)
#define SK_CPU_X86 1
#endif
/**
* SK_CPU_SSE_LEVEL
*
* If defined, SK_CPU_SSE_LEVEL should be set to the highest supported level.
* On non-intel CPU this should be undefined.
*/
#define SK_CPU_SSE_LEVEL_SSE1 10
#define SK_CPU_SSE_LEVEL_SSE2 20
#define SK_CPU_SSE_LEVEL_SSE3 30
#define SK_CPU_SSE_LEVEL_SSSE3 31
#define SK_CPU_SSE_LEVEL_SSE41 41
#define SK_CPU_SSE_LEVEL_SSE42 42
#define SK_CPU_SSE_LEVEL_AVX 51
#define SK_CPU_SSE_LEVEL_AVX2 52
#define SK_CPU_SSE_LEVEL_AVX512 60
// When targetting iOS and using gyp to generate the build files, it is not
// possible to select files to build depending on the architecture (i.e. it
// is not possible to use hand optimized assembly implementation). In that
// configuration SK_BUILD_NO_OPTS is defined. Remove optimisation then.
#ifdef SK_BUILD_NO_OPTS
#define SK_CPU_SSE_LEVEL 0
#endif
// Are we in GCC/Clang?
#ifndef SK_CPU_SSE_LEVEL
// These checks must be done in descending order to ensure we set the highest
// available SSE level.
#if defined(__AVX512F__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX512
#elif defined(__AVX2__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX2
#elif defined(__AVX__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX
#elif defined(__SSE4_2__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE42
#elif defined(__SSE4_1__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE41
#elif defined(__SSSE3__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSSE3
#elif defined(__SSE3__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE3
#elif defined(__SSE2__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2
#endif
#endif
// Are we in VisualStudio?
#ifndef SK_CPU_SSE_LEVEL
// These checks must be done in descending order to ensure we set the highest
// available SSE level. 64-bit intel guarantees at least SSE2 support.
#if defined(__AVX2__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX2
#elif defined(__AVX__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX
#elif defined(_M_X64) || defined(_M_AMD64)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2
#elif defined(_M_IX86_FP)
#if _M_IX86_FP >= 2
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2
#elif _M_IX86_FP == 1
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE1
#endif
#endif
#endif
//////////////////////////////////////////////////////////////////////
// ARM defines
#if defined(__arm__) && (!defined(__APPLE__) || !TARGET_IPHONE_SIMULATOR)
#define SK_CPU_ARM32
#elif defined(__aarch64__) && !defined(SK_BUILD_NO_OPTS)
#define SK_CPU_ARM64
#endif
// All 64-bit ARM chips have NEON. Many 32-bit ARM chips do too.
#if !defined(SK_ARM_HAS_NEON) && !defined(SK_BUILD_NO_OPTS) && defined(__ARM_NEON)
#define SK_ARM_HAS_NEON
#endif
// Really this __APPLE__ check shouldn't be necessary, but it seems that Apple's Clang defines
// __ARM_FEATURE_CRC32 for -arch arm64, even though their chips don't support those instructions!
#if defined(__ARM_FEATURE_CRC32) && !defined(__APPLE__)
#define SK_ARM_HAS_CRC32
#endif
//////////////////////////////////////////////////////////////////////
#if !defined(SKIA_IMPLEMENTATION)
#define SKIA_IMPLEMENTATION 0
#endif
#if !defined(SK_API)
#if defined(SKIA_DLL)
#if defined(_MSC_VER)
#if SKIA_IMPLEMENTATION
#define SK_API __declspec(dllexport)
#else
#define SK_API __declspec(dllimport)
#endif
#else
#define SK_API __attribute__((visibility("default")))
#endif
#else
#define SK_API
#endif
#endif
// SK_SPI is functionally identical to SK_API, but used within src to clarify that it's less stable
#if !defined(SK_SPI)
#define SK_SPI SK_API
#endif
#endif

View File

@ -8,20 +8,429 @@
#ifndef SkTypes_DEFINED
#define SkTypes_DEFINED
/** \file SkTypes.h
*/
// Pre-SkUserConfig.h setup.
// Allows embedders that want to disable macros that take arguments to just
// define that symbol to be one of these
#define SK_NOTHING_ARG1(arg1)
#define SK_NOTHING_ARG2(arg1, arg2)
#define SK_NOTHING_ARG3(arg1, arg2, arg3)
#if !defined(SK_BUILD_FOR_ANDROID) && !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_WIN) && \
!defined(SK_BUILD_FOR_UNIX) && !defined(SK_BUILD_FOR_MAC)
#ifdef __APPLE__
#include "TargetConditionals.h"
#endif
#if defined(_WIN32) || defined(__SYMBIAN32__)
#define SK_BUILD_FOR_WIN
#elif defined(ANDROID) || defined(__ANDROID__)
#define SK_BUILD_FOR_ANDROID
#elif defined(linux) || defined(__linux) || defined(__FreeBSD__) || \
defined(__OpenBSD__) || defined(__sun) || defined(__NetBSD__) || \
defined(__DragonFly__) || defined(__Fuchsia__) || \
defined(__GLIBC__) || defined(__GNU__) || defined(__unix__)
#define SK_BUILD_FOR_UNIX
#elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
#define SK_BUILD_FOR_IOS
#else
#define SK_BUILD_FOR_MAC
#endif
#endif
#if defined(SK_BUILD_FOR_WIN) && !defined(__clang__)
#if !defined(SK_RESTRICT)
#define SK_RESTRICT __restrict
#endif
#if !defined(SK_WARN_UNUSED_RESULT)
#define SK_WARN_UNUSED_RESULT
#endif
#endif
#if !defined(SK_RESTRICT)
#define SK_RESTRICT __restrict__
#endif
#if !defined(SK_WARN_UNUSED_RESULT)
#define SK_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#endif
#if !defined(SK_CPU_BENDIAN) && !defined(SK_CPU_LENDIAN)
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#define SK_CPU_BENDIAN
#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define SK_CPU_LENDIAN
#elif defined(__sparc) || defined(__sparc__) || \
defined(_POWER) || defined(__powerpc__) || \
defined(__ppc__) || defined(__hppa) || \
defined(__PPC__) || defined(__PPC64__) || \
defined(_MIPSEB) || defined(__ARMEB__) || \
defined(__s390__) || \
(defined(__sh__) && defined(__BIG_ENDIAN__)) || \
(defined(__ia64) && defined(__BIG_ENDIAN__))
#define SK_CPU_BENDIAN
#else
#define SK_CPU_LENDIAN
#endif
#endif
#if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64)
#define SK_CPU_X86 1
#endif
/**
* SK_CPU_SSE_LEVEL
*
* If defined, SK_CPU_SSE_LEVEL should be set to the highest supported level.
* On non-intel CPU this should be undefined.
*/
#define SK_CPU_SSE_LEVEL_SSE1 10
#define SK_CPU_SSE_LEVEL_SSE2 20
#define SK_CPU_SSE_LEVEL_SSE3 30
#define SK_CPU_SSE_LEVEL_SSSE3 31
#define SK_CPU_SSE_LEVEL_SSE41 41
#define SK_CPU_SSE_LEVEL_SSE42 42
#define SK_CPU_SSE_LEVEL_AVX 51
#define SK_CPU_SSE_LEVEL_AVX2 52
#define SK_CPU_SSE_LEVEL_AVX512 60
// When targetting iOS and using gyp to generate the build files, it is not
// possible to select files to build depending on the architecture (i.e. it
// is not possible to use hand optimized assembly implementation). In that
// configuration SK_BUILD_NO_OPTS is defined. Remove optimisation then.
#ifdef SK_BUILD_NO_OPTS
#define SK_CPU_SSE_LEVEL 0
#endif
// Are we in GCC/Clang?
#ifndef SK_CPU_SSE_LEVEL
// These checks must be done in descending order to ensure we set the highest
// available SSE level.
#if defined(__AVX512F__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX512
#elif defined(__AVX2__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX2
#elif defined(__AVX__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX
#elif defined(__SSE4_2__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE42
#elif defined(__SSE4_1__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE41
#elif defined(__SSSE3__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSSE3
#elif defined(__SSE3__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE3
#elif defined(__SSE2__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2
#endif
#endif
// Are we in VisualStudio?
#ifndef SK_CPU_SSE_LEVEL
// These checks must be done in descending order to ensure we set the highest
// available SSE level. 64-bit intel guarantees at least SSE2 support.
#if defined(__AVX2__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX2
#elif defined(__AVX__)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX
#elif defined(_M_X64) || defined(_M_AMD64)
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2
#elif defined(_M_IX86_FP)
#if _M_IX86_FP >= 2
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2
#elif _M_IX86_FP == 1
#define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE1
#endif
#endif
#endif
// ARM defines
#if defined(__arm__) && (!defined(__APPLE__) || !TARGET_IPHONE_SIMULATOR)
#define SK_CPU_ARM32
#elif defined(__aarch64__) && !defined(SK_BUILD_NO_OPTS)
#define SK_CPU_ARM64
#endif
// All 64-bit ARM chips have NEON. Many 32-bit ARM chips do too.
#if !defined(SK_ARM_HAS_NEON) && !defined(SK_BUILD_NO_OPTS) && defined(__ARM_NEON)
#define SK_ARM_HAS_NEON
#endif
// Really this __APPLE__ check shouldn't be necessary, but it seems that Apple's Clang defines
// __ARM_FEATURE_CRC32 for -arch arm64, even though their chips don't support those instructions!
#if defined(__ARM_FEATURE_CRC32) && !defined(__APPLE__)
#define SK_ARM_HAS_CRC32
#endif
// DLL/.so exports.
#if !defined(SKIA_IMPLEMENTATION)
#define SKIA_IMPLEMENTATION 0
#endif
#if !defined(SK_API)
#if defined(SKIA_DLL)
#if defined(_MSC_VER)
#if SKIA_IMPLEMENTATION
#define SK_API __declspec(dllexport)
#else
#define SK_API __declspec(dllimport)
#endif
#else
#define SK_API __attribute__((visibility("default")))
#endif
#else
#define SK_API
#endif
#endif
// SK_SPI is functionally identical to SK_API, but used within src to clarify that it's less stable
#if !defined(SK_SPI)
#define SK_SPI SK_API
#endif
// IWYU pragma: begin_exports
#include "include/core/SkPreConfig.h"
#if defined (SK_USER_CONFIG_HEADER)
#include SK_USER_CONFIG_HEADER
#else
#include "include/config/SkUserConfig.h"
#endif
#include "include/core/SkPostConfig.h"
#include <stddef.h>
#include <stdint.h>
// IWYU pragma: end_exports
/** \file SkTypes.h
*/
// Post SkUserConfig.h checks and such.
#if !defined(SK_DEBUG) && !defined(SK_RELEASE)
#ifdef NDEBUG
#define SK_RELEASE
#else
#define SK_DEBUG
#endif
#endif
#if defined(SK_DEBUG) && defined(SK_RELEASE)
# error "cannot define both SK_DEBUG and SK_RELEASE"
#elif !defined(SK_DEBUG) && !defined(SK_RELEASE)
# error "must define either SK_DEBUG or SK_RELEASE"
#endif
#if defined(SK_CPU_LENDIAN) && defined(SK_CPU_BENDIAN)
# error "cannot define both SK_CPU_LENDIAN and SK_CPU_BENDIAN"
#elif !defined(SK_CPU_LENDIAN) && !defined(SK_CPU_BENDIAN)
# error "must define either SK_CPU_LENDIAN or SK_CPU_BENDIAN"
#endif
#if defined(SK_CPU_BENDIAN) && !defined(I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN)
#error "The Skia team is not endian-savvy enough to support big-endian CPUs."
#error "If you still want to use Skia,"
#error "please define I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN."
#endif
#if !defined(SK_ATTRIBUTE)
# if defined(__clang__) || defined(__GNUC__)
# define SK_ATTRIBUTE(attr) __attribute__((attr))
# else
# define SK_ATTRIBUTE(attr)
# endif
#endif
#if !defined(SK_SUPPORT_GPU)
# define SK_SUPPORT_GPU 1
#endif
/**
* If GPU is enabled but no GPU backends are enabled then enable GL by default.
* Traditionally clients have relied on Skia always building with the GL backend
* and opting in to additional backends. TODO: Require explicit opt in for GL.
*/
#if SK_SUPPORT_GPU
# if !defined(SK_GL) && !defined(SK_VULKAN) && !defined(SK_METAL)
# define SK_GL
# endif
#endif
#if !defined(SK_SUPPORT_ATLAS_TEXT)
# define SK_SUPPORT_ATLAS_TEXT 0
#elif SK_SUPPORT_ATLAS_TEXT && !SK_SUPPORT_GPU
# error "SK_SUPPORT_ATLAS_TEXT requires SK_SUPPORT_GPU"
#endif
#if !defined(SkUNREACHABLE)
# if defined(_MSC_VER) && !defined(__clang__)
# define SkUNREACHABLE __assume(false)
# else
# define SkUNREACHABLE __builtin_unreachable()
# endif
#endif
#if defined(SK_BUILD_FOR_GOOGLE3)
void SkDebugfForDumpStackTrace(const char* data, void* unused);
void DumpStackTrace(int skip_count, void w(const char*, void*), void* arg);
# define SK_DUMP_GOOGLE3_STACK() DumpStackTrace(0, SkDebugfForDumpStackTrace, nullptr)
#else
# define SK_DUMP_GOOGLE3_STACK()
#endif
#ifdef SK_BUILD_FOR_WIN
// Lets visual studio follow error back to source
#define SK_DUMP_LINE_FORMAT(message) \
SkDebugf("%s(%d): fatal error: \"%s\"\n", __FILE__, __LINE__, message)
#else
#define SK_DUMP_LINE_FORMAT(message) \
SkDebugf("%s:%d: fatal error: \"%s\"\n", __FILE__, __LINE__, message)
#endif
#ifndef SK_ABORT
# define SK_ABORT(message) \
do { \
SK_DUMP_LINE_FORMAT(message); \
SK_DUMP_GOOGLE3_STACK(); \
sk_abort_no_print(); \
SkUNREACHABLE; \
} while (false)
#endif
// If SK_R32_SHIFT is set, we'll use that to choose RGBA or BGRA.
// If not, we'll default to RGBA everywhere except BGRA on Windows.
#if defined(SK_R32_SHIFT)
static_assert(SK_R32_SHIFT == 0 || SK_R32_SHIFT == 16, "");
#elif defined(SK_BUILD_FOR_WIN)
#define SK_R32_SHIFT 16
#else
#define SK_R32_SHIFT 0
#endif
#if defined(SK_B32_SHIFT)
static_assert(SK_B32_SHIFT == (16-SK_R32_SHIFT), "");
#else
#define SK_B32_SHIFT (16-SK_R32_SHIFT)
#endif
#define SK_G32_SHIFT 8
#define SK_A32_SHIFT 24
/**
* SK_PMCOLOR_BYTE_ORDER can be used to query the byte order of SkPMColor at compile time. The
* relationship between the byte order and shift values depends on machine endianness. If the shift
* order is R=0, G=8, B=16, A=24 then ((char*)&pmcolor)[0] will produce the R channel on a little
* endian machine and the A channel on a big endian machine. Thus, given those shifts values,
* SK_PMCOLOR_BYTE_ORDER(R,G,B,A) will be true on a little endian machine and
* SK_PMCOLOR_BYTE_ORDER(A,B,G,R) will be true on a big endian machine.
*/
#ifdef SK_CPU_BENDIAN
# define SK_PMCOLOR_BYTE_ORDER(C0, C1, C2, C3) \
(SK_ ## C3 ## 32_SHIFT == 0 && \
SK_ ## C2 ## 32_SHIFT == 8 && \
SK_ ## C1 ## 32_SHIFT == 16 && \
SK_ ## C0 ## 32_SHIFT == 24)
#else
# define SK_PMCOLOR_BYTE_ORDER(C0, C1, C2, C3) \
(SK_ ## C0 ## 32_SHIFT == 0 && \
SK_ ## C1 ## 32_SHIFT == 8 && \
SK_ ## C2 ## 32_SHIFT == 16 && \
SK_ ## C3 ## 32_SHIFT == 24)
#endif
#if defined SK_DEBUG && defined SK_BUILD_FOR_WIN
#ifdef free
#undef free
#endif
#include <crtdbg.h>
#undef free
#endif
#if !defined(SK_UNUSED)
# if !defined(__clang__) && defined(_MSC_VER)
# define SK_UNUSED __pragma(warning(suppress:4189))
# else
# define SK_UNUSED SK_ATTRIBUTE(unused)
# endif
#endif
/**
* If your judgment is better than the compiler's (i.e. you've profiled it),
* you can use SK_ALWAYS_INLINE to force inlining. E.g.
* inline void someMethod() { ... } // may not be inlined
* SK_ALWAYS_INLINE void someMethod() { ... } // should always be inlined
*/
#if !defined(SK_ALWAYS_INLINE)
# if defined(SK_BUILD_FOR_WIN)
# define SK_ALWAYS_INLINE __forceinline
# else
# define SK_ALWAYS_INLINE SK_ATTRIBUTE(always_inline) inline
# endif
#endif
/**
* If your judgment is better than the compiler's (i.e. you've profiled it),
* you can use SK_NEVER_INLINE to prevent inlining.
*/
#if !defined(SK_NEVER_INLINE)
# if defined(SK_BUILD_FOR_WIN)
# define SK_NEVER_INLINE __declspec(noinline)
# else
# define SK_NEVER_INLINE SK_ATTRIBUTE(noinline)
# endif
#endif
#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE1
#define SK_PREFETCH(ptr) _mm_prefetch(reinterpret_cast<const char*>(ptr), _MM_HINT_T0)
#elif defined(__GNUC__)
#define SK_PREFETCH(ptr) __builtin_prefetch(ptr)
#else
#define SK_PREFETCH(ptr)
#endif
#ifndef SK_PRINTF_LIKE
# if defined(__clang__) || defined(__GNUC__)
# define SK_PRINTF_LIKE(A, B) __attribute__((format(printf, (A), (B))))
# else
# define SK_PRINTF_LIKE(A, B)
# endif
#endif
#ifndef SK_SIZE_T_SPECIFIER
# if defined(_MSC_VER) && !defined(__clang__)
# define SK_SIZE_T_SPECIFIER "%Iu"
# else
# define SK_SIZE_T_SPECIFIER "%zu"
# endif
#endif
#ifndef SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
#define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0
#endif
#if !defined(SK_GAMMA_EXPONENT)
#define SK_GAMMA_EXPONENT (0.0f) // SRGB
#endif
#ifndef GR_TEST_UTILS
# define GR_TEST_UTILS 0
#endif
#if defined(SK_HISTOGRAM_ENUMERATION) && defined(SK_HISTOGRAM_BOOLEAN)
# define SK_HISTOGRAMS_ENABLED 1
#else
# define SK_HISTOGRAMS_ENABLED 0
#endif
#ifndef SK_HISTOGRAM_BOOLEAN
# define SK_HISTOGRAM_BOOLEAN(name, value)
#endif
#ifndef SK_HISTOGRAM_ENUMERATION
# define SK_HISTOGRAM_ENUMERATION(name, value, boundary_value)
#endif
#ifndef SK_DISABLE_LEGACY_SHADERCONTEXT
#define SK_ENABLE_LEGACY_SHADERCONTEXT
#endif
/** Called internally if we hit an unrecoverable error.
The platform implementation must not return, but should either throw

View File

@ -7,7 +7,7 @@
#ifndef SkPathOps_DEFINED
#define SkPathOps_DEFINED
#include "include/core/SkPreConfig.h"
#include "include/core/SkTypes.h"
#include "include/private/SkTArray.h"
#include "include/private/SkTDArray.h"

View File

@ -47,7 +47,7 @@
#define SK_ACQUIRE_SHARED(...) \
SK_THREAD_ANNOTATION_ATTRIBUTE(acquire_shared_capability(__VA_ARGS__))
// Would be SK_RELEASE, but that is already in use by SkPostConfig.
// Would be SK_RELEASE, but that is already in use as SK_DEBUG vs. SK_RELEASE.
#define SK_RELEASE_CAPABILITY(...) \
SK_THREAD_ANNOTATION_ATTRIBUTE(release_capability(__VA_ARGS__))

View File

@ -23,7 +23,6 @@ ignore = re.compile('|'.join([
r'example/.*',
r'experimental/.*',
r'include/config/.*',
r'include/core/SkPostConfig\.h',
r'include/gpu/mtl/.*',
r'include/gpu/vk/.*',
r'include/ports/SkFontMgr_android\.h',