SkUserConfig.h revision 58190644c30e1c4aa8e527f3503c58f841e0fcf3
180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* 380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2006 The Android Open Source Project 480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * 580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be 680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file. 780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef SkUserConfig_DEFINED 1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SkUserConfig_DEFINED 1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* SkTypes.h, the root of the public header files, does the following trick: 1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru #include "SkPreConfig.h" 1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru #include "SkUserConfig.h" 1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru #include "SkPostConfig.h" 1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPreConfig.h runs first, and it is responsible for initializing certain 2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru skia defines. 2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPostConfig.h runs last, and its job is to just check that the final 2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru defines are consistent (i.e. that we don't have mutually conflicting 2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru defines). 2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkUserConfig.h (this file) runs in the middle. It gets to change or augment 2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru the list of flags initially set in preconfig, and then postconfig checks 2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru that everything still makes sense. 2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru Below are optional defines that add, subtract, or change default behavior 3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru in Skia. Your port can locally edit this file to enable/disable flags as 3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru you choose, or these can be delared on your command line (i.e. -Dfoo). 3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru By default, this include file will always default to having all of the flags 3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru commented out, so including it will have no effect. 3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru*/ 3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/////////////////////////////////////////////////////////////////////////////// 3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* Scalars (the fractional value type in skia) can be implemented either as 4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru floats or 16.16 integers (fixed). Exactly one of these two symbols must be 4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru defined. 4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru*/ 4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_SCALAR_IS_FLOAT 4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_SCALAR_IS_FIXED 4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* For some performance-critical scalar operations, skia will optionally work 4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru around the standard float operators if it knows that the CPU does not have 5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru native support for floats. If your environment uses software floating point, 5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru define this flag. 5280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 5380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_SOFTWARE_FLOAT 5480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 5580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 5680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* Skia has lots of debug-only code. Often this is just null checks or other 5780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parameter checking, but sometimes it can be quite intrusive (e.g. check that 5880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru each 32bit pixel is in premultiplied form). This code can be very useful 5980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru during development, but will slow things down in a shipping product. 6080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 6180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru By default, these mutually exclusive flags are defined in SkPreConfig.h, 6280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru based on the presence or absence of NDEBUG, but that decision can be changed 6380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru here. 6480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 6580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_DEBUG 6680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_RELEASE 6780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 68363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger/* Skia has certain debug-only code that is extremely intensive even for debug 69363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger builds. This code is useful for diagnosing specific issues, but is not 70363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger generally applicable, therefore it must be explicitly enabled to avoid 71363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger the performance impact. By default these flags are undefined, but can be 72363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger enabled by uncommenting them below. 73363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger */ 74363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger//#define SK_DEBUG_GLYPH_CACHE 75363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger//#define SK_DEBUG_PATH 76363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger 7780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* To assist debugging, Skia provides an instance counting utility in 7880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru include/core/SkInstCount.h. This flag turns on and off that utility to 7980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru allow instance count tracking in either debug or release builds. By 8080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru default it is enabled in debug but disabled in release. 8180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 82d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger//#define SK_ENABLE_INST_COUNT 1 8380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 8480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* If, in debugging mode, Skia needs to stop (presumably to invoke a debugger) 8580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru it will call SK_CRASH(). If this is not defined it, it is defined in 8680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkPostConfig.h to write to an illegal address 8780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 8880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_CRASH() *(int *)(uintptr_t)0 = 0 8980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 9080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 9180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* preconfig will have attempted to determine the endianness of the system, 9280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru but you can change these mutually exclusive flags here. 9380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 9480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_CPU_BENDIAN 9580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_CPU_LENDIAN 9680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 9780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* Most compilers use the same bit endianness for bit flags in a byte as the 9880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru system byte endianness, and this is the default. If for some reason this 9980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru needs to be overridden, specify which of the mutually exclusive flags to 10080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru use. For example, some atom processors in certain configurations have big 10180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru endian byte order but little endian bit orders. 10280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru*/ 10380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_UINT8_BITFIELD_BENDIAN 10480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_UINT8_BITFIELD_LENDIAN 10580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 10680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 10780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* Some compilers don't support long long for 64bit integers. If yours does 10880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru not, define this to the appropriate type. 10980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 11080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SkLONGLONG int64_t 11180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 11280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 11380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* To write debug messages to a console, skia will call SkDebugf(...) following 11480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru printf conventions (e.g. const char* format, ...). If you want to redirect 11580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru this to something other than printf, define yours here 11680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 11780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SkDebugf(...) MyFunction(__VA_ARGS__) 11880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 11980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* 12080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * To specify a different default font cache limit, define this. If this is 12180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * undefined, skia will use a built-in value. 12280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 12380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_DEFAULT_FONT_CACHE_LIMIT (1024 * 1024) 12480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 12558190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger/* 12658190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger * To specify the default size of the image cache, undefine this and set it to 12758190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger * the desired value (in bytes). SkGraphics.h as a runtime API to set this 12858190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger * value as well. If this is undefined, a built-in value will be used. 12958190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger */ 13058190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger//#define SK_DEFAULT_IMAGE_CACHE_LIMIT (1024 * 1024) 13180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 13280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* If zlib is available and you want to support the flate compression 13380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru algorithm (used in PDF generation), define SK_ZLIB_INCLUDE to be the 13480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru include path. Alternatively, define SK_SYSTEM_ZLIB to use the system zlib 13580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru library specified as "#include <zlib.h>". 13680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 13780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_ZLIB_INCLUDE <zlib.h> 13880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_SYSTEM_ZLIB 13980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 14080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* Define this to allow PDF scalars above 32k. The PDF/A spec doesn't allow 14180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru them, but modern PDF interpreters should handle them just fine. 14280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 14380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_ALLOW_LARGE_PDF_SCALARS 14480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 14580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* Define this to provide font subsetter in PDF generation. 14680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 14780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_SFNTLY_SUBSETTER "sfntly/subsetter/font_subsetter.h" 14880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 14980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* Define this to set the upper limit for text to support LCD. Values that 15080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru are very large increase the cost in the font cache and draw slower, without 15180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru improving readability. If this is undefined, Skia will use its default 15280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru value (e.g. 48) 15380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 15480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_MAX_SIZE_FOR_LCDTEXT 48 15580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 15680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST 15780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru which will run additional self-tests at startup. These can take a long time, 15880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru so this flag is optional. 15980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 16080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifdef SK_DEBUG 16180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_SUPPORT_UNITTEST 16280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 16380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 16480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* If your system embeds skia and has complex event logging, define this 16580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru symbol to name a file that maps the following macros to your system's 16680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru equivalents: 16780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SK_TRACE_EVENT0(event) 16880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SK_TRACE_EVENT1(event, name1, value1) 16980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SK_TRACE_EVENT2(event, name1, value1, name2, value2) 17080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru src/utils/SkDebugTrace.h has a trivial implementation that writes to 17180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru the debug output stream. If SK_USER_TRACE_INCLUDE_FILE is not defined, 17280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkTrace.h will define the above three macros to do nothing. 17380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru*/ 17480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#undef SK_USER_TRACE_INCLUDE_FILE 17580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 17680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* Change the ordering to work in X windows. 17780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 17880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifdef SK_SAMPLES_FOR_X 17980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru #define SK_R32_SHIFT 16 18080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru #define SK_G32_SHIFT 8 18180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru #define SK_B32_SHIFT 0 18280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru #define SK_A32_SHIFT 24 18380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 18480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 18580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 18680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* Determines whether to build code that supports the GPU backend. Some classes 18780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru that are not GPU-specific, such as SkShader subclasses, have optional code 18880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru that is used allows them to interact with the GPU backend. If you'd like to 18980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru omit this code set SK_SUPPORT_GPU to 0. This also allows you to omit the gpu 19080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru directories from your include search path when you're not building the GPU 19180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru backend. Defaults to 1 (build the GPU code). 19280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 19380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//#define SK_SUPPORT_GPU 1 194363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger 19580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 196