2008-12-17 15:59:43 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2006 The Android Open Source Project
|
2008-12-17 15:59:43 +00:00
|
|
|
*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkPostConfig_DEFINED
|
|
|
|
#define SkPostConfig_DEFINED
|
|
|
|
|
|
|
|
#if defined(SK_BUILD_FOR_WIN32) || defined(SK_BUILD_FOR_WINCE)
|
2013-12-04 16:40:42 +00:00
|
|
|
# define SK_BUILD_FOR_WIN
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(SK_DEBUG) && defined(SK_RELEASE)
|
2013-12-04 16:40:42 +00:00
|
|
|
# error "cannot define both SK_DEBUG and SK_RELEASE"
|
2008-12-17 15:59:43 +00:00
|
|
|
#elif !defined(SK_DEBUG) && !defined(SK_RELEASE)
|
2013-12-04 16:40:42 +00:00
|
|
|
# error "must define either SK_DEBUG or SK_RELEASE"
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|
|
|
|
|
2013-12-04 16:40:42 +00:00
|
|
|
#if defined(SK_SUPPORT_UNITTEST) && !defined(SK_DEBUG)
|
|
|
|
# error "can't have unittests without debug"
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|
|
|
|
|
2013-12-04 16:40:42 +00:00
|
|
|
/**
|
|
|
|
* Matrix calculations may be float or double.
|
|
|
|
* The default is double, as that is faster given our impl uses doubles
|
|
|
|
* for intermediate calculations.
|
|
|
|
*/
|
2012-11-13 20:12:00 +00:00
|
|
|
#if defined(SK_MSCALAR_IS_DOUBLE) && defined(SK_MSCALAR_IS_FLOAT)
|
2013-12-04 16:40:42 +00:00
|
|
|
# error "cannot define both SK_MSCALAR_IS_DOUBLE and SK_MSCALAR_IS_FLOAT"
|
2012-11-13 20:12:00 +00:00
|
|
|
#elif !defined(SK_MSCALAR_IS_DOUBLE) && !defined(SK_MSCALAR_IS_FLOAT)
|
2013-12-04 16:40:42 +00:00
|
|
|
# define SK_MSCALAR_IS_DOUBLE
|
2012-11-13 20:12:00 +00:00
|
|
|
#endif
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#if defined(SK_CPU_LENDIAN) && defined(SK_CPU_BENDIAN)
|
2013-12-04 16:40:42 +00:00
|
|
|
# error "cannot define both SK_CPU_LENDIAN and SK_CPU_BENDIAN"
|
2008-12-17 15:59:43 +00:00
|
|
|
#elif !defined(SK_CPU_LENDIAN) && !defined(SK_CPU_BENDIAN)
|
2013-12-04 16:40:42 +00:00
|
|
|
# error "must define either SK_CPU_LENDIAN or SK_CPU_BENDIAN"
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|
|
|
|
|
2013-12-04 16:40:42 +00:00
|
|
|
/**
|
|
|
|
* Ensure the port has defined all of SK_X32_SHIFT, or none of them.
|
|
|
|
*/
|
2008-12-17 15:59:43 +00:00
|
|
|
#ifdef SK_A32_SHIFT
|
2013-12-04 16:40:42 +00:00
|
|
|
# if !defined(SK_R32_SHIFT) || !defined(SK_G32_SHIFT) || !defined(SK_B32_SHIFT)
|
|
|
|
# error "all or none of the 32bit SHIFT amounts must be defined"
|
|
|
|
# endif
|
2008-12-17 15:59:43 +00:00
|
|
|
#else
|
2013-12-04 16:40:42 +00:00
|
|
|
# if defined(SK_R32_SHIFT) || defined(SK_G32_SHIFT) || defined(SK_B32_SHIFT)
|
|
|
|
# error "all or none of the 32bit SHIFT amounts must be defined"
|
|
|
|
# endif
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|
|
|
|
|
2011-11-23 21:25:35 +00:00
|
|
|
#if !defined(SK_HAS_COMPILER_FEATURE)
|
2013-12-04 16:40:42 +00:00
|
|
|
# if defined(__has_feature)
|
|
|
|
# define SK_HAS_COMPILER_FEATURE(x) __has_feature(x)
|
|
|
|
# else
|
|
|
|
# define SK_HAS_COMPILER_FEATURE(x) 0
|
|
|
|
# endif
|
2011-11-23 21:25:35 +00:00
|
|
|
#endif
|
|
|
|
|
2013-08-06 18:32:29 +00:00
|
|
|
#if !defined(SK_ATTRIBUTE)
|
2013-12-04 16:40:42 +00:00
|
|
|
# if defined(__clang__) || defined(__GNUC__)
|
|
|
|
# define SK_ATTRIBUTE(attr) __attribute__((attr))
|
|
|
|
# else
|
|
|
|
# define SK_ATTRIBUTE(attr)
|
|
|
|
# endif
|
2013-08-06 18:32:29 +00:00
|
|
|
#endif
|
|
|
|
|
2012-08-02 14:03:32 +00:00
|
|
|
#if !defined(SK_SUPPORT_GPU)
|
2013-12-04 16:40:42 +00:00
|
|
|
# define SK_SUPPORT_GPU 1
|
2012-08-02 14:03:32 +00:00
|
|
|
#endif
|
|
|
|
|
2011-11-23 21:25:35 +00:00
|
|
|
/**
|
|
|
|
* The clang static analyzer likes to know that when the program is not
|
|
|
|
* expected to continue (crash, assertion failure, etc). It will notice that
|
|
|
|
* some combination of parameters lead to a function call that does not return.
|
|
|
|
* It can then make appropriate assumptions about the parameters in code
|
|
|
|
* executed only if the non-returning function was *not* called.
|
|
|
|
*/
|
|
|
|
#if !defined(SkNO_RETURN_HINT)
|
2013-12-04 16:40:42 +00:00
|
|
|
# if SK_HAS_COMPILER_FEATURE(attribute_analyzer_noreturn)
|
|
|
|
static inline void SkNO_RETURN_HINT() __attribute__((analyzer_noreturn));
|
|
|
|
static inline void SkNO_RETURN_HINT() {}
|
|
|
|
# else
|
|
|
|
# define SkNO_RETURN_HINT() do {} while (false)
|
|
|
|
# endif
|
2011-11-23 21:25:35 +00:00
|
|
|
#endif
|
|
|
|
|
2012-04-16 19:10:21 +00:00
|
|
|
#if defined(SK_ZLIB_INCLUDE) && defined(SK_SYSTEM_ZLIB)
|
2013-12-04 16:40:42 +00:00
|
|
|
# error "cannot define both SK_ZLIB_INCLUDE and SK_SYSTEM_ZLIB"
|
2012-04-16 19:10:21 +00:00
|
|
|
#elif defined(SK_ZLIB_INCLUDE) || defined(SK_SYSTEM_ZLIB)
|
2013-12-04 16:40:42 +00:00
|
|
|
# define SK_HAS_ZLIB
|
2012-04-16 19:10:21 +00:00
|
|
|
#endif
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef SkNEW
|
2013-12-04 16:40:42 +00:00
|
|
|
# define SkNEW(type_name) (new type_name)
|
|
|
|
# define SkNEW_ARGS(type_name, args) (new type_name args)
|
|
|
|
# define SkNEW_ARRAY(type_name, count) (new type_name[(count)])
|
|
|
|
# define SkNEW_PLACEMENT(buf, type_name) (new (buf) type_name)
|
|
|
|
# define SkNEW_PLACEMENT_ARGS(buf, type_name, args) (new (buf) type_name args)
|
|
|
|
# define SkDELETE(obj) (delete (obj))
|
|
|
|
# define SkDELETE_ARRAY(array) (delete[] (array))
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef SK_CRASH
|
2014-06-19 14:41:58 +00:00
|
|
|
# ifdef SK_BUILD_FOR_WIN
|
|
|
|
# define SK_CRASH() __debugbreak()
|
2013-12-04 16:40:42 +00:00
|
|
|
# else
|
2014-06-19 14:41:58 +00:00
|
|
|
# if 1 // set to 0 for infinite loop, which can help connecting gdb
|
|
|
|
# define SK_CRASH() do { SkNO_RETURN_HINT(); *(int *)(uintptr_t)0xbbadbeef = 0; } while (false)
|
|
|
|
# else
|
|
|
|
# define SK_CRASH() do { SkNO_RETURN_HINT(); } while (true)
|
|
|
|
# endif
|
2013-12-04 16:40:42 +00:00
|
|
|
# endif
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2013-12-04 16:40:42 +00:00
|
|
|
/**
|
|
|
|
* SK_ENABLE_INST_COUNT controlls printing how many reference counted objects
|
|
|
|
* are still held on exit.
|
|
|
|
* Defaults to 1 in DEBUG and 0 in RELEASE.
|
|
|
|
*/
|
2013-01-15 20:37:04 +00:00
|
|
|
#ifndef SK_ENABLE_INST_COUNT
|
2014-01-17 17:55:02 +00:00
|
|
|
// Only enabled for static builds, because instance counting relies on static
|
|
|
|
// variables in functions defined in header files.
|
2014-10-15 20:53:54 +00:00
|
|
|
# if defined(SK_DEBUG) && !defined(SKIA_DLL)
|
|
|
|
# define SK_ENABLE_INST_COUNT 1
|
2013-12-04 16:40:42 +00:00
|
|
|
# else
|
|
|
|
# define SK_ENABLE_INST_COUNT 0
|
|
|
|
# endif
|
2013-01-15 20:37:04 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#ifdef SK_BUILD_FOR_WIN
|
2013-12-04 16:40:42 +00:00
|
|
|
# ifndef WIN32_LEAN_AND_MEAN
|
|
|
|
# define WIN32_LEAN_AND_MEAN
|
|
|
|
# define WIN32_IS_MEAN_WAS_LOCALLY_DEFINED
|
|
|
|
# endif
|
|
|
|
# ifndef NOMINMAX
|
|
|
|
# define NOMINMAX
|
|
|
|
# define NOMINMAX_WAS_LOCALLY_DEFINED
|
|
|
|
# endif
|
|
|
|
#
|
|
|
|
# include <windows.h>
|
|
|
|
#
|
|
|
|
# ifdef WIN32_IS_MEAN_WAS_LOCALLY_DEFINED
|
|
|
|
# undef WIN32_IS_MEAN_WAS_LOCALLY_DEFINED
|
|
|
|
# undef WIN32_LEAN_AND_MEAN
|
|
|
|
# endif
|
|
|
|
# ifdef NOMINMAX_WAS_LOCALLY_DEFINED
|
|
|
|
# undef NOMINMAX_WAS_LOCALLY_DEFINED
|
|
|
|
# undef NOMINMAX
|
|
|
|
# endif
|
|
|
|
#
|
|
|
|
# ifndef SK_A32_SHIFT
|
|
|
|
# define SK_A32_SHIFT 24
|
|
|
|
# define SK_R32_SHIFT 16
|
|
|
|
# define SK_G32_SHIFT 8
|
|
|
|
# define SK_B32_SHIFT 0
|
|
|
|
# endif
|
|
|
|
#
|
2014-06-19 14:41:58 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef SK_ALWAYSBREAK
|
|
|
|
# ifdef SK_DEBUG
|
|
|
|
# define SK_ALWAYSBREAK(cond) do { \
|
|
|
|
if (cond) break; \
|
|
|
|
SkNO_RETURN_HINT(); \
|
|
|
|
SkDebugf("%s:%d: failed assertion \"%s\"\n", __FILE__, __LINE__, #cond); \
|
|
|
|
SK_CRASH(); \
|
|
|
|
} while (false)
|
|
|
|
# else
|
|
|
|
# define SK_ALWAYSBREAK(cond) do { if (cond) break; SK_CRASH(); } while (false)
|
2013-12-04 16:40:42 +00:00
|
|
|
# endif
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|
|
|
|
|
2013-12-04 16:40:42 +00:00
|
|
|
/**
|
2011-05-19 15:57:44 +00:00
|
|
|
* We check to see if the SHIFT value has already been defined.
|
|
|
|
* if not, we define it ourself to some default values. We default to OpenGL
|
|
|
|
* order (in memory: r,g,b,a)
|
|
|
|
*/
|
|
|
|
#ifndef SK_A32_SHIFT
|
2013-12-04 16:40:42 +00:00
|
|
|
# ifdef SK_CPU_BENDIAN
|
|
|
|
# define SK_R32_SHIFT 24
|
|
|
|
# define SK_G32_SHIFT 16
|
|
|
|
# define SK_B32_SHIFT 8
|
|
|
|
# define SK_A32_SHIFT 0
|
|
|
|
# else
|
|
|
|
# define SK_R32_SHIFT 0
|
|
|
|
# define SK_G32_SHIFT 8
|
|
|
|
# define SK_B32_SHIFT 16
|
|
|
|
# define SK_A32_SHIFT 24
|
|
|
|
# endif
|
2011-05-19 15:57:44 +00:00
|
|
|
#endif
|
|
|
|
|
2013-08-20 20:28:03 +00:00
|
|
|
/**
|
|
|
|
* SkColor has well defined shift values, but SkPMColor is configurable. This
|
|
|
|
* macro is a convenience that returns true if the shift values are equal while
|
|
|
|
* ignoring the machine's endianness.
|
|
|
|
*/
|
|
|
|
#define SK_COLOR_MATCHES_PMCOLOR_BYTE_ORDER \
|
|
|
|
(SK_A32_SHIFT == 24 && SK_R32_SHIFT == 16 && SK_G32_SHIFT == 8 && SK_B32_SHIFT == 0)
|
|
|
|
|
2013-03-19 14:16:31 +00:00
|
|
|
/**
|
|
|
|
* 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
|
2013-12-04 16:40:42 +00:00
|
|
|
# define SK_PMCOLOR_BYTE_ORDER(C0, C1, C2, C3) \
|
2013-03-19 14:16:31 +00:00
|
|
|
(SK_ ## C3 ## 32_SHIFT == 0 && \
|
|
|
|
SK_ ## C2 ## 32_SHIFT == 8 && \
|
|
|
|
SK_ ## C1 ## 32_SHIFT == 16 && \
|
|
|
|
SK_ ## C0 ## 32_SHIFT == 24)
|
|
|
|
#else
|
2013-12-04 16:40:42 +00:00
|
|
|
# define SK_PMCOLOR_BYTE_ORDER(C0, C1, C2, C3) \
|
2013-03-19 14:16:31 +00:00
|
|
|
(SK_ ## C0 ## 32_SHIFT == 0 && \
|
|
|
|
SK_ ## C1 ## 32_SHIFT == 8 && \
|
|
|
|
SK_ ## C2 ## 32_SHIFT == 16 && \
|
|
|
|
SK_ ## C3 ## 32_SHIFT == 24)
|
|
|
|
#endif
|
|
|
|
|
2009-01-08 17:49:50 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2013-12-20 14:24:21 +00:00
|
|
|
// TODO: rebaseline as needed so we can remove this flag entirely.
|
|
|
|
// - all platforms have int64_t now
|
|
|
|
// - we have slightly different fixed math results because of this check
|
|
|
|
// since we don't define this for linux/android
|
2013-08-15 13:43:23 +00:00
|
|
|
#if defined(SK_BUILD_FOR_WIN32) || defined(SK_BUILD_FOR_MAC)
|
2013-12-04 16:40:42 +00:00
|
|
|
# ifndef SkLONGLONG
|
2013-12-20 14:24:21 +00:00
|
|
|
# define SkLONGLONG int64_t
|
2013-12-04 16:40:42 +00:00
|
|
|
# endif
|
2013-08-15 13:43:23 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
2008-12-17 15:59:43 +00:00
|
|
|
#ifndef SK_BUILD_FOR_WINCE
|
2013-12-04 16:40:42 +00:00
|
|
|
# include <string.h>
|
|
|
|
# include <stdlib.h>
|
2008-12-17 15:59:43 +00:00
|
|
|
#else
|
2013-12-04 16:40:42 +00:00
|
|
|
# define _CMNINTRIN_DECLARE_ONLY
|
|
|
|
# include "cmnintrin.h"
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined SK_DEBUG && defined SK_BUILD_FOR_WIN32
|
2013-12-04 16:40:42 +00:00
|
|
|
# ifdef free
|
|
|
|
# undef free
|
|
|
|
# endif
|
|
|
|
# include <crtdbg.h>
|
|
|
|
# undef free
|
|
|
|
#
|
|
|
|
# ifdef SK_DEBUGx
|
|
|
|
# if defined(SK_SIMULATE_FAILED_MALLOC) && defined(__cplusplus)
|
|
|
|
void * operator new(
|
|
|
|
size_t cb,
|
|
|
|
int nBlockUse,
|
|
|
|
const char * szFileName,
|
|
|
|
int nLine,
|
|
|
|
int foo
|
|
|
|
);
|
|
|
|
void * operator new[](
|
|
|
|
size_t cb,
|
|
|
|
int nBlockUse,
|
|
|
|
const char * szFileName,
|
|
|
|
int nLine,
|
|
|
|
int foo
|
|
|
|
);
|
|
|
|
void operator delete(
|
|
|
|
void *pUserData,
|
|
|
|
int, const char*, int, int
|
|
|
|
);
|
|
|
|
void operator delete(
|
|
|
|
void *pUserData
|
|
|
|
);
|
|
|
|
void operator delete[]( void * p );
|
|
|
|
# define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__, 0)
|
|
|
|
# else
|
|
|
|
# define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
|
|
|
|
# endif
|
|
|
|
# define new DEBUG_CLIENTBLOCK
|
|
|
|
# else
|
|
|
|
# define DEBUG_CLIENTBLOCK
|
|
|
|
# endif
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|
|
|
|
|
2011-10-03 16:01:10 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef SK_OVERRIDE
|
2013-12-04 16:40:42 +00:00
|
|
|
# if defined(_MSC_VER)
|
|
|
|
# define SK_OVERRIDE override
|
|
|
|
# elif defined(__clang__)
|
|
|
|
// Using __attribute__((override)) on clang does not appear to always work.
|
|
|
|
// Clang defaults to C++03 and warns about using override. Squelch that. Intentionally no
|
|
|
|
// push/pop here so all users of SK_OVERRIDE ignore the warning too. This is like passing
|
|
|
|
// -Wno-c++11-extensions, except that GCC won't die (because it won't see this pragma).
|
|
|
|
# pragma clang diagnostic ignored "-Wc++11-extensions"
|
|
|
|
#
|
|
|
|
# if __has_feature(cxx_override_control)
|
|
|
|
# define SK_OVERRIDE override
|
|
|
|
# elif defined(__has_extension) && __has_extension(cxx_override_control)
|
|
|
|
# define SK_OVERRIDE override
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# ifndef SK_OVERRIDE
|
|
|
|
# define SK_OVERRIDE
|
|
|
|
# endif
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|
|
|
|
|
2011-12-15 14:16:43 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2013-08-06 18:32:29 +00:00
|
|
|
#if !defined(SK_UNUSED)
|
2013-12-04 16:40:42 +00:00
|
|
|
# define SK_UNUSED SK_ATTRIBUTE(unused)
|
2013-08-06 18:32:29 +00:00
|
|
|
#endif
|
|
|
|
|
2013-10-31 17:28:30 +00:00
|
|
|
#if !defined(SK_ATTR_DEPRECATED)
|
2013-12-04 16:40:42 +00:00
|
|
|
// FIXME: we ignore msg for now...
|
|
|
|
# define SK_ATTR_DEPRECATED(msg) SK_ATTRIBUTE(deprecated)
|
2013-10-31 17:28:30 +00:00
|
|
|
#endif
|
|
|
|
|
2014-04-24 21:51:58 +00:00
|
|
|
#if !defined(SK_ATTR_EXTERNALLY_DEPRECATED)
|
|
|
|
# if !defined(SK_INTERNAL)
|
|
|
|
# define SK_ATTR_EXTERNALLY_DEPRECATED(msg) SK_ATTR_DEPRECATED(msg)
|
|
|
|
# else
|
|
|
|
# define SK_ATTR_EXTERNALLY_DEPRECATED(msg)
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2013-12-04 16:40:42 +00:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2013-11-22 16:56:22 +00:00
|
|
|
#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
|
|
|
|
|
2013-08-06 18:32:29 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2013-11-05 15:03:26 +00:00
|
|
|
#if defined(__clang__) || defined(__GNUC__)
|
2013-12-04 16:40:42 +00:00
|
|
|
# define SK_PREFETCH(ptr) __builtin_prefetch(ptr)
|
|
|
|
# define SK_WRITE_PREFETCH(ptr) __builtin_prefetch(ptr, 1)
|
2013-11-05 15:03:26 +00:00
|
|
|
#else
|
2013-12-04 16:40:42 +00:00
|
|
|
# define SK_PREFETCH(ptr)
|
|
|
|
# define SK_WRITE_PREFETCH(ptr)
|
2013-11-05 15:03:26 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2013-12-04 16:40:42 +00:00
|
|
|
|
2012-07-09 18:22:08 +00:00
|
|
|
#ifndef SK_PRINTF_LIKE
|
2013-12-04 16:40:42 +00:00
|
|
|
# if defined(__clang__) || defined(__GNUC__)
|
|
|
|
# define SK_PRINTF_LIKE(A, B) __attribute__((format(printf, (A), (B))))
|
|
|
|
# else
|
|
|
|
# define SK_PRINTF_LIKE(A, B)
|
|
|
|
# endif
|
2012-07-09 18:22:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef SK_SIZE_T_SPECIFIER
|
2013-12-04 16:40:42 +00:00
|
|
|
# if defined(_MSC_VER)
|
|
|
|
# define SK_SIZE_T_SPECIFIER "%Iu"
|
|
|
|
# else
|
|
|
|
# define SK_SIZE_T_SPECIFIER "%zu"
|
|
|
|
# endif
|
2012-07-09 18:22:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2011-12-15 14:16:43 +00:00
|
|
|
#ifndef SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
|
2013-12-04 16:40:42 +00:00
|
|
|
# define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 1
|
2011-12-15 14:16:43 +00:00
|
|
|
#endif
|
2013-12-04 16:40:42 +00:00
|
|
|
|
2013-12-18 15:27:39 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef SK_ATOMICS_PLATFORM_H
|
2014-03-19 19:28:00 +00:00
|
|
|
# if defined(_MSC_VER)
|
2013-12-18 15:27:39 +00:00
|
|
|
# define SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_win.h"
|
|
|
|
# else
|
|
|
|
# define SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_sync.h"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef SK_MUTEX_PLATFORM_H
|
|
|
|
# if defined(SK_BUILD_FOR_WIN)
|
|
|
|
# define SK_MUTEX_PLATFORM_H "../../src/ports/SkMutex_win.h"
|
|
|
|
# else
|
|
|
|
# define SK_MUTEX_PLATFORM_H "../../src/ports/SkMutex_pthread.h"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2014-05-29 18:24:54 +00:00
|
|
|
#ifndef SK_BARRIERS_PLATFORM_H
|
2014-06-06 13:21:46 +00:00
|
|
|
# if SK_HAS_COMPILER_FEATURE(thread_sanitizer)
|
|
|
|
# define SK_BARRIERS_PLATFORM_H "../../src/ports/SkBarriers_tsan.h"
|
|
|
|
# elif defined(SK_CPU_ARM32) || defined(SK_CPU_ARM64)
|
2014-05-29 18:24:54 +00:00
|
|
|
# define SK_BARRIERS_PLATFORM_H "../../src/ports/SkBarriers_arm.h"
|
|
|
|
# else
|
|
|
|
# define SK_BARRIERS_PLATFORM_H "../../src/ports/SkBarriers_x86.h"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2014-10-01 17:52:52 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef SK_EGL
|
|
|
|
# if defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_NACL)
|
|
|
|
# define SK_EGL 1
|
|
|
|
# else
|
|
|
|
# define SK_EGL 0
|
|
|
|
# endif
|
|
|
|
#endif
|
2014-04-10 22:26:29 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#if defined(SK_GAMMA_EXPONENT) && defined(SK_GAMMA_SRGB)
|
|
|
|
# error "cannot define both SK_GAMMA_EXPONENT and SK_GAMMA_SRGB"
|
|
|
|
#elif defined(SK_GAMMA_SRGB)
|
|
|
|
# define SK_GAMMA_EXPONENT (0.0f)
|
|
|
|
#elif !defined(SK_GAMMA_EXPONENT)
|
|
|
|
# define SK_GAMMA_EXPONENT (2.2f)
|
|
|
|
#endif
|
|
|
|
|
2013-12-04 16:40:42 +00:00
|
|
|
#endif // SkPostConfig_DEFINED
|