OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2006 The Android Open Source Project |
| 3 * |
| 4 * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 * you may not use this file except in compliance with the License. |
| 6 * You may obtain a copy of the License at |
| 7 * |
| 8 * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 * |
| 10 * Unless required by applicable law or agreed to in writing, software |
| 11 * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 * See the License for the specific language governing permissions and |
| 14 * limitations under the License. |
| 15 */ |
| 16 |
| 17 #ifndef SKIA_CONFIG_SKUSERCONFIG_H_ |
| 18 #define SKIA_CONFIG_SKUSERCONFIG_H_ |
| 19 |
| 20 /* SkTypes.h, the root of the public header files, does the following trick: |
| 21 |
| 22 #include <SkPreConfig.h> |
| 23 #include <SkUserConfig.h> |
| 24 #include <SkPostConfig.h> |
| 25 |
| 26 SkPreConfig.h runs first, and it is responsible for initializing certain |
| 27 skia defines. |
| 28 |
| 29 SkPostConfig.h runs last, and its job is to just check that the final |
| 30 defines are consistent (i.e. that we don't have mutually conflicting |
| 31 defines). |
| 32 |
| 33 SkUserConfig.h (this file) runs in the middle. It gets to change or augment |
| 34 the list of flags initially set in preconfig, and then postconfig checks |
| 35 that everything still makes sense. |
| 36 |
| 37 Below are optional defines that add, subtract, or change default behavior |
| 38 in Skia. Your port can locally edit this file to enable/disable flags as |
| 39 you choose, or these can be delared on your command line (i.e. -Dfoo). |
| 40 |
| 41 By default, this include file will always default to having all of the flags |
| 42 commented out, so including it will have no effect. |
| 43 */ |
| 44 |
| 45 /////////////////////////////////////////////////////////////////////////////// |
| 46 |
| 47 /* Skia has lots of debug-only code. Often this is just null checks or other |
| 48 parameter checking, but sometimes it can be quite intrusive (e.g. check that |
| 49 each 32bit pixel is in premultiplied form). This code can be very useful |
| 50 during development, but will slow things down in a shipping product. |
| 51 |
| 52 By default, these mutually exclusive flags are defined in SkPreConfig.h, |
| 53 based on the presence or absence of NDEBUG, but that decision can be changed |
| 54 here. |
| 55 */ |
| 56 // #define SK_DEBUG |
| 57 // #define SK_RELEASE |
| 58 |
| 59 // #ifdef DCHECK_ALWAYS_ON |
| 60 // #undef SK_RELEASE |
| 61 // #define SK_DEBUG |
| 62 // #endif |
| 63 |
| 64 /* If, in debugging mode, Skia needs to stop (presumably to invoke a debugger) |
| 65 it will call SK_CRASH(). If this is not defined it, it is defined in |
| 66 SkPostConfig.h to write to an illegal address |
| 67 */ |
| 68 // #define SK_CRASH() *(int *)(uintptr_t)0 = 0 |
| 69 |
| 70 /* preconfig will have attempted to determine the endianness of the system, |
| 71 but you can change these mutually exclusive flags here. |
| 72 */ |
| 73 // #define SK_CPU_BENDIAN |
| 74 // #define SK_CPU_LENDIAN |
| 75 |
| 76 /* If zlib is available and you want to support the flate compression |
| 77 algorithm (used in PDF generation), define SK_ZLIB_INCLUDE to be the |
| 78 include path. |
| 79 */ |
| 80 // #define SK_ZLIB_INCLUDE <zlib.h> |
| 81 |
| 82 /* Define this to allow PDF scalars above 32k. The PDF/A spec doesn't allow |
| 83 them, but modern PDF interpreters should handle them just fine. |
| 84 */ |
| 85 // #define SK_ALLOW_LARGE_PDF_SCALARS |
| 86 |
| 87 /* Define this to provide font subsetter for font subsetting when generating |
| 88 PDF documents. |
| 89 */ |
| 90 // #define SK_SFNTLY_SUBSETTER \ |
| 91 // "third_party/sfntly/src/cpp/src/sample/chromium/font_subsetter.h" |
| 92 |
| 93 /* To write debug messages to a console, skia will call SkDebugf(...) following |
| 94 printf conventions (e.g. const char* format, ...). If you want to redirect |
| 95 this to something other than printf, define yours here |
| 96 */ |
| 97 // #define SkDebugf(...) MyFunction(__VA_ARGS__) |
| 98 |
| 99 /* If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST |
| 100 which will run additional self-tests at startup. These can take a long time, |
| 101 so this flag is optional. |
| 102 */ |
| 103 #ifdef SK_DEBUG |
| 104 #define SK_SUPPORT_UNITTEST |
| 105 #endif |
| 106 |
| 107 /* If cross process SkPictureImageFilters are not explicitly enabled then |
| 108 they are always disabled. |
| 109 */ |
| 110 #ifndef SK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS |
| 111 #ifndef SK_DISALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS |
| 112 #define SK_DISALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS |
| 113 #endif |
| 114 #endif |
| 115 |
| 116 /* If your system embeds skia and has complex event logging, define this |
| 117 symbol to name a file that maps the following macros to your system's |
| 118 equivalents: |
| 119 SK_TRACE_EVENT0(event) |
| 120 SK_TRACE_EVENT1(event, name1, value1) |
| 121 SK_TRACE_EVENT2(event, name1, value1, name2, value2) |
| 122 src/utils/SkDebugTrace.h has a trivial implementation that writes to |
| 123 the debug output stream. If SK_USER_TRACE_INCLUDE_FILE is not defined, |
| 124 SkTrace.h will define the above three macros to do nothing. |
| 125 */ |
| 126 #undef SK_USER_TRACE_INCLUDE_FILE |
| 127 |
| 128 // ===== Begin Chrome-specific definitions ===== |
| 129 |
| 130 #define SK_SCALAR_IS_FLOAT |
| 131 #undef SK_SCALAR_IS_FIXED |
| 132 |
| 133 #define SK_MSCALAR_IS_FLOAT |
| 134 #undef SK_MSCALAR_IS_DOUBLE |
| 135 |
| 136 #define GR_MAX_OFFSCREEN_AA_DIM 512 |
| 137 |
| 138 // Log the file and line number for assertions. |
| 139 #define SkDebugf(...) SkDebugf_FileLine(__FILE__, __LINE__, false, __VA_ARGS__) |
| 140 SK_API void SkDebugf_FileLine(const char* file, |
| 141 int line, |
| 142 bool fatal, |
| 143 const char* format, |
| 144 ...); |
| 145 |
| 146 // Marking the debug print as "fatal" will cause a debug break, so we don't need |
| 147 // a separate crash call here. |
| 148 #define SK_DEBUGBREAK(cond) \ |
| 149 do { \ |
| 150 if (!(cond)) { \ |
| 151 SkDebugf_FileLine(__FILE__, __LINE__, true, \ |
| 152 "%s:%d: failed assertion \"%s\"\n", __FILE__, \ |
| 153 __LINE__, #cond); \ |
| 154 } \ |
| 155 } while (false) |
| 156 |
| 157 #if !defined(ANDROID) // On Android, we use the skia default settings. |
| 158 #define SK_A32_SHIFT 24 |
| 159 #define SK_R32_SHIFT 16 |
| 160 #define SK_G32_SHIFT 8 |
| 161 #define SK_B32_SHIFT 0 |
| 162 #endif |
| 163 |
| 164 #if defined(SK_BUILD_FOR_WIN32) |
| 165 |
| 166 #define SK_BUILD_FOR_WIN |
| 167 |
| 168 // Skia uses this deprecated bzero function to fill zeros into a string. |
| 169 #define bzero(str, len) memset(str, 0, len) |
| 170 |
| 171 #elif defined(SK_BUILD_FOR_MAC) |
| 172 |
| 173 #define SK_CPU_LENDIAN |
| 174 #undef SK_CPU_BENDIAN |
| 175 |
| 176 #elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID) |
| 177 |
| 178 // Prefer FreeType's emboldening algorithm to Skia's |
| 179 // TODO: skia used to just use hairline, but has improved since then, so |
| 180 // we should revisit this choice... |
| 181 #define SK_USE_FREETYPE_EMBOLDEN |
| 182 |
| 183 #if defined(SK_BUILD_FOR_UNIX) && defined(SK_CPU_BENDIAN) |
| 184 // Above we set the order for ARGB channels in registers. I suspect that, on |
| 185 // big endian machines, you can keep this the same and everything will work. |
| 186 // The in-memory order will be different, of course, but as long as everything |
| 187 // is reading memory as words rather than bytes, it will all work. However, if |
| 188 // you find that colours are messed up I thought that I would leave a helpful |
| 189 // locator for you. Also see the comments in |
| 190 // base/gfx/bitmap_platform_device_linux.h |
| 191 #error Read the comment at this location |
| 192 #endif |
| 193 |
| 194 #endif |
| 195 |
| 196 // The default crash macro writes to badbeef which can cause some strange |
| 197 // problems. Instead, pipe this through to the logging function as a fatal |
| 198 // assertion. |
| 199 #define SK_CRASH() SkDebugf_FileLine(__FILE__, __LINE__, true, "SK_CRASH") |
| 200 |
| 201 // These flags are no longer defined in Skia, but we have them (temporarily) |
| 202 // until we update our call-sites (typically these are for API changes). |
| 203 // |
| 204 // Remove these as we update our sites. |
| 205 // |
| 206 #ifndef SK_SUPPORT_LEGACY_GETTOPDEVICE |
| 207 #define SK_SUPPORT_LEGACY_GETTOPDEVICE |
| 208 #endif |
| 209 |
| 210 #ifndef SK_SUPPORT_LEGACY_GETDEVICE |
| 211 #define SK_SUPPORT_LEGACY_GETDEVICE |
| 212 #endif |
| 213 |
| 214 // Workaround for poor anisotropic mipmap quality, |
| 215 // pending Skia ripmap support. |
| 216 // (https://bugs.chromium.org/p/skia/issues/detail?id=4863) |
| 217 #ifndef SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE |
| 218 #define SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE |
| 219 #endif |
| 220 |
| 221 #ifndef SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX |
| 222 #define SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX |
| 223 #endif |
| 224 |
| 225 #ifndef SK_IGNORE_ETC1_SUPPORT |
| 226 #define SK_IGNORE_ETC1_SUPPORT |
| 227 #endif |
| 228 |
| 229 #ifndef SK_IGNORE_GPU_DITHER |
| 230 #define SK_IGNORE_GPU_DITHER |
| 231 #endif |
| 232 |
| 233 #ifndef SK_SUPPORT_LEGACY_EVAL_CUBIC |
| 234 #define SK_SUPPORT_LEGACY_EVAL_CUBIC |
| 235 #endif |
| 236 |
| 237 ///////////////////////// Imported from BUILD.gn and skia_common.gypi |
| 238 |
| 239 /* In some places Skia can use static initializers for global initialization, |
| 240 * or fall back to lazy runtime initialization. Chrome always wants the latter. |
| 241 */ |
| 242 #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0 |
| 243 |
| 244 /* This flag forces Skia not to use typographic metrics with GDI. |
| 245 */ |
| 246 #define SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS |
| 247 |
| 248 #define SK_IGNORE_BLURRED_RRECT_OPT |
| 249 #define SK_USE_DISCARDABLE_SCALEDIMAGECACHE |
| 250 #define SK_WILL_NEVER_DRAW_PERSPECTIVE_TEXT |
| 251 |
| 252 #define SK_ATTR_DEPRECATED SK_NOTHING_ARG1 |
| 253 #define SK_ENABLE_INST_COUNT 0 |
| 254 #define GR_GL_CUSTOM_SETUP_HEADER "GrGLConfig_chrome.h" |
| 255 |
| 256 // Blink layout tests are baselined to Clang optimizing through the UB in |
| 257 // SkDivBits. |
| 258 #define SK_SUPPORT_LEGACY_DIVBITS_UB |
| 259 |
| 260 // mtklein's fiddling with Src / SrcOver. Will rebaseline these only once when |
| 261 // done. |
| 262 #define SK_SUPPORT_LEGACY_X86_BLITS |
| 263 |
| 264 #define SK_DISABLE_TILE_IMAGE_FILTER_OPTIMIZATION |
| 265 |
| 266 // ===== End Chrome-specific definitions ===== |
| 267 |
| 268 #endif // SKIA_CONFIG_SKUSERCONFIG_H_ |
OLD | NEW |