1 /* 2 * Copyright 2006 The Android Open Source Project 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkUserConfig_DEFINED 9 #define SkUserConfig_DEFINED 10 11 /* SkTypes.h, the root of the public header files, includes this file 12 SkUserConfig.h after first initializing certain Skia defines, letting 13 this file change or augment those flags. 14 15 Below are optional defines that add, subtract, or change default behavior 16 in Skia. Your port can locally edit this file to enable/disable flags as 17 you choose, or these can be declared on your command line (i.e. -Dfoo). 18 19 By default, this #include file will always default to having all the flags 20 commented out, so including it will have no effect. 21 */ 22 23 /////////////////////////////////////////////////////////////////////////////// 24 25 /* Skia has lots of debug-only code. Often this is just null checks or other 26 parameter checking, but sometimes it can be quite intrusive (e.g. check that 27 each 32bit pixel is in premultiplied form). This code can be very useful 28 during development, but will slow things down in a shipping product. 29 30 By default, these mutually exclusive flags are defined in SkTypes.h, 31 based on the presence or absence of NDEBUG, but that decision can be changed 32 here. 33 */ 34 //#define SK_DEBUG 35 //#define SK_RELEASE 36 37 /* To write debug messages to a console, skia will call SkDebugf(...) following 38 printf conventions (e.g. const char* format, ...). If you want to redirect 39 this to something other than printf, define yours here 40 */ 41 //#define SkDebugf(...) MyFunction(__VA_ARGS__) 42 43 /* Skia has both debug and release asserts. When an assert fails SK_ABORT will 44 be used to report an abort message. SK_ABORT is expected not to return. Skia 45 provides a default implementation which will print the message with SkDebugf 46 and then call sk_abort_no_print. 47 */ 48 //#define SK_ABORT(message, ...) 49 50 /* To specify a different default font strike cache memory limit, define this. If this is 51 undefined, skia will use a built-in value. 52 */ 53 //#define SK_DEFAULT_FONT_CACHE_LIMIT (1024 * 1024) 54 55 /* To specify a different default font strike cache count limit, define this. If this is 56 undefined, skia will use a built-in value. 57 */ 58 // #define SK_DEFAULT_FONT_CACHE_COUNT_LIMIT 2048 59 60 /* To specify the default size of the image cache, undefine this and set it to 61 the desired value (in bytes). SkGraphics.h as a runtime API to set this 62 value as well. If this is undefined, a built-in value will be used. 63 */ 64 //#define SK_DEFAULT_IMAGE_CACHE_LIMIT (1024 * 1024) 65 66 /* Define this to set the upper limit for text to support LCD. Values that 67 are very large increase the cost in the font cache and draw slower, without 68 improving readability. If this is undefined, Skia will use its default 69 value (e.g. 48) 70 */ 71 //#define SK_MAX_SIZE_FOR_LCDTEXT 48 72 73 /* Change the kN32_SkColorType ordering to BGRA to work in X windows. 74 */ 75 //#define SK_R32_SHIFT 16 76 77 /* This controls how much space should be pre-allocated in an SkCanvas object 78 to store the SkMatrix and clip via calls to SkCanvas::save() (and balanced with 79 SkCanvas::restore()). 80 */ 81 //#define SK_CANVAS_SAVE_RESTORE_PREALLOC_COUNT 32 82 83 /* Determines whether to build code that supports the Ganesh GPU backend. Some classes 84 that are not GPU-specific, such as SkShader subclasses, have optional code 85 that is used allows them to interact with this GPU backend. If you'd like to 86 include this code, include -DSK_GANESH in your cflags or uncomment below. 87 Defaults to not set (No Ganesh GPU backend). 88 This define affects the ABI of Skia, so make sure it matches the client which uses 89 the compiled version of Skia. 90 */ 91 //#define SK_GANESH 92 93 /* Skia makes use of histogram logging macros to trace the frequency of 94 events. By default, Skia provides no-op versions of these macros. 95 Skia consumers can provide their own definitions of these macros to 96 integrate with their histogram collection backend. 97 */ 98 //#define SK_HISTOGRAM_BOOLEAN(name, sample) 99 //#define SK_HISTOGRAM_ENUMERATION(name, sampleEnum, enumSize) 100 //#define SK_HISTOGRAM_EXACT_LINEAR(name, sample, valueMax) 101 //#define SK_HISTOGRAM_MEMORY_KB(name, sample) 102 //#define SK_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(name, sampleUSec, minUSec, maxUSec, bucketCount) 103 104 /* 105 * Skia can provide extensive logging of Graphite Pipeline lifetimes. 106 */ 107 //#define SK_PIPELINE_LIFETIME_LOGGING 108 109 // To use smaller but slower mipmap builder 110 //#define SK_USE_DRAWING_MIPMAP_DOWNSAMPLER 111 112 /* Skia tries to make use of some non-standard C++ language extensions. 113 By default, Skia provides msvc and clang/gcc versions of these macros. 114 Skia consumers can provide their own definitions of these macros to 115 integrate with their own compilers and build system. 116 */ 117 //#define SK_ALWAYS_INLINE inline __attribute__((always_inline)) 118 //#define SK_NEVER_INLINE __attribute__((noinline)) 119 //#define SK_PRINTF_LIKE(A, B) __attribute__((format(printf, (A), (B)))) 120 //#define SK_NO_SANITIZE(A) __attribute__((no_sanitize(A))) 121 //#define SK_TRIVIAL_ABI [[clang::trivial_abi]] 122 123 /* 124 * If compiling Skia as a DLL, public APIs should be exported. Skia will set 125 * SK_API to something sensible for Clang and MSVC, but if clients need to 126 * customize it for their build system or compiler, they may. 127 * If a client needs to use SK_API (e.g. overriding SK_ABORT), then they 128 * *must* define their own, the default will not be defined prior to loading 129 * this file. 130 */ 131 //#define SK_API __declspec(dllexport) 132 #ifndef SK_GAMMA_APPLY_TO_A8 133 #define SK_GAMMA_APPLY_TO_A8 134 #endif 135 136 #ifndef SK_GAMMA_CONTRAST 137 #define SK_GAMMA_CONTRAST 0.0 138 #endif 139 140 #ifndef SK_GAMMA_EXPONENT 141 #define SK_GAMMA_EXPONENT 1.0 142 #endif 143 144 #endif 145