epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2006 The Android Open Source Project |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 4 | * |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 9 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 10 | #ifndef SkUserConfig_DEFINED |
| 11 | #define SkUserConfig_DEFINED |
| 12 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 13 | /* SkTypes.h, the root of the public header files, does the following trick: |
reed@google.com | 9d0d195 | 2011-01-28 22:19:22 +0000 | [diff] [blame] | 14 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 15 | #include "SkPreConfig.h" |
| 16 | #include "SkUserConfig.h" |
| 17 | #include "SkPostConfig.h" |
reed@google.com | 9d0d195 | 2011-01-28 22:19:22 +0000 | [diff] [blame] | 18 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 19 | SkPreConfig.h runs first, and it is responsible for initializing certain |
| 20 | skia defines. |
reed@google.com | 9d0d195 | 2011-01-28 22:19:22 +0000 | [diff] [blame] | 21 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 22 | SkPostConfig.h runs last, and its job is to just check that the final |
| 23 | defines are consistent (i.e. that we don't have mutually conflicting |
| 24 | defines). |
reed@google.com | 9d0d195 | 2011-01-28 22:19:22 +0000 | [diff] [blame] | 25 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 26 | SkUserConfig.h (this file) runs in the middle. It gets to change or augment |
| 27 | the list of flags initially set in preconfig, and then postconfig checks |
| 28 | that everything still makes sense. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 29 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 30 | Below are optional defines that add, subtract, or change default behavior |
| 31 | in Skia. Your port can locally edit this file to enable/disable flags as |
| 32 | you choose, or these can be delared on your command line (i.e. -Dfoo). |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 33 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 34 | By default, this include file will always default to having all of the flags |
| 35 | commented out, so including it will have no effect. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 36 | */ |
| 37 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 38 | /////////////////////////////////////////////////////////////////////////////// |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 39 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 40 | /* Scalars (the fractional value type in skia) can be implemented either as |
| 41 | floats or 16.16 integers (fixed). Exactly one of these two symbols must be |
| 42 | defined. |
| 43 | */ |
| 44 | //#define SK_SCALAR_IS_FLOAT |
| 45 | //#define SK_SCALAR_IS_FIXED |
| 46 | |
| 47 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 48 | /* For some performance-critical scalar operations, skia will optionally work |
| 49 | around the standard float operators if it knows that the CPU does not have |
| 50 | native support for floats. If your environment uses software floating point, |
| 51 | define this flag. |
| 52 | */ |
| 53 | //#define SK_SOFTWARE_FLOAT |
| 54 | |
| 55 | |
| 56 | /* Skia has lots of debug-only code. Often this is just null checks or other |
| 57 | parameter checking, but sometimes it can be quite intrusive (e.g. check that |
| 58 | each 32bit pixel is in premultiplied form). This code can be very useful |
| 59 | during development, but will slow things down in a shipping product. |
reed@google.com | 9d0d195 | 2011-01-28 22:19:22 +0000 | [diff] [blame] | 60 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 61 | By default, these mutually exclusive flags are defined in SkPreConfig.h, |
| 62 | based on the presence or absence of NDEBUG, but that decision can be changed |
| 63 | here. |
| 64 | */ |
| 65 | //#define SK_DEBUG |
| 66 | //#define SK_RELEASE |
| 67 | |
robertphillips@google.com | b74af87 | 2012-06-27 19:41:42 +0000 | [diff] [blame] | 68 | /* To assist debugging, Skia provides an instance counting utility in |
| 69 | include/core/SkInstCount.h. This flag turns on and off that utility to |
| 70 | allow instance count tracking in either debug or release builds. By |
| 71 | default it is enabled in debug but disabled in release. |
| 72 | */ |
| 73 | //#define SK_ENABLE_INST_COUNT |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 74 | |
| 75 | /* If, in debugging mode, Skia needs to stop (presumably to invoke a debugger) |
| 76 | it will call SK_CRASH(). If this is not defined it, it is defined in |
| 77 | SkPostConfig.h to write to an illegal address |
| 78 | */ |
| 79 | //#define SK_CRASH() *(int *)(uintptr_t)0 = 0 |
| 80 | |
| 81 | |
| 82 | /* preconfig will have attempted to determine the endianness of the system, |
| 83 | but you can change these mutually exclusive flags here. |
| 84 | */ |
| 85 | //#define SK_CPU_BENDIAN |
| 86 | //#define SK_CPU_LENDIAN |
| 87 | |
bungeman@google.com | f8d1aee | 2012-02-02 19:15:21 +0000 | [diff] [blame] | 88 | /* Most compilers use the same bit endianness for bit flags in a byte as the |
| 89 | system byte endianness, and this is the default. If for some reason this |
| 90 | needs to be overridden, specify which of the mutually exclusive flags to |
| 91 | use. For example, some atom processors in certain configurations have big |
| 92 | endian byte order but little endian bit orders. |
| 93 | */ |
| 94 | //#define SK_UINT8_BITFIELD_BENDIAN |
| 95 | //#define SK_UINT8_BITFIELD_LENDIAN |
| 96 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 97 | |
| 98 | /* Some compilers don't support long long for 64bit integers. If yours does |
| 99 | not, define this to the appropriate type. |
| 100 | */ |
| 101 | //#define SkLONGLONG int64_t |
| 102 | |
| 103 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 104 | /* To write debug messages to a console, skia will call SkDebugf(...) following |
| 105 | printf conventions (e.g. const char* format, ...). If you want to redirect |
| 106 | this to something other than printf, define yours here |
| 107 | */ |
| 108 | //#define SkDebugf(...) MyFunction(__VA_ARGS__) |
| 109 | |
reed@google.com | 77407ca | 2011-11-08 13:48:32 +0000 | [diff] [blame] | 110 | /* |
| 111 | * To specify a different default font cache limit, define this. If this is |
| 112 | * undefined, skia will use a built-in value. |
| 113 | */ |
| 114 | //#define SK_DEFAULT_FONT_CACHE_LIMIT (1024 * 1024) |
| 115 | |
caryclark@google.com | 1eeaf0b | 2011-06-22 13:19:43 +0000 | [diff] [blame] | 116 | /* If defined, use CoreText instead of ATSUI on OS X. |
| 117 | */ |
| 118 | //#define SK_USE_MAC_CORE_TEXT |
| 119 | |
| 120 | |
vandebo@chromium.org | a09ef97 | 2010-12-01 22:17:20 +0000 | [diff] [blame] | 121 | /* If zlib is available and you want to support the flate compression |
| 122 | algorithm (used in PDF generation), define SK_ZLIB_INCLUDE to be the |
justinlin@google.com | fffb2f1 | 2012-04-16 19:10:21 +0000 | [diff] [blame] | 123 | include path. Alternatively, define SK_SYSTEM_ZLIB to use the system zlib |
| 124 | library specified as "#include <zlib.h>". |
vandebo@chromium.org | a09ef97 | 2010-12-01 22:17:20 +0000 | [diff] [blame] | 125 | */ |
reed@google.com | d642329 | 2010-12-20 20:53:13 +0000 | [diff] [blame] | 126 | //#define SK_ZLIB_INCLUDE <zlib.h> |
justinlin@google.com | fffb2f1 | 2012-04-16 19:10:21 +0000 | [diff] [blame] | 127 | //#define SK_SYSTEM_ZLIB |
vandebo@chromium.org | a09ef97 | 2010-12-01 22:17:20 +0000 | [diff] [blame] | 128 | |
vandebo@chromium.org | 094316b | 2011-03-04 03:15:13 +0000 | [diff] [blame] | 129 | /* Define this to allow PDF scalars above 32k. The PDF/A spec doesn't allow |
| 130 | them, but modern PDF interpreters should handle them just fine. |
| 131 | */ |
| 132 | //#define SK_ALLOW_LARGE_PDF_SCALARS |
| 133 | |
vandebo@chromium.org | 1f16589 | 2011-07-26 02:11:41 +0000 | [diff] [blame] | 134 | /* Define this to provide font subsetter in PDF generation. |
| 135 | */ |
| 136 | //#define SK_SFNTLY_SUBSETTER "sfntly/subsetter/font_subsetter.h" |
| 137 | |
reed@google.com | 9d0d195 | 2011-01-28 22:19:22 +0000 | [diff] [blame] | 138 | /* Define this to remove dimension checks on bitmaps. Not all blits will be |
| 139 | correct yet, so this is mostly for debugging the implementation. |
| 140 | */ |
| 141 | //#define SK_ALLOW_OVER_32K_BITMAPS |
| 142 | |
reed@google.com | c27b741 | 2011-09-13 17:20:30 +0000 | [diff] [blame] | 143 | /* Define this to set the upper limit for text to support LCD. Values that |
| 144 | are very large increase the cost in the font cache and draw slower, without |
| 145 | improving readability. If this is undefined, Skia will use its default |
| 146 | value (e.g. 48) |
| 147 | */ |
| 148 | //#define SK_MAX_SIZE_FOR_LCDTEXT 48 |
| 149 | |
reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 150 | /* If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST |
| 151 | which will run additional self-tests at startup. These can take a long time, |
| 152 | so this flag is optional. |
| 153 | */ |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 154 | #ifdef SK_DEBUG |
reed@android.com | 0f0cfae | 2009-10-13 13:33:16 +0000 | [diff] [blame] | 155 | //#define SK_SUPPORT_UNITTEST |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 156 | #endif |
| 157 | |
tomhudson@google.com | 0c8d93a | 2011-07-01 17:08:26 +0000 | [diff] [blame] | 158 | /* If your system embeds skia and has complex event logging, define this |
| 159 | symbol to name a file that maps the following macros to your system's |
tomhudson@google.com | 278cbb4 | 2011-06-30 19:37:01 +0000 | [diff] [blame] | 160 | equivalents: |
| 161 | SK_TRACE_EVENT0(event) |
| 162 | SK_TRACE_EVENT1(event, name1, value1) |
| 163 | SK_TRACE_EVENT2(event, name1, value1, name2, value2) |
tomhudson@google.com | 278cbb4 | 2011-06-30 19:37:01 +0000 | [diff] [blame] | 164 | src/utils/SkDebugTrace.h has a trivial implementation that writes to |
tomhudson@google.com | 0c8d93a | 2011-07-01 17:08:26 +0000 | [diff] [blame] | 165 | the debug output stream. If SK_USER_TRACE_INCLUDE_FILE is not defined, |
| 166 | SkTrace.h will define the above three macros to do nothing. |
tomhudson@google.com | 278cbb4 | 2011-06-30 19:37:01 +0000 | [diff] [blame] | 167 | */ |
tomhudson@google.com | 0c8d93a | 2011-07-01 17:08:26 +0000 | [diff] [blame] | 168 | //#undef SK_USER_TRACE_INCLUDE_FILE |
tomhudson@google.com | 278cbb4 | 2011-06-30 19:37:01 +0000 | [diff] [blame] | 169 | |
scroggo | b66365f | 2011-03-18 21:43:03 +0000 | [diff] [blame] | 170 | /* Change the ordering to work in X windows. |
| 171 | */ |
| 172 | #ifdef SK_SAMPLES_FOR_X |
| 173 | #define SK_R32_SHIFT 16 |
| 174 | #define SK_G32_SHIFT 8 |
| 175 | #define SK_B32_SHIFT 0 |
| 176 | #define SK_A32_SHIFT 24 |
| 177 | #endif |
| 178 | |
bsalomon@google.com | cf8fb1f | 2012-08-02 14:03:32 +0000 | [diff] [blame^] | 179 | |
| 180 | /* Determines whether to build code that supports the GPU backend. Some classes |
| 181 | that are not GPU-specific, such as SkShader subclasses, have optional code |
| 182 | that is used allows them to interact with the GPU backend. If you'd like to |
| 183 | omit this code set SK_SUPPORT_GPU to 0. This also allows you to omit the gpu |
| 184 | directories from your include search path when you're not building the GPU |
| 185 | backend. Defaults to 1 (build the GPU code). |
| 186 | */ |
| 187 | //#define SK_SUPPORT_GPU 1 |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 188 | #endif |