SkPostConfig.h revision 1341304449a60713bf9c8ea2e9489f35533f037a
1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 28a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/* 3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project 48a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be 6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file. 78a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com */ 88a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 9ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SkPostConfig_DEFINED 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SkPostConfig_DEFINED 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined(SK_BUILD_FOR_WIN32) || defined(SK_BUILD_FOR_WINCE) 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SK_BUILD_FOR_WIN 158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined(SK_DEBUG) && defined(SK_RELEASE) 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #error "cannot define both SK_DEBUG and SK_RELEASE" 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#elif !defined(SK_DEBUG) && !defined(SK_RELEASE) 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #error "must define either SK_DEBUG or SK_RELEASE" 218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined SK_SUPPORT_UNITTEST && !defined(SK_DEBUG) 248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #error "can't have unittests without debug" 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined(SK_SCALAR_IS_FIXED) && defined(SK_SCALAR_IS_FLOAT) 288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #error "cannot define both SK_SCALAR_IS_FIXED and SK_SCALAR_IS_FLOAT" 298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#elif !defined(SK_SCALAR_IS_FIXED) && !defined(SK_SCALAR_IS_FLOAT) 308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #ifdef SK_CAN_USE_FLOAT 318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SK_SCALAR_IS_FLOAT 328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #else 338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SK_SCALAR_IS_FIXED 348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #endif 358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined(SK_SCALAR_IS_FLOAT) && !defined(SK_CAN_USE_FLOAT) 388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SK_CAN_USE_FLOAT 398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // we do nothing in the else case: fixed-scalars can have floats or not 408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined(SK_CPU_LENDIAN) && defined(SK_CPU_BENDIAN) 438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #error "cannot define both SK_CPU_LENDIAN and SK_CPU_BENDIAN" 448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#elif !defined(SK_CPU_LENDIAN) && !defined(SK_CPU_BENDIAN) 458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #error "must define either SK_CPU_LENDIAN or SK_CPU_BENDIAN" 468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// ensure the port has defined all of these, or none of them 498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_A32_SHIFT 508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #if !defined(SK_R32_SHIFT) || !defined(SK_G32_SHIFT) || !defined(SK_B32_SHIFT) 518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #error "all or none of the 32bit SHIFT amounts must be defined" 528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #endif 538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#else 548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #if defined(SK_R32_SHIFT) || defined(SK_G32_SHIFT) || defined(SK_B32_SHIFT) 558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #error "all or none of the 32bit SHIFT amounts must be defined" 568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #endif 578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/////////////////////////////////////////////////////////////////////////////// 608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SkNEW 628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SkNEW(type_name) new type_name 638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SkNEW_ARGS(type_name, args) new type_name args 648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SkNEW_ARRAY(type_name, count) new type_name[count] 658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SkDELETE(obj) delete obj 668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SkDELETE_ARRAY(array) delete[] array 678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SK_CRASH 708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if 1 // set to 0 for infinite loop, which can help connecting gdb 718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SK_CRASH() *(int *)(uintptr_t)0xbbadbeef = 0 728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#else 738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SK_CRASH() do {} while (true) 748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/////////////////////////////////////////////////////////////////////////////// 788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined(SK_SOFTWARE_FLOAT) && defined(SK_SCALAR_IS_FLOAT) 808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // if this is defined, we convert floats to 2scompliment ints for compares 818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #ifndef SK_SCALAR_SLOW_COMPARES 828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SK_SCALAR_SLOW_COMPARES 838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #endif 845c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com #ifndef SK_USE_FLOATBITS 855c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com #define SK_USE_FLOATBITS 865c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com #endif 878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_BUILD_FOR_WIN 9016690af1c21dead3eedb25ebd0a4b9a091684ed4reed@android.com // we want lean_and_mean when we include windows.h 9116690af1c21dead3eedb25ebd0a4b9a091684ed4reed@android.com #ifndef WIN32_LEAN_AND_MEAN 9216690af1c21dead3eedb25ebd0a4b9a091684ed4reed@android.com #define WIN32_LEAN_AND_MEAN 9316690af1c21dead3eedb25ebd0a4b9a091684ed4reed@android.com #define WIN32_IS_MEAN_WAS_LOCALLY_DEFINED 9416690af1c21dead3eedb25ebd0a4b9a091684ed4reed@android.com #endif 9516690af1c21dead3eedb25ebd0a4b9a091684ed4reed@android.com 968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #include <windows.h> 9716690af1c21dead3eedb25ebd0a4b9a091684ed4reed@android.com 9816690af1c21dead3eedb25ebd0a4b9a091684ed4reed@android.com #ifdef WIN32_IS_MEAN_WAS_LOCALLY_DEFINED 9916690af1c21dead3eedb25ebd0a4b9a091684ed4reed@android.com #undef WIN32_LEAN_AND_MEAN 10016690af1c21dead3eedb25ebd0a4b9a091684ed4reed@android.com #endif 1018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #ifndef SK_DEBUGBREAK 103f2b98d67dcb6fcb3120feede9c72016fc7b3ead8reed@android.com #define SK_DEBUGBREAK(cond) do { if (!(cond)) __debugbreak(); } while (false) 1048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #endif 105f2b98d67dcb6fcb3120feede9c72016fc7b3ead8reed@android.com 106f2b98d67dcb6fcb3120feede9c72016fc7b3ead8reed@android.com #ifndef SK_A32_SHIFT 107f2b98d67dcb6fcb3120feede9c72016fc7b3ead8reed@android.com #define SK_A32_SHIFT 24 108f2b98d67dcb6fcb3120feede9c72016fc7b3ead8reed@android.com #define SK_R32_SHIFT 16 109f2b98d67dcb6fcb3120feede9c72016fc7b3ead8reed@android.com #define SK_G32_SHIFT 8 110f2b98d67dcb6fcb3120feede9c72016fc7b3ead8reed@android.com #define SK_B32_SHIFT 0 111f2b98d67dcb6fcb3120feede9c72016fc7b3ead8reed@android.com #endif 112f2b98d67dcb6fcb3120feede9c72016fc7b3ead8reed@android.com 1138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#elif defined(SK_BUILD_FOR_MAC) 1148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #ifndef SK_DEBUGBREAK 1158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SK_DEBUGBREAK(cond) do { if (!(cond)) SK_CRASH(); } while (false) 1168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #endif 1178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#else 1188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #ifdef SK_DEBUG 1198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #include <stdio.h> 1208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #ifndef SK_DEBUGBREAK 1218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SK_DEBUGBREAK(cond) do { if (cond) break; \ 1228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s:%d: failed assertion \"%s\"\n", \ 1238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com __FILE__, __LINE__, #cond); SK_CRASH(); } while (false) 1248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #endif 1258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #endif 1268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 12827661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com/* 12927661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com * We check to see if the SHIFT value has already been defined. 13027661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com * if not, we define it ourself to some default values. We default to OpenGL 13127661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com * order (in memory: r,g,b,a) 13227661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com */ 13327661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com#ifndef SK_A32_SHIFT 13427661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com #ifdef SK_CPU_BENDIAN 13527661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com #define SK_R32_SHIFT 24 13627661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com #define SK_G32_SHIFT 16 13727661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com #define SK_B32_SHIFT 8 13827661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com #define SK_A32_SHIFT 0 13927661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com #else 14027661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com #define SK_R32_SHIFT 0 14127661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com #define SK_G32_SHIFT 8 14227661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com #define SK_B32_SHIFT 16 14327661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com #define SK_A32_SHIFT 24 14427661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com #endif 14527661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com#endif 14627661181d757145d98f2dc3e02b88ee3fffce9e5bsalomon@google.com 1478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// stdlib macros 1488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if 0 1508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if !defined(strlen) && defined(SK_DEBUG) 1518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com extern size_t sk_strlen(const char*); 1528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define strlen(s) sk_strlen(s) 1538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef sk_strcpy 1558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define sk_strcpy(dst, src) strcpy(dst, src) 1568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef sk_strchr 1588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define sk_strchr(s, c) strchr(s, c) 1598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef sk_strrchr 1618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define sk_strrchr(s, c) strrchr(s, c) 1628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef sk_strcmp 1648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define sk_strcmp(s, t) strcmp(s, t) 1658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef sk_strncmp 1678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define sk_strncmp(s, t, n) strncmp(s, t, n) 1688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef sk_memcpy 1708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define sk_memcpy(dst, src, n) memcpy(dst, src, n) 1718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef memmove 1738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define memmove(dst, src, n) memmove(dst, src, n) 1748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef sk_memset 1768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define sk_memset(dst, val, n) memset(dst, val, n) 1778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef sk_memcmp 1798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define sk_memcmp(s, t, n) memcmp(s, t, n) 1808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define sk_strequal(s, t) (!sk_strcmp(s, t)) 1838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define sk_strnequal(s, t, n) (!sk_strncmp(s, t, n)) 1848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1865c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com////////////////////////////////////////////////////////////////////// 1875c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com 1885c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com#if defined(SK_BUILD_FOR_WIN32) || defined(SK_BUILD_FOR_MAC) 1895c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com #ifndef SkLONGLONG 1905c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com #ifdef SK_BUILD_FOR_WIN32 1915c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com #define SkLONGLONG __int64 1925c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com #else 1935c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com #define SkLONGLONG long long 1945c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com #endif 1955c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com #endif 1965c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com#endif 1975c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com 1988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com////////////////////////////////////////////////////////////////////////////////////////////// 1998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SK_BUILD_FOR_WINCE 2008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include <string.h> 2018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include <stdlib.h> 2028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#else 2038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define _CMNINTRIN_DECLARE_ONLY 2048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "cmnintrin.h" 2058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 2068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined SK_DEBUG && defined SK_BUILD_FOR_WIN32 2088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com//#define _CRTDBG_MAP_ALLOC 2098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef free 2108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#undef free 2118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 2128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include <crtdbg.h> 2138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#undef free 2148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DEBUGx 2168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined(SK_SIMULATE_FAILED_MALLOC) && defined(__cplusplus) 2178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com void * operator new( 2188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com size_t cb, 2198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int nBlockUse, 2208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const char * szFileName, 2218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int nLine, 2228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int foo 2238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com ); 2248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com void * operator new[]( 2258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com size_t cb, 2268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int nBlockUse, 2278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const char * szFileName, 2288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int nLine, 2298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int foo 2308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com ); 2318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com void operator delete( 2328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com void *pUserData, 2338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int, const char*, int, int 2348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com ); 2358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com void operator delete( 2368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com void *pUserData 2378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com ); 2388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com void operator delete[]( void * p ); 2398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__, 0) 2408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#else 2418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__) 2428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 2438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define new DEBUG_CLIENTBLOCK 2448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#else 2458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define DEBUG_CLIENTBLOCK 2468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif // _DEBUG 2478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2481341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com 2491341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com#endif 2501341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com 2518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 2528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2531341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com////////////////////////////////////////////////////////////////////// 2541341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com 2551341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com#ifndef SK_OVERRIDE 2561341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com#if defined(SK_BUILD_FOR_WIN) 2571341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com#define SK_OVERRIDE override 2581341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com#elif defined(__clang__) 2591341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com// Some documentation suggests we should be using __attribute__((override)), 2601341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com// but it doesn't work. 2611341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com#define SK_OVERRIDE override 2621341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com#else 2631341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com// Linux GCC ignores "__attribute__((override))" and rejects "override". 2641341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com#define SK_OVERRIDE 2651341304449a60713bf9c8ea2e9489f35533f037atomhudson@google.com#endif 2668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 2678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 268