Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | |
michael@0 | 2 | /* |
michael@0 | 3 | * Copyright 2006 The Android Open Source Project |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | |
michael@0 | 10 | #ifndef SkUserConfig_DEFINED |
michael@0 | 11 | #define SkUserConfig_DEFINED |
michael@0 | 12 | |
michael@0 | 13 | /* SkTypes.h, the root of the public header files, does the following trick: |
michael@0 | 14 | |
michael@0 | 15 | #include "SkPreConfig.h" |
michael@0 | 16 | #include "SkUserConfig.h" |
michael@0 | 17 | #include "SkPostConfig.h" |
michael@0 | 18 | |
michael@0 | 19 | SkPreConfig.h runs first, and it is responsible for initializing certain |
michael@0 | 20 | skia defines. |
michael@0 | 21 | |
michael@0 | 22 | SkPostConfig.h runs last, and its job is to just check that the final |
michael@0 | 23 | defines are consistent (i.e. that we don't have mutually conflicting |
michael@0 | 24 | defines). |
michael@0 | 25 | |
michael@0 | 26 | SkUserConfig.h (this file) runs in the middle. It gets to change or augment |
michael@0 | 27 | the list of flags initially set in preconfig, and then postconfig checks |
michael@0 | 28 | that everything still makes sense. |
michael@0 | 29 | |
michael@0 | 30 | Below are optional defines that add, subtract, or change default behavior |
michael@0 | 31 | in Skia. Your port can locally edit this file to enable/disable flags as |
michael@0 | 32 | you choose, or these can be delared on your command line (i.e. -Dfoo). |
michael@0 | 33 | |
michael@0 | 34 | By default, this include file will always default to having all of the flags |
michael@0 | 35 | commented out, so including it will have no effect. |
michael@0 | 36 | */ |
michael@0 | 37 | |
michael@0 | 38 | /////////////////////////////////////////////////////////////////////////////// |
michael@0 | 39 | |
michael@0 | 40 | /* Skia has lots of debug-only code. Often this is just null checks or other |
michael@0 | 41 | parameter checking, but sometimes it can be quite intrusive (e.g. check that |
michael@0 | 42 | each 32bit pixel is in premultiplied form). This code can be very useful |
michael@0 | 43 | during development, but will slow things down in a shipping product. |
michael@0 | 44 | |
michael@0 | 45 | By default, these mutually exclusive flags are defined in SkPreConfig.h, |
michael@0 | 46 | based on the presence or absence of NDEBUG, but that decision can be changed |
michael@0 | 47 | here. |
michael@0 | 48 | */ |
michael@0 | 49 | //#define SK_DEBUG |
michael@0 | 50 | //#define SK_RELEASE |
michael@0 | 51 | |
michael@0 | 52 | /* Skia has certain debug-only code that is extremely intensive even for debug |
michael@0 | 53 | builds. This code is useful for diagnosing specific issues, but is not |
michael@0 | 54 | generally applicable, therefore it must be explicitly enabled to avoid |
michael@0 | 55 | the performance impact. By default these flags are undefined, but can be |
michael@0 | 56 | enabled by uncommenting them below. |
michael@0 | 57 | */ |
michael@0 | 58 | //#define SK_DEBUG_GLYPH_CACHE |
michael@0 | 59 | //#define SK_DEBUG_PATH |
michael@0 | 60 | |
michael@0 | 61 | /* To assist debugging, Skia provides an instance counting utility in |
michael@0 | 62 | include/core/SkInstCount.h. This flag turns on and off that utility to |
michael@0 | 63 | allow instance count tracking in either debug or release builds. By |
michael@0 | 64 | default it is enabled in debug but disabled in release. |
michael@0 | 65 | */ |
michael@0 | 66 | #define SK_ENABLE_INST_COUNT 0 |
michael@0 | 67 | |
michael@0 | 68 | /* If, in debugging mode, Skia needs to stop (presumably to invoke a debugger) |
michael@0 | 69 | it will call SK_CRASH(). If this is not defined it, it is defined in |
michael@0 | 70 | SkPostConfig.h to write to an illegal address |
michael@0 | 71 | */ |
michael@0 | 72 | //#define SK_CRASH() *(int *)(uintptr_t)0 = 0 |
michael@0 | 73 | |
michael@0 | 74 | |
michael@0 | 75 | /* preconfig will have attempted to determine the endianness of the system, |
michael@0 | 76 | but you can change these mutually exclusive flags here. |
michael@0 | 77 | */ |
michael@0 | 78 | //#define SK_CPU_BENDIAN |
michael@0 | 79 | //#define SK_CPU_LENDIAN |
michael@0 | 80 | |
michael@0 | 81 | /* Most compilers use the same bit endianness for bit flags in a byte as the |
michael@0 | 82 | system byte endianness, and this is the default. If for some reason this |
michael@0 | 83 | needs to be overridden, specify which of the mutually exclusive flags to |
michael@0 | 84 | use. For example, some atom processors in certain configurations have big |
michael@0 | 85 | endian byte order but little endian bit orders. |
michael@0 | 86 | */ |
michael@0 | 87 | //#define SK_UINT8_BITFIELD_BENDIAN |
michael@0 | 88 | //#define SK_UINT8_BITFIELD_LENDIAN |
michael@0 | 89 | |
michael@0 | 90 | |
michael@0 | 91 | /* To write debug messages to a console, skia will call SkDebugf(...) following |
michael@0 | 92 | printf conventions (e.g. const char* format, ...). If you want to redirect |
michael@0 | 93 | this to something other than printf, define yours here |
michael@0 | 94 | */ |
michael@0 | 95 | //#define SkDebugf(...) MyFunction(__VA_ARGS__) |
michael@0 | 96 | |
michael@0 | 97 | /* |
michael@0 | 98 | * To specify a different default font cache limit, define this. If this is |
michael@0 | 99 | * undefined, skia will use a built-in value. |
michael@0 | 100 | */ |
michael@0 | 101 | //#define SK_DEFAULT_FONT_CACHE_LIMIT (1024 * 1024) |
michael@0 | 102 | |
michael@0 | 103 | /* |
michael@0 | 104 | * To specify the default size of the image cache, undefine this and set it to |
michael@0 | 105 | * the desired value (in bytes). SkGraphics.h as a runtime API to set this |
michael@0 | 106 | * value as well. If this is undefined, a built-in value will be used. |
michael@0 | 107 | */ |
michael@0 | 108 | //#define SK_DEFAULT_IMAGE_CACHE_LIMIT (1024 * 1024) |
michael@0 | 109 | |
michael@0 | 110 | /* If zlib is available and you want to support the flate compression |
michael@0 | 111 | algorithm (used in PDF generation), define SK_ZLIB_INCLUDE to be the |
michael@0 | 112 | include path. Alternatively, define SK_SYSTEM_ZLIB to use the system zlib |
michael@0 | 113 | library specified as "#include <zlib.h>". |
michael@0 | 114 | */ |
michael@0 | 115 | //#define SK_ZLIB_INCLUDE <zlib.h> |
michael@0 | 116 | //#define SK_SYSTEM_ZLIB |
michael@0 | 117 | |
michael@0 | 118 | /* Define this to allow PDF scalars above 32k. The PDF/A spec doesn't allow |
michael@0 | 119 | them, but modern PDF interpreters should handle them just fine. |
michael@0 | 120 | */ |
michael@0 | 121 | //#define SK_ALLOW_LARGE_PDF_SCALARS |
michael@0 | 122 | |
michael@0 | 123 | /* Define this to provide font subsetter in PDF generation. |
michael@0 | 124 | */ |
michael@0 | 125 | //#define SK_SFNTLY_SUBSETTER "sfntly/subsetter/font_subsetter.h" |
michael@0 | 126 | |
michael@0 | 127 | /* Define this to set the upper limit for text to support LCD. Values that |
michael@0 | 128 | are very large increase the cost in the font cache and draw slower, without |
michael@0 | 129 | improving readability. If this is undefined, Skia will use its default |
michael@0 | 130 | value (e.g. 48) |
michael@0 | 131 | */ |
michael@0 | 132 | //#define SK_MAX_SIZE_FOR_LCDTEXT 48 |
michael@0 | 133 | |
michael@0 | 134 | /* If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST |
michael@0 | 135 | which will run additional self-tests at startup. These can take a long time, |
michael@0 | 136 | so this flag is optional. |
michael@0 | 137 | */ |
michael@0 | 138 | #ifdef SK_DEBUG |
michael@0 | 139 | //#define SK_SUPPORT_UNITTEST |
michael@0 | 140 | #endif |
michael@0 | 141 | |
michael@0 | 142 | /* If your system embeds skia and has complex event logging, define this |
michael@0 | 143 | symbol to name a file that maps the following macros to your system's |
michael@0 | 144 | equivalents: |
michael@0 | 145 | SK_TRACE_EVENT0(event) |
michael@0 | 146 | SK_TRACE_EVENT1(event, name1, value1) |
michael@0 | 147 | SK_TRACE_EVENT2(event, name1, value1, name2, value2) |
michael@0 | 148 | src/utils/SkDebugTrace.h has a trivial implementation that writes to |
michael@0 | 149 | the debug output stream. If SK_USER_TRACE_INCLUDE_FILE is not defined, |
michael@0 | 150 | SkTrace.h will define the above three macros to do nothing. |
michael@0 | 151 | */ |
michael@0 | 152 | //#undef SK_USER_TRACE_INCLUDE_FILE |
michael@0 | 153 | |
michael@0 | 154 | /* Change the ordering to work in X windows. |
michael@0 | 155 | */ |
michael@0 | 156 | #ifdef SK_SAMPLES_FOR_X |
michael@0 | 157 | #define SK_R32_SHIFT 16 |
michael@0 | 158 | #define SK_G32_SHIFT 8 |
michael@0 | 159 | #define SK_B32_SHIFT 0 |
michael@0 | 160 | #define SK_A32_SHIFT 24 |
michael@0 | 161 | #endif |
michael@0 | 162 | |
michael@0 | 163 | |
michael@0 | 164 | /* Determines whether to build code that supports the GPU backend. Some classes |
michael@0 | 165 | that are not GPU-specific, such as SkShader subclasses, have optional code |
michael@0 | 166 | that is used allows them to interact with the GPU backend. If you'd like to |
michael@0 | 167 | omit this code set SK_SUPPORT_GPU to 0. This also allows you to omit the gpu |
michael@0 | 168 | directories from your include search path when you're not building the GPU |
michael@0 | 169 | backend. Defaults to 1 (build the GPU code). |
michael@0 | 170 | */ |
michael@0 | 171 | //#define SK_SUPPORT_GPU 1 |
michael@0 | 172 | |
michael@0 | 173 | |
michael@0 | 174 | /* The PDF generation code uses Path Ops to generate inverse fills and complex |
michael@0 | 175 | * clipping paths, but at this time, Path Ops is not release ready yet. So, |
michael@0 | 176 | * the code is hidden behind this #define guard. If you are feeling adventurous |
michael@0 | 177 | * and want the latest and greatest PDF generation code, uncomment the #define. |
michael@0 | 178 | * When Path Ops is release ready, the define guards and this user config |
michael@0 | 179 | * define should be removed entirely. |
michael@0 | 180 | */ |
michael@0 | 181 | //#define SK_PDF_USE_PATHOPS |
michael@0 | 182 | |
michael@0 | 183 | /* Skia uses these defines as the target of include preprocessor directives. |
michael@0 | 184 | * The header files pointed to by these defines provide declarations and |
michael@0 | 185 | * possibly inline implementations of threading primitives. |
michael@0 | 186 | * |
michael@0 | 187 | * See SkThread.h for documentation on what these includes must contain. |
michael@0 | 188 | */ |
michael@0 | 189 | //#define SK_ATOMICS_PLATFORM_H "SkAtomics_xxx.h" |
michael@0 | 190 | //#define SK_MUTEX_PLATFORM_H "SkMutex_xxx.h" |
michael@0 | 191 | # if defined(_MSC_VER) |
michael@0 | 192 | # define SK_ATOMICS_PLATFORM_H "skia/SkAtomics_win.h" |
michael@0 | 193 | # elif defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) |
michael@0 | 194 | # define SK_ATOMICS_PLATFORM_H "skia/SkAtomics_android.h" |
michael@0 | 195 | # else |
michael@0 | 196 | # define SK_ATOMICS_PLATFORM_H "skia/SkAtomics_sync.h" |
michael@0 | 197 | # endif |
michael@0 | 198 | |
michael@0 | 199 | # if defined(SK_BUILD_FOR_WIN32) |
michael@0 | 200 | # define SK_MUTEX_PLATFORM_H "skia/SkMutex_win.h" |
michael@0 | 201 | # else |
michael@0 | 202 | # define SK_MUTEX_PLATFORM_H "skia/SkMutex_pthread.h" |
michael@0 | 203 | # endif |
michael@0 | 204 | #endif |
michael@0 | 205 | |
michael@0 | 206 | #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0 |
michael@0 | 207 | |
michael@0 | 208 | #define SK_SUPPORT_LEGACY_LAYERRASTERIZER_API 1 |
michael@0 | 209 | #define SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG 1 |
michael@0 | 210 | #define SK_SUPPORT_LEGACY_GETTOTALCLIP 1 |