Upload upstream chromium 114.0.5735.31
[platform/framework/web/chromium-efl.git] / skia / config / SkUserConfig.h
1
2 /*
3  * Copyright 2006 The Android Open Source Project
4  *
5  * Use of this source code is governed by a BSD-style license that can be
6  * found in the LICENSE file.
7  */
8
9
10 #ifndef SKIA_CONFIG_SKUSERCONFIG_H_
11 #define SKIA_CONFIG_SKUSERCONFIG_H_
12
13 /*  SkTypes.h, the root of the public header files, does the following trick:
14
15     #include "include/config/SkUserConfig.h"
16     #include "include/core/SkPostConfig.h"
17     #include "include/core/SkPreConfig.h"
18
19     SkPreConfig.h runs first, and it is responsible for initializing certain
20     skia defines.
21
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).
25
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.
29
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).
33
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.
36 */
37
38 ///////////////////////////////////////////////////////////////////////////////
39
40 /*  Skia has lots of debug-only code. Often this is just null checks or other
41     parameter checking, but sometimes it can be quite intrusive (e.g. check that
42     each 32bit pixel is in premultiplied form). This code can be very useful
43     during development, but will slow things down in a shipping product.
44
45     By default, these mutually exclusive flags are defined in SkPreConfig.h,
46     based on the presence or absence of NDEBUG, but that decision can be changed
47     here.
48  */
49 //#define SK_DEBUG
50 //#define SK_RELEASE
51
52 /*  Skia has certain debug-only code that is extremely intensive even for debug
53     builds.  This code is useful for diagnosing specific issues, but is not
54     generally applicable, therefore it must be explicitly enabled to avoid
55     the performance impact. By default these flags are undefined, but can be
56     enabled by uncommenting them below.
57  */
58 //#define SK_DEBUG_GLYPH_CACHE
59 //#define SK_DEBUG_PATH
60
61 /*  preconfig will have attempted to determine the endianness of the system,
62     but you can change these mutually exclusive flags here.
63  */
64 //#define SK_CPU_BENDIAN
65 //#define SK_CPU_LENDIAN
66
67 /*  Most compilers use the same bit endianness for bit flags in a byte as the
68     system byte endianness, and this is the default. If for some reason this
69     needs to be overridden, specify which of the mutually exclusive flags to
70     use. For example, some atom processors in certain configurations have big
71     endian byte order but little endian bit orders.
72 */
73 //#define SK_UINT8_BITFIELD_BENDIAN
74 //#define SK_UINT8_BITFIELD_LENDIAN
75
76
77 /*  To write debug messages to a console, skia will call SkDebugf(...) following
78     printf conventions (e.g. const char* format, ...). If you want to redirect
79     this to something other than printf, define yours here
80  */
81 //#define SkDebugf(...)  MyFunction(__VA_ARGS__)
82
83 /*
84  *  To specify a different default font cache limit, define this. If this is
85  *  undefined, skia will use a built-in value.
86  */
87 //#define SK_DEFAULT_FONT_CACHE_LIMIT   (1024 * 1024)
88
89 /*
90  *  To specify the default size of the image cache, undefine this and set it to
91  *  the desired value (in bytes). SkGraphics.h as a runtime API to set this
92  *  value as well. If this is undefined, a built-in value will be used.
93  */
94 //#define SK_DEFAULT_IMAGE_CACHE_LIMIT (1024 * 1024)
95
96 /*  Define this to set the upper limit for text to support LCD. Values that
97     are very large increase the cost in the font cache and draw slower, without
98     improving readability. If this is undefined, Skia will use its default
99     value (e.g. 48)
100  */
101 //#define SK_MAX_SIZE_FOR_LCDTEXT     48
102
103 /*  Change the kN32_SkColorType ordering to BGRA to work in X windows.
104  */
105 //#define SK_R32_SHIFT    16
106
107
108 /* Determines whether to build code that supports the Ganesh GPU backend. Some classes
109    that are not GPU-specific, such as SkShader subclasses, have optional code
110    that is used allows them to interact with this GPU backend. If you'd like to
111    include this code, include -DSK_GANESH in your cflags or uncomment below.
112    Defaults to not set (No Ganesh GPU backend).
113    This define affects the ABI of Skia, so make sure it matches the client which uses
114    the compiled version of Skia.
115 */
116 // #define SK_GANESH
117
118 /* Skia makes use of histogram logging macros to trace the frequency of
119  * events. By default, Skia provides no-op versions of these macros.
120  * Skia consumers can provide their own definitions of these macros to
121  * integrate with their histogram collection backend.
122  */
123 //#define SK_HISTOGRAM_BOOLEAN(name, sample)
124 //#define SK_HISTOGRAM_EXACT_LINEAR(name, sample, value_max)
125 //#define SK_HISTOGRAM_MEMORY_KB(name, sample)
126 #include "base/component_export.h"
127 #include "skia/ext/skia_histogram.h"
128
129 // ===== Begin Chrome-specific definitions =====
130
131 #ifdef DCHECK_ALWAYS_ON
132     #undef SK_RELEASE
133     #define SK_DEBUG
134 #endif
135
136 /*  Define this to provide font subsetter for font subsetting when generating
137     PDF documents.
138  */
139 #define SK_PDF_USE_HARFBUZZ_SUBSET
140
141 // Handle exporting using base/component_export.h
142 #define SK_API COMPONENT_EXPORT(SKIA)
143
144 // Chromium does not use these fonts.  This define causes type1 fonts to be
145 // converted to type3 when producing PDFs, and reduces build size.
146 #define SK_PDF_DO_NOT_SUPPORT_TYPE_1_FONTS
147
148 #ifdef SK_DEBUG
149 #define SK_REF_CNT_MIXIN_INCLUDE "skia/config/sk_ref_cnt_ext_debug.h"
150 #else
151 #define SK_REF_CNT_MIXIN_INCLUDE "skia/config/sk_ref_cnt_ext_release.h"
152 #endif
153
154 // Log the file and line number for assertions.
155 #define SkDebugf(...) SkDebugf_FileLine(__FILE__, __LINE__, __VA_ARGS__)
156 SK_API void SkDebugf_FileLine(const char* file,
157                               int line,
158                               const char* format,
159                               ...);
160
161 #define SK_ABORT(format, ...) SkAbort_FileLine(__FILE__, __LINE__, \
162                                                format,##__VA_ARGS__)
163 [[noreturn]] SK_API void SkAbort_FileLine(const char* file,
164                                           int line,
165                                           const char* format,
166                                           ...);
167
168 #if !defined(ANDROID)   // On Android, we use the skia default settings.
169 #define SK_A32_SHIFT    24
170 #define SK_R32_SHIFT    16
171 #define SK_G32_SHIFT    8
172 #define SK_B32_SHIFT    0
173 #endif
174
175 #if defined(SK_BUILD_FOR_MAC)
176
177 #define SK_CPU_LENDIAN
178 #undef  SK_CPU_BENDIAN
179
180 #elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID)
181
182 // Prefer FreeType's emboldening algorithm to Skia's
183 // TODO: skia used to just use hairline, but has improved since then, so
184 // we should revisit this choice...
185 #define SK_USE_FREETYPE_EMBOLDEN
186
187 #if defined(SK_BUILD_FOR_UNIX) && defined(SK_CPU_BENDIAN)
188 // Above we set the order for ARGB channels in registers. I suspect that, on
189 // big endian machines, you can keep this the same and everything will work.
190 // The in-memory order will be different, of course, but as long as everything
191 // is reading memory as words rather than bytes, it will all work. However, if
192 // you find that colours are messed up I thought that I would leave a helpful
193 // locator for you. Also see the comments in
194 // base/gfx/bitmap_platform_device_linux.h
195 #error Read the comment at this location
196 #endif
197
198 #endif
199
200 #if defined(__has_attribute)
201 #if __has_attribute(trivial_abi)
202 #define SK_TRIVIAL_ABI [[clang::trivial_abi]]
203 #else
204 #define SK_TRIVIAL_ABI
205 #endif
206 #else
207 #define SK_TRIVIAL_ABI
208 #endif
209
210 // These flags are no longer defined in Skia, but we have them (temporarily)
211 // until we update our call-sites (typically these are for API changes).
212 //
213 // Remove these as we update our sites.
214
215 #define SK_LEGACY_LAYER_BOUNDS_EXPANSION  // skbug.com/12083, skbug.com/12303
216
217 // Workaround for poor anisotropic mipmap quality,
218 // pending Skia ripmap support.
219 // (https://bugs.chromium.org/p/skia/issues/detail?id=4863)
220 #define SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE
221
222 // Temporarily insulate Chrome pixel tests from Skia LOD bias change on GPU.
223 #define SK_USE_LEGACY_MIPMAP_LOD_BIAS
224
225 // Max. verb count for paths rendered by the edge-AA tessellating path renderer.
226 #define GR_AA_TESSELLATOR_MAX_VERB_COUNT 100
227
228 #define SK_FORCE_AAA
229
230 #define SK_SUPPORT_LEGACY_DRAWLOOPER
231
232 #define SK_USE_LEGACY_MIPMAP_BUILDER
233
234 #define SK_SUPPORT_LEGACY_CONIC_CHOP
235
236 // To be replaced with SK_ENABLE_SKSL_IN_RASTER_PIPELINE (go/sksl-rp):
237 #define SK_ENABLE_SKVM
238
239 // Use the original std::vector based serializer
240 // Remove when new streaming support operations has been verified.
241 // #define SK_SUPPORT_LEGACY_STRIKE_SERIALIZATION
242
243 ///////////////////////// Imported from BUILD.gn and skia_common.gypi
244
245 /* In some places Skia can use static initializers for global initialization,
246  *  or fall back to lazy runtime initialization. Chrome always wants the latter.
247  */
248 #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0
249
250 /* Restrict formats for Skia font matching to SFNT type fonts. */
251 #define SK_FONT_CONFIG_INTERFACE_ONLY_ALLOW_SFNT_FONTS
252
253 #define SK_IGNORE_BLURRED_RRECT_OPT
254 #define SK_USE_DISCARDABLE_SCALEDIMAGECACHE
255
256 #define SK_ATTR_DEPRECATED          SK_NOTHING_ARG1
257 #define GR_GL_CUSTOM_SETUP_HEADER   "GrGLConfig_chrome.h"
258
259 #endif  // SKIA_CONFIG_SKUSERCONFIG_H_