| 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 | |
| 48 | /* Somewhat independent of how SkScalar is implemented, Skia also wants to know |
| 49 | if it can use floats at all. Naturally, if SK_SCALAR_IS_FLOAT is defined, |
| epoger@google.com | 2047f00 | 2011-05-17 17:36:59 +0000 | [diff] [blame] | 50 | SK_CAN_USE_FLOAT must be too; but if scalars are fixed, SK_CAN_USE_FLOAT |
| reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 51 | can go either way. |
| 52 | */ |
| 53 | //#define SK_CAN_USE_FLOAT |
| 54 | |
| 55 | /* For some performance-critical scalar operations, skia will optionally work |
| 56 | around the standard float operators if it knows that the CPU does not have |
| 57 | native support for floats. If your environment uses software floating point, |
| 58 | define this flag. |
| 59 | */ |
| 60 | //#define SK_SOFTWARE_FLOAT |
| 61 | |
| 62 | |
| 63 | /* Skia has lots of debug-only code. Often this is just null checks or other |
| 64 | parameter checking, but sometimes it can be quite intrusive (e.g. check that |
| 65 | each 32bit pixel is in premultiplied form). This code can be very useful |
| 66 | during development, but will slow things down in a shipping product. |
| reed@google.com | 9d0d195 | 2011-01-28 22:19:22 +0000 | [diff] [blame] | 67 | |
| reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 68 | By default, these mutually exclusive flags are defined in SkPreConfig.h, |
| 69 | based on the presence or absence of NDEBUG, but that decision can be changed |
| 70 | here. |
| 71 | */ |
| 72 | //#define SK_DEBUG |
| 73 | //#define SK_RELEASE |
| 74 | |
| 75 | |
| 76 | /* If, in debugging mode, Skia needs to stop (presumably to invoke a debugger) |
| 77 | it will call SK_CRASH(). If this is not defined it, it is defined in |
| 78 | SkPostConfig.h to write to an illegal address |
| 79 | */ |
| 80 | //#define SK_CRASH() *(int *)(uintptr_t)0 = 0 |
| 81 | |
| 82 | |
| 83 | /* preconfig will have attempted to determine the endianness of the system, |
| 84 | but you can change these mutually exclusive flags here. |
| 85 | */ |
| 86 | //#define SK_CPU_BENDIAN |
| 87 | //#define SK_CPU_LENDIAN |
| 88 | |
| 89 | |
| 90 | /* Some compilers don't support long long for 64bit integers. If yours does |
| 91 | not, define this to the appropriate type. |
| 92 | */ |
| 93 | //#define SkLONGLONG int64_t |
| 94 | |
| 95 | |
| 96 | /* Some envorinments do not suport writable globals (eek!). If yours does not, |
| 97 | define this flag. |
| 98 | */ |
| 99 | //#define SK_USE_RUNTIME_GLOBALS |
| 100 | |
| 101 | |
| 102 | /* To write debug messages to a console, skia will call SkDebugf(...) following |
| 103 | printf conventions (e.g. const char* format, ...). If you want to redirect |
| 104 | this to something other than printf, define yours here |
| 105 | */ |
| 106 | //#define SkDebugf(...) MyFunction(__VA_ARGS__) |
| 107 | |
| reed@google.com | 77407ca | 2011-11-08 13:48:32 +0000 | [diff] [blame^] | 108 | /* |
| 109 | * To specify a different default font cache limit, define this. If this is |
| 110 | * undefined, skia will use a built-in value. |
| 111 | */ |
| 112 | //#define SK_DEFAULT_FONT_CACHE_LIMIT (1024 * 1024) |
| 113 | |
| caryclark@google.com | 1eeaf0b | 2011-06-22 13:19:43 +0000 | [diff] [blame] | 114 | /* If defined, use CoreText instead of ATSUI on OS X. |
| 115 | */ |
| 116 | //#define SK_USE_MAC_CORE_TEXT |
| 117 | |
| 118 | |
| vandebo@chromium.org | a09ef97 | 2010-12-01 22:17:20 +0000 | [diff] [blame] | 119 | /* If zlib is available and you want to support the flate compression |
| 120 | algorithm (used in PDF generation), define SK_ZLIB_INCLUDE to be the |
| 121 | include path. |
| 122 | */ |
| reed@google.com | d642329 | 2010-12-20 20:53:13 +0000 | [diff] [blame] | 123 | //#define SK_ZLIB_INCLUDE <zlib.h> |
| vandebo@chromium.org | a09ef97 | 2010-12-01 22:17:20 +0000 | [diff] [blame] | 124 | |
| vandebo@chromium.org | 094316b | 2011-03-04 03:15:13 +0000 | [diff] [blame] | 125 | /* Define this to allow PDF scalars above 32k. The PDF/A spec doesn't allow |
| 126 | them, but modern PDF interpreters should handle them just fine. |
| 127 | */ |
| 128 | //#define SK_ALLOW_LARGE_PDF_SCALARS |
| 129 | |
| vandebo@chromium.org | 1f16589 | 2011-07-26 02:11:41 +0000 | [diff] [blame] | 130 | /* Define this to provide font subsetter in PDF generation. |
| 131 | */ |
| 132 | //#define SK_SFNTLY_SUBSETTER "sfntly/subsetter/font_subsetter.h" |
| 133 | |
| reed@google.com | 9d0d195 | 2011-01-28 22:19:22 +0000 | [diff] [blame] | 134 | /* Define this to remove dimension checks on bitmaps. Not all blits will be |
| 135 | correct yet, so this is mostly for debugging the implementation. |
| 136 | */ |
| 137 | //#define SK_ALLOW_OVER_32K_BITMAPS |
| 138 | |
| reed@google.com | c27b741 | 2011-09-13 17:20:30 +0000 | [diff] [blame] | 139 | /* Define this to set the upper limit for text to support LCD. Values that |
| 140 | are very large increase the cost in the font cache and draw slower, without |
| 141 | improving readability. If this is undefined, Skia will use its default |
| 142 | value (e.g. 48) |
| 143 | */ |
| 144 | //#define SK_MAX_SIZE_FOR_LCDTEXT 48 |
| 145 | |
| reed@android.com | 5c80ea1 | 2009-01-08 17:49:50 +0000 | [diff] [blame] | 146 | /* If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST |
| 147 | which will run additional self-tests at startup. These can take a long time, |
| 148 | so this flag is optional. |
| 149 | */ |
| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 150 | #ifdef SK_DEBUG |
| reed@android.com | 0f0cfae | 2009-10-13 13:33:16 +0000 | [diff] [blame] | 151 | //#define SK_SUPPORT_UNITTEST |
| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 152 | #endif |
| 153 | |
| tomhudson@google.com | 0c8d93a | 2011-07-01 17:08:26 +0000 | [diff] [blame] | 154 | /* If your system embeds skia and has complex event logging, define this |
| 155 | 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] | 156 | equivalents: |
| 157 | SK_TRACE_EVENT0(event) |
| 158 | SK_TRACE_EVENT1(event, name1, value1) |
| 159 | SK_TRACE_EVENT2(event, name1, value1, name2, value2) |
| tomhudson@google.com | 278cbb4 | 2011-06-30 19:37:01 +0000 | [diff] [blame] | 160 | src/utils/SkDebugTrace.h has a trivial implementation that writes to |
| tomhudson@google.com | 0c8d93a | 2011-07-01 17:08:26 +0000 | [diff] [blame] | 161 | the debug output stream. If SK_USER_TRACE_INCLUDE_FILE is not defined, |
| 162 | SkTrace.h will define the above three macros to do nothing. |
| tomhudson@google.com | 278cbb4 | 2011-06-30 19:37:01 +0000 | [diff] [blame] | 163 | */ |
| tomhudson@google.com | 0c8d93a | 2011-07-01 17:08:26 +0000 | [diff] [blame] | 164 | //#undef SK_USER_TRACE_INCLUDE_FILE |
| tomhudson@google.com | 278cbb4 | 2011-06-30 19:37:01 +0000 | [diff] [blame] | 165 | |
| scroggo | b66365f | 2011-03-18 21:43:03 +0000 | [diff] [blame] | 166 | /* Change the ordering to work in X windows. |
| 167 | */ |
| 168 | #ifdef SK_SAMPLES_FOR_X |
| 169 | #define SK_R32_SHIFT 16 |
| 170 | #define SK_G32_SHIFT 8 |
| 171 | #define SK_B32_SHIFT 0 |
| 172 | #define SK_A32_SHIFT 24 |
| 173 | #endif |
| 174 | |
| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 175 | #endif |