18a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/*
2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project
38a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com *
4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file.
68a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com */
78a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
88a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SkPostConfig_DEFINED
98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SkPostConfig_DEFINED
108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined(SK_BUILD_FOR_WIN32) || defined(SK_BUILD_FOR_WINCE)
127fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SK_BUILD_FOR_WIN
138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined(SK_DEBUG) && defined(SK_RELEASE)
167fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  error "cannot define both SK_DEBUG and SK_RELEASE"
178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#elif !defined(SK_DEBUG) && !defined(SK_RELEASE)
187fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  error "must define either SK_DEBUG or SK_RELEASE"
198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
217fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#if defined(SK_SUPPORT_UNITTEST) && !defined(SK_DEBUG)
227fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  error "can't have unittests without debug"
238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
257fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com/**
267fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com * Matrix calculations may be float or double.
277fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com * The default is double, as that is faster given our impl uses doubles
287fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com * for intermediate calculations.
297fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com */
305596a69e9f7884e3042bceba071c468dee52aa7fvollick@chromium.org#if defined(SK_MSCALAR_IS_DOUBLE) && defined(SK_MSCALAR_IS_FLOAT)
317fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  error "cannot define both SK_MSCALAR_IS_DOUBLE and SK_MSCALAR_IS_FLOAT"
325596a69e9f7884e3042bceba071c468dee52aa7fvollick@chromium.org#elif !defined(SK_MSCALAR_IS_DOUBLE) && !defined(SK_MSCALAR_IS_FLOAT)
337fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SK_MSCALAR_IS_DOUBLE
345596a69e9f7884e3042bceba071c468dee52aa7fvollick@chromium.org#endif
355596a69e9f7884e3042bceba071c468dee52aa7fvollick@chromium.org
368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined(SK_CPU_LENDIAN) && defined(SK_CPU_BENDIAN)
377fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  error "cannot define both SK_CPU_LENDIAN and SK_CPU_BENDIAN"
388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#elif !defined(SK_CPU_LENDIAN) && !defined(SK_CPU_BENDIAN)
397fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  error "must define either SK_CPU_LENDIAN or SK_CPU_BENDIAN"
408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
427fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com/**
437fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com * Ensure the port has defined all of SK_X32_SHIFT, or none of them.
447fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com */
458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_A32_SHIFT
467fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  if !defined(SK_R32_SHIFT) || !defined(SK_G32_SHIFT) || !defined(SK_B32_SHIFT)
477fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    error "all or none of the 32bit SHIFT amounts must be defined"
487fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#else
507fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  if defined(SK_R32_SHIFT) || defined(SK_G32_SHIFT) || defined(SK_B32_SHIFT)
517fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    error "all or none of the 32bit SHIFT amounts must be defined"
527fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5504423805455de868b1b468cfe4057cb77f74b6b0bsalomon@google.com#if !defined(SK_HAS_COMPILER_FEATURE)
567fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  if defined(__has_feature)
577fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_HAS_COMPILER_FEATURE(x) __has_feature(x)
587fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  else
597fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_HAS_COMPILER_FEATURE(x) 0
607fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
6104423805455de868b1b468cfe4057cb77f74b6b0bsalomon@google.com#endif
6204423805455de868b1b468cfe4057cb77f74b6b0bsalomon@google.com
635ebbbe53779cfe93741dc66f433107d04da74486bungeman@google.com#if !defined(SK_ATTRIBUTE)
647fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  if defined(__clang__) || defined(__GNUC__)
657fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_ATTRIBUTE(attr) __attribute__((attr))
667fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  else
677fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_ATTRIBUTE(attr)
687fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
695ebbbe53779cfe93741dc66f433107d04da74486bungeman@google.com#endif
705ebbbe53779cfe93741dc66f433107d04da74486bungeman@google.com
71cf8fb1f6f03fc77f9927564f9ef9abeeeec508d2bsalomon@google.com#if !defined(SK_SUPPORT_GPU)
727fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SK_SUPPORT_GPU 1
73cf8fb1f6f03fc77f9927564f9ef9abeeeec508d2bsalomon@google.com#endif
74cf8fb1f6f03fc77f9927564f9ef9abeeeec508d2bsalomon@google.com
7504423805455de868b1b468cfe4057cb77f74b6b0bsalomon@google.com/**
7604423805455de868b1b468cfe4057cb77f74b6b0bsalomon@google.com * The clang static analyzer likes to know that when the program is not
7704423805455de868b1b468cfe4057cb77f74b6b0bsalomon@google.com * expected to continue (crash, assertion failure, etc). It will notice that
7804423805455de868b1b468cfe4057cb77f74b6b0bsalomon@google.com * some combination of parameters lead to a function call that does not return.
7904423805455de868b1b468cfe4057cb77f74b6b0bsalomon@google.com * It can then make appropriate assumptions about the parameters in code
8004423805455de868b1b468cfe4057cb77f74b6b0bsalomon@google.com * executed only if the non-returning function was *not* called.
8104423805455de868b1b468cfe4057cb77f74b6b0bsalomon@google.com */
8204423805455de868b1b468cfe4057cb77f74b6b0bsalomon@google.com#if !defined(SkNO_RETURN_HINT)
837fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  if SK_HAS_COMPILER_FEATURE(attribute_analyzer_noreturn)
847fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com     static inline void SkNO_RETURN_HINT() __attribute__((analyzer_noreturn));
857fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com     static inline void SkNO_RETURN_HINT() {}
867fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  else
877fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SkNO_RETURN_HINT() do {} while (false)
887fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
8904423805455de868b1b468cfe4057cb77f74b6b0bsalomon@google.com#endif
9004423805455de868b1b468cfe4057cb77f74b6b0bsalomon@google.com
91fffb2f1bda1982d451bc249743b8cc414995d6a8justinlin@google.com#if defined(SK_ZLIB_INCLUDE) && defined(SK_SYSTEM_ZLIB)
927fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  error "cannot define both SK_ZLIB_INCLUDE and SK_SYSTEM_ZLIB"
93fffb2f1bda1982d451bc249743b8cc414995d6a8justinlin@google.com#elif defined(SK_ZLIB_INCLUDE) || defined(SK_SYSTEM_ZLIB)
947fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SK_HAS_ZLIB
95fffb2f1bda1982d451bc249743b8cc414995d6a8justinlin@google.com#endif
96fffb2f1bda1982d451bc249743b8cc414995d6a8justinlin@google.com
978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com///////////////////////////////////////////////////////////////////////////////
988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SkNEW
1007fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SkNEW(type_name)                           (new type_name)
1017fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SkNEW_ARGS(type_name, args)                (new type_name args)
1027fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SkNEW_ARRAY(type_name, count)              (new type_name[(count)])
1037fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SkNEW_PLACEMENT(buf, type_name)            (new (buf) type_name)
1047fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SkNEW_PLACEMENT_ARGS(buf, type_name, args) (new (buf) type_name args)
1057fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SkDELETE(obj)                              (delete (obj))
1067fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SkDELETE_ARRAY(array)                      (delete[] (array))
1078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
1088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SK_CRASH
1103f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein#  ifdef SK_BUILD_FOR_WIN
1113f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein#    define SK_CRASH() __debugbreak()
1127fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  else
1133f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein#    if 1   // set to 0 for infinite loop, which can help connecting gdb
1143f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein#      define SK_CRASH() do { SkNO_RETURN_HINT(); *(int *)(uintptr_t)0xbbadbeef = 0; } while (false)
1153f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein#    else
1163f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein#      define SK_CRASH() do { SkNO_RETURN_HINT(); } while (true)
1173f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein#    endif
1187fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
1198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
1208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com///////////////////////////////////////////////////////////////////////////////
1228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1237fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com/**
1247fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com * SK_ENABLE_INST_COUNT controlls printing how many reference counted objects
1257fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com * are still held on exit.
1267fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com * Defaults to 1 in DEBUG and 0 in RELEASE.
1277fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com */
1284e23068b374023d43c4c725138d523721d975892bsalomon@google.com#ifndef SK_ENABLE_INST_COUNT
1297fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  ifdef SK_DEBUG
1302ab1ba055536825552d6b49f0210c4e1531f02f0commit-bot@chromium.org// Only enabled for static builds, because instance counting relies on static
1312ab1ba055536825552d6b49f0210c4e1531f02f0commit-bot@chromium.org// variables in functions defined in header files.
1322ab1ba055536825552d6b49f0210c4e1531f02f0commit-bot@chromium.org#    define SK_ENABLE_INST_COUNT !defined(SKIA_DLL)
1337fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  else
1347fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_ENABLE_INST_COUNT 0
1357fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
1364e23068b374023d43c4c725138d523721d975892bsalomon@google.com#endif
1374e23068b374023d43c4c725138d523721d975892bsalomon@google.com
1384e23068b374023d43c4c725138d523721d975892bsalomon@google.com///////////////////////////////////////////////////////////////////////////////
1394e23068b374023d43c4c725138d523721d975892bsalomon@google.com
1408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_BUILD_FOR_WIN
1417fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  ifndef WIN32_LEAN_AND_MEAN
1427fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define WIN32_LEAN_AND_MEAN
1437fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define WIN32_IS_MEAN_WAS_LOCALLY_DEFINED
1447fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
1457fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  ifndef NOMINMAX
1467fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define NOMINMAX
1477fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define NOMINMAX_WAS_LOCALLY_DEFINED
1487fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
1497fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#
1507fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  include <windows.h>
1517fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#
1527fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  ifdef WIN32_IS_MEAN_WAS_LOCALLY_DEFINED
1537fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    undef WIN32_IS_MEAN_WAS_LOCALLY_DEFINED
1547fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    undef WIN32_LEAN_AND_MEAN
1557fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
1567fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  ifdef NOMINMAX_WAS_LOCALLY_DEFINED
1577fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    undef NOMINMAX_WAS_LOCALLY_DEFINED
1587fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    undef NOMINMAX
1597fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
1607fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#
1617fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  ifndef SK_A32_SHIFT
1627fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_A32_SHIFT 24
1637fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_R32_SHIFT 16
1647fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_G32_SHIFT 8
1657fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_B32_SHIFT 0
1667fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
1677fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#
1683f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein#endif
1693f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein
1703f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein#ifndef SK_ALWAYSBREAK
1713f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein#  ifdef SK_DEBUG
1723f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein#    define SK_ALWAYSBREAK(cond) do { \
1733f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein              if (cond) break; \
1743f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein              SkNO_RETURN_HINT(); \
1753f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein              SkDebugf("%s:%d: failed assertion \"%s\"\n", __FILE__, __LINE__, #cond); \
1763f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein              SK_CRASH(); \
1773f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein        } while (false)
1783f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein#  else
1793f73e8c8d589e0d5a1f75327b4aa22c1e745732dmtklein#    define SK_ALWAYSBREAK(cond) do { if (cond) break; SK_CRASH(); } while (false)
1807fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
1818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
1828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1837fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com/**
18427661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com *  We check to see if the SHIFT value has already been defined.
18527661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com *  if not, we define it ourself to some default values. We default to OpenGL
18627661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com *  order (in memory: r,g,b,a)
18727661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com */
18827661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com#ifndef SK_A32_SHIFT
1897fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  ifdef SK_CPU_BENDIAN
1907fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_R32_SHIFT    24
1917fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_G32_SHIFT    16
1927fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_B32_SHIFT    8
1937fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_A32_SHIFT    0
1947fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  else
1957fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_R32_SHIFT    0
1967fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_G32_SHIFT    8
1977fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_B32_SHIFT    16
1987fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_A32_SHIFT    24
1997fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
20027661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com#endif
20127661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com
202e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org/**
2032b343cc2557aa7921fa8b04bf6800ebf37af186bdjsollen@google.com * SkColor has well defined shift values, but SkPMColor is configurable. This
2042b343cc2557aa7921fa8b04bf6800ebf37af186bdjsollen@google.com * macro is a convenience that returns true if the shift values are equal while
2052b343cc2557aa7921fa8b04bf6800ebf37af186bdjsollen@google.com * ignoring the machine's endianness.
2062b343cc2557aa7921fa8b04bf6800ebf37af186bdjsollen@google.com */
2072b343cc2557aa7921fa8b04bf6800ebf37af186bdjsollen@google.com#define SK_COLOR_MATCHES_PMCOLOR_BYTE_ORDER \
2082b343cc2557aa7921fa8b04bf6800ebf37af186bdjsollen@google.com    (SK_A32_SHIFT == 24 && SK_R32_SHIFT == 16 && SK_G32_SHIFT == 8 && SK_B32_SHIFT == 0)
2092b343cc2557aa7921fa8b04bf6800ebf37af186bdjsollen@google.com
2102b343cc2557aa7921fa8b04bf6800ebf37af186bdjsollen@google.com/**
211e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org * SK_PMCOLOR_BYTE_ORDER can be used to query the byte order of SkPMColor at compile time. The
212e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org * relationship between the byte order and shift values depends on machine endianness. If the shift
213e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org * order is R=0, G=8, B=16, A=24 then ((char*)&pmcolor)[0] will produce the R channel on a little
214e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org * endian machine and the A channel on a big endian machine. Thus, given those shifts values,
215e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org * SK_PMCOLOR_BYTE_ORDER(R,G,B,A) will be true on a little endian machine and
216e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org * SK_PMCOLOR_BYTE_ORDER(A,B,G,R) will be true on a big endian machine.
217e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org */
218e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org#ifdef SK_CPU_BENDIAN
2197fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SK_PMCOLOR_BYTE_ORDER(C0, C1, C2, C3)     \
220e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org        (SK_ ## C3 ## 32_SHIFT == 0  &&             \
221e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org         SK_ ## C2 ## 32_SHIFT == 8  &&             \
222e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org         SK_ ## C1 ## 32_SHIFT == 16 &&             \
223e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org         SK_ ## C0 ## 32_SHIFT == 24)
224e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org#else
2257fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SK_PMCOLOR_BYTE_ORDER(C0, C1, C2, C3)     \
226e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org        (SK_ ## C0 ## 32_SHIFT == 0  &&             \
227e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org         SK_ ## C1 ## 32_SHIFT == 8  &&             \
228e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org         SK_ ## C2 ## 32_SHIFT == 16 &&             \
229e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org         SK_ ## C3 ## 32_SHIFT == 24)
230e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org#endif
231e4657ed7e1f4ae5b1834b398724c718f21589ca3commit-bot@chromium.org
2325c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com//////////////////////////////////////////////////////////////////////
2335c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com
23401c41a556e0ef0ae2338a1b5ae110a501e1ed0a8reed@google.com// TODO: rebaseline as needed so we can remove this flag entirely.
23501c41a556e0ef0ae2338a1b5ae110a501e1ed0a8reed@google.com//  - all platforms have int64_t now
23601c41a556e0ef0ae2338a1b5ae110a501e1ed0a8reed@google.com//  - we have slightly different fixed math results because of this check
23701c41a556e0ef0ae2338a1b5ae110a501e1ed0a8reed@google.com//    since we don't define this for linux/android
2380e6e8cc627242cc7e301401cfe112ba98a008101robertphillips@google.com#if defined(SK_BUILD_FOR_WIN32) || defined(SK_BUILD_FOR_MAC)
2397fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  ifndef SkLONGLONG
24001c41a556e0ef0ae2338a1b5ae110a501e1ed0a8reed@google.com#    define SkLONGLONG int64_t
2417fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
2420e6e8cc627242cc7e301401cfe112ba98a008101robertphillips@google.com#endif
2430e6e8cc627242cc7e301401cfe112ba98a008101robertphillips@google.com
2440e6e8cc627242cc7e301401cfe112ba98a008101robertphillips@google.com//////////////////////////////////////////////////////////////////////////////////////////////
2458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SK_BUILD_FOR_WINCE
2467fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  include <string.h>
2477fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  include <stdlib.h>
2488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#else
2497fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define _CMNINTRIN_DECLARE_ONLY
2507fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  include "cmnintrin.h"
2518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
2528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined SK_DEBUG && defined SK_BUILD_FOR_WIN32
2547fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  ifdef free
2557fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    undef free
2567fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
2577fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  include <crtdbg.h>
2587fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  undef free
2597fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#
2607fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  ifdef SK_DEBUGx
2617fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    if defined(SK_SIMULATE_FAILED_MALLOC) && defined(__cplusplus)
2627fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com       void * operator new(
2637fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           size_t cb,
2647fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           int nBlockUse,
2657fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           const char * szFileName,
2667fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           int nLine,
2677fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           int foo
2687fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           );
2697fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com       void * operator new[](
2707fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           size_t cb,
2717fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           int nBlockUse,
2727fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           const char * szFileName,
2737fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           int nLine,
2747fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           int foo
2757fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           );
2767fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com       void operator delete(
2777fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           void *pUserData,
2787fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           int, const char*, int, int
2797fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           );
2807fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com       void operator delete(
2817fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           void *pUserData
2827fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com           );
2837fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com       void operator delete[]( void * p );
2847fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#      define DEBUG_CLIENTBLOCK   new( _CLIENT_BLOCK, __FILE__, __LINE__, 0)
2857fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    else
2867fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#      define DEBUG_CLIENTBLOCK   new( _CLIENT_BLOCK, __FILE__, __LINE__)
2877fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    endif
2887fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define new DEBUG_CLIENTBLOCK
2897fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  else
2907fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define DEBUG_CLIENTBLOCK
2917fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
2928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
2938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2941341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com//////////////////////////////////////////////////////////////////////
2951341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com
2961341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com#ifndef SK_OVERRIDE
2977fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  if defined(_MSC_VER)
2987fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_OVERRIDE override
2997fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  elif defined(__clang__)
3007fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com     // Using __attribute__((override)) on clang does not appear to always work.
3017fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com     // Clang defaults to C++03 and warns about using override. Squelch that. Intentionally no
3027fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com     // push/pop here so all users of SK_OVERRIDE ignore the warning too. This is like passing
3037fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com     // -Wno-c++11-extensions, except that GCC won't die (because it won't see this pragma).
3047fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    pragma clang diagnostic ignored "-Wc++11-extensions"
3057fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#
3067fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    if __has_feature(cxx_override_control)
3077fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#      define SK_OVERRIDE override
3087fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    elif defined(__has_extension) && __has_extension(cxx_override_control)
3097fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#      define SK_OVERRIDE override
3107fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    endif
3117fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
3127fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  ifndef SK_OVERRIDE
3137fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_OVERRIDE
3147fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
3158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
3168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
317d26147adbbdca85f07dff432025afee0c8614387caryclark@google.com//////////////////////////////////////////////////////////////////////
318d26147adbbdca85f07dff432025afee0c8614387caryclark@google.com
3195ebbbe53779cfe93741dc66f433107d04da74486bungeman@google.com#if !defined(SK_UNUSED)
3207fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SK_UNUSED SK_ATTRIBUTE(unused)
3215ebbbe53779cfe93741dc66f433107d04da74486bungeman@google.com#endif
3225ebbbe53779cfe93741dc66f433107d04da74486bungeman@google.com
3234469938e92d779dff05e745559e67907bbf21e78reed@google.com#if !defined(SK_ATTR_DEPRECATED)
3247fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com   // FIXME: we ignore msg for now...
3257fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SK_ATTR_DEPRECATED(msg) SK_ATTRIBUTE(deprecated)
3264469938e92d779dff05e745559e67907bbf21e78reed@google.com#endif
3274469938e92d779dff05e745559e67907bbf21e78reed@google.com
328d70fa2013adccaa52d1f3e6ca501a4d4ab1520f3commit-bot@chromium.org#if !defined(SK_ATTR_EXTERNALLY_DEPRECATED)
329d70fa2013adccaa52d1f3e6ca501a4d4ab1520f3commit-bot@chromium.org#  if !defined(SK_INTERNAL)
330d70fa2013adccaa52d1f3e6ca501a4d4ab1520f3commit-bot@chromium.org#    define SK_ATTR_EXTERNALLY_DEPRECATED(msg) SK_ATTR_DEPRECATED(msg)
331d70fa2013adccaa52d1f3e6ca501a4d4ab1520f3commit-bot@chromium.org#  else
332d70fa2013adccaa52d1f3e6ca501a4d4ab1520f3commit-bot@chromium.org#    define SK_ATTR_EXTERNALLY_DEPRECATED(msg)
333d70fa2013adccaa52d1f3e6ca501a4d4ab1520f3commit-bot@chromium.org#  endif
334d70fa2013adccaa52d1f3e6ca501a4d4ab1520f3commit-bot@chromium.org#endif
335d70fa2013adccaa52d1f3e6ca501a4d4ab1520f3commit-bot@chromium.org
3367fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com/**
3377fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com * If your judgment is better than the compiler's (i.e. you've profiled it),
3387fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com * you can use SK_ALWAYS_INLINE to force inlining. E.g.
3397fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com *     inline void someMethod() { ... }             // may not be inlined
3407fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com *     SK_ALWAYS_INLINE void someMethod() { ... }   // should always be inlined
3417fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com */
3421950d5f58f56f6a0fb5dc5aa3f5caac991f0b2cemtklein@google.com#if !defined(SK_ALWAYS_INLINE)
3431950d5f58f56f6a0fb5dc5aa3f5caac991f0b2cemtklein@google.com#  if defined(SK_BUILD_FOR_WIN)
3441950d5f58f56f6a0fb5dc5aa3f5caac991f0b2cemtklein@google.com#    define SK_ALWAYS_INLINE __forceinline
3451950d5f58f56f6a0fb5dc5aa3f5caac991f0b2cemtklein@google.com#  else
3461950d5f58f56f6a0fb5dc5aa3f5caac991f0b2cemtklein@google.com#    define SK_ALWAYS_INLINE SK_ATTRIBUTE(always_inline) inline
3471950d5f58f56f6a0fb5dc5aa3f5caac991f0b2cemtklein@google.com#  endif
3481950d5f58f56f6a0fb5dc5aa3f5caac991f0b2cemtklein@google.com#endif
3491950d5f58f56f6a0fb5dc5aa3f5caac991f0b2cemtklein@google.com
3505ebbbe53779cfe93741dc66f433107d04da74486bungeman@google.com//////////////////////////////////////////////////////////////////////
3515ebbbe53779cfe93741dc66f433107d04da74486bungeman@google.com
352fedf13d73a6d6f1921ce5f449bb6e34e9d8e14e4commit-bot@chromium.org#if defined(__clang__) || defined(__GNUC__)
3537fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SK_PREFETCH(ptr) __builtin_prefetch(ptr)
3547fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SK_WRITE_PREFETCH(ptr) __builtin_prefetch(ptr, 1)
355fedf13d73a6d6f1921ce5f449bb6e34e9d8e14e4commit-bot@chromium.org#else
3567fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SK_PREFETCH(ptr)
3577fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SK_WRITE_PREFETCH(ptr)
358fedf13d73a6d6f1921ce5f449bb6e34e9d8e14e4commit-bot@chromium.org#endif
359fedf13d73a6d6f1921ce5f449bb6e34e9d8e14e4commit-bot@chromium.org
360fedf13d73a6d6f1921ce5f449bb6e34e9d8e14e4commit-bot@chromium.org//////////////////////////////////////////////////////////////////////
3617fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com
3623a67a668dbdc3a6bba68700a6dfdef8164ae0c69senorblanco@chromium.org#ifndef SK_PRINTF_LIKE
3637fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  if defined(__clang__) || defined(__GNUC__)
3647fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_PRINTF_LIKE(A, B) __attribute__((format(printf, (A), (B))))
3657fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  else
3667fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_PRINTF_LIKE(A, B)
3677fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
3683a67a668dbdc3a6bba68700a6dfdef8164ae0c69senorblanco@chromium.org#endif
3693a67a668dbdc3a6bba68700a6dfdef8164ae0c69senorblanco@chromium.org
3703a67a668dbdc3a6bba68700a6dfdef8164ae0c69senorblanco@chromium.org//////////////////////////////////////////////////////////////////////
3713a67a668dbdc3a6bba68700a6dfdef8164ae0c69senorblanco@chromium.org
3723a67a668dbdc3a6bba68700a6dfdef8164ae0c69senorblanco@chromium.org#ifndef SK_SIZE_T_SPECIFIER
3737fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  if defined(_MSC_VER)
3747fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_SIZE_T_SPECIFIER "%Iu"
3757fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  else
3767fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#    define SK_SIZE_T_SPECIFIER "%zu"
3777fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  endif
3783a67a668dbdc3a6bba68700a6dfdef8164ae0c69senorblanco@chromium.org#endif
3793a67a668dbdc3a6bba68700a6dfdef8164ae0c69senorblanco@chromium.org
3803a67a668dbdc3a6bba68700a6dfdef8164ae0c69senorblanco@chromium.org//////////////////////////////////////////////////////////////////////
3813a67a668dbdc3a6bba68700a6dfdef8164ae0c69senorblanco@chromium.org
382d26147adbbdca85f07dff432025afee0c8614387caryclark@google.com#ifndef SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
3837fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#  define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 1
384d26147adbbdca85f07dff432025afee0c8614387caryclark@google.com#endif
3857fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com
386d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com//////////////////////////////////////////////////////////////////////
387d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com
388d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com#ifndef SK_ATOMICS_PLATFORM_H
3898e13a159f3a54f761ab80b16377015e5a9077411commit-bot@chromium.org#  if defined(_MSC_VER)
390d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com#    define SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_win.h"
391d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com#  else
392d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com#    define SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_sync.h"
393d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com#  endif
394d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com#endif
395d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com
396d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com#ifndef SK_MUTEX_PLATFORM_H
397d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com#  if defined(SK_BUILD_FOR_WIN)
398d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com#    define SK_MUTEX_PLATFORM_H "../../src/ports/SkMutex_win.h"
399d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com#  else
400d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com#    define SK_MUTEX_PLATFORM_H "../../src/ports/SkMutex_pthread.h"
401d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com#  endif
402d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com#endif
403d9947f605a335363b0a0541d6d8cb7a7113ed788bungeman@google.com
404448e2a3b3935d91e7bf84dc5b0367b92d2e2a518commit-bot@chromium.org#ifndef SK_BARRIERS_PLATFORM_H
405a8928b745a7158a432033a28c49fb0f0450ccf6emtklein#  if SK_HAS_COMPILER_FEATURE(thread_sanitizer)
406a8928b745a7158a432033a28c49fb0f0450ccf6emtklein#    define SK_BARRIERS_PLATFORM_H "../../src/ports/SkBarriers_tsan.h"
407a8928b745a7158a432033a28c49fb0f0450ccf6emtklein#  elif defined(SK_CPU_ARM32) || defined(SK_CPU_ARM64)
408448e2a3b3935d91e7bf84dc5b0367b92d2e2a518commit-bot@chromium.org#    define SK_BARRIERS_PLATFORM_H "../../src/ports/SkBarriers_arm.h"
409448e2a3b3935d91e7bf84dc5b0367b92d2e2a518commit-bot@chromium.org#  else
410448e2a3b3935d91e7bf84dc5b0367b92d2e2a518commit-bot@chromium.org#    define SK_BARRIERS_PLATFORM_H "../../src/ports/SkBarriers_x86.h"
411448e2a3b3935d91e7bf84dc5b0367b92d2e2a518commit-bot@chromium.org#  endif
412448e2a3b3935d91e7bf84dc5b0367b92d2e2a518commit-bot@chromium.org#endif
413448e2a3b3935d91e7bf84dc5b0367b92d2e2a518commit-bot@chromium.org
4144770a3b7a290ee5e44662b8dfbc0bc9196f00930bungeman@google.com
4154770a3b7a290ee5e44662b8dfbc0bc9196f00930bungeman@google.com//////////////////////////////////////////////////////////////////////
4164770a3b7a290ee5e44662b8dfbc0bc9196f00930bungeman@google.com
4174770a3b7a290ee5e44662b8dfbc0bc9196f00930bungeman@google.com#if defined(SK_GAMMA_EXPONENT) && defined(SK_GAMMA_SRGB)
4184770a3b7a290ee5e44662b8dfbc0bc9196f00930bungeman@google.com#  error "cannot define both SK_GAMMA_EXPONENT and SK_GAMMA_SRGB"
4194770a3b7a290ee5e44662b8dfbc0bc9196f00930bungeman@google.com#elif defined(SK_GAMMA_SRGB)
4204770a3b7a290ee5e44662b8dfbc0bc9196f00930bungeman@google.com#  define SK_GAMMA_EXPONENT (0.0f)
4214770a3b7a290ee5e44662b8dfbc0bc9196f00930bungeman@google.com#elif !defined(SK_GAMMA_EXPONENT)
4224770a3b7a290ee5e44662b8dfbc0bc9196f00930bungeman@google.com#  define SK_GAMMA_EXPONENT (2.2f)
4234770a3b7a290ee5e44662b8dfbc0bc9196f00930bungeman@google.com#endif
4244770a3b7a290ee5e44662b8dfbc0bc9196f00930bungeman@google.com
4257fd1f50bfb9af23c7c1f7e8450f5a0db67ca5fdcbungeman@google.com#endif // SkPostConfig_DEFINED
426