Upload upstream chromium 76.0.3809.146
[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 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 the GPU backend. If you'd like to
111    omit this code set SK_SUPPORT_GPU to 0. This also allows you to omit the gpu
112    directories from your include search path when you're not building the GPU
113    backend. Defaults to 1 (build the GPU code).
114  */
115 //#define SK_SUPPORT_GPU 1
116
117 /* Skia makes use of histogram logging macros to trace the frequency of
118  * events. By default, Skia provides no-op versions of these macros.
119  * Skia consumers can provide their own definitions of these macros to
120  * integrate with their histogram collection backend.
121  */
122 //#define SK_HISTOGRAM_BOOLEAN(name, value)
123 //#define SK_HISTOGRAM_ENUMERATION(name, value, boundary_value)
124
125 // ===== Begin Chrome-specific definitions =====
126
127 #ifdef DCHECK_ALWAYS_ON
128     #undef SK_RELEASE
129     #define SK_DEBUG
130 #endif
131
132 /*  Define this to provide font subsetter for font subsetting when generating
133     PDF documents.
134  */
135 #define SK_PDF_USE_SFNTLY
136
137 // Chromium does not use these fonts.  This define causes type1 fonts to be
138 // converted to type3 when producing PDFs, and reduces build size.
139 #define SK_PDF_DO_NOT_SUPPORT_TYPE_1_FONTS
140
141 #ifdef SK_DEBUG
142 #define SK_REF_CNT_MIXIN_INCLUDE "skia/config/sk_ref_cnt_ext_debug.h"
143 #else
144 #define SK_REF_CNT_MIXIN_INCLUDE "skia/config/sk_ref_cnt_ext_release.h"
145 #endif
146
147 #define SK_MSCALAR_IS_FLOAT
148 #undef SK_MSCALAR_IS_DOUBLE
149
150 // Log the file and line number for assertions.
151 #define SkDebugf(...) SkDebugf_FileLine(__FILE__, __LINE__, __VA_ARGS__)
152 SK_API void SkDebugf_FileLine(const char* file,
153                               int line,
154                               const char* format,
155                               ...);
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_MAC)
165
166 #define SK_CPU_LENDIAN
167 #undef  SK_CPU_BENDIAN
168
169 #elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID)
170
171 // Prefer FreeType's emboldening algorithm to Skia's
172 // TODO: skia used to just use hairline, but has improved since then, so
173 // we should revisit this choice...
174 #define SK_USE_FREETYPE_EMBOLDEN
175
176 #if defined(SK_BUILD_FOR_UNIX) && defined(SK_CPU_BENDIAN)
177 // Above we set the order for ARGB channels in registers. I suspect that, on
178 // big endian machines, you can keep this the same and everything will work.
179 // The in-memory order will be different, of course, but as long as everything
180 // is reading memory as words rather than bytes, it will all work. However, if
181 // you find that colours are messed up I thought that I would leave a helpful
182 // locator for you. Also see the comments in
183 // base/gfx/bitmap_platform_device_linux.h
184 #error Read the comment at this location
185 #endif
186
187 #endif
188
189 // These flags are no longer defined in Skia, but we have them (temporarily)
190 // until we update our call-sites (typically these are for API changes).
191 //
192 // Remove these as we update our sites.
193
194 // Workaround for poor anisotropic mipmap quality,
195 // pending Skia ripmap support.
196 // (https://bugs.chromium.org/p/skia/issues/detail?id=4863)
197 #ifndef    SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE
198 #   define SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE
199 #endif
200
201 // Remove this after we fixed all the issues related to the new SDF algorithm
202 // (https://codereview.chromium.org/1643143002)
203 #ifndef SK_USE_LEGACY_DISTANCE_FIELDS
204 #define SK_USE_LEGACY_DISTANCE_FIELDS
205 #endif
206
207 // skbug.com/4783
208 #ifndef SK_SUPPORT_LEGACY_DRAWLOOPER
209 #define SK_SUPPORT_LEGACY_DRAWLOOPER
210 #endif
211
212 // For now, Chrome should only attempt to reduce opList splitting when recording
213 // DDLs
214 #ifndef SK_DISABLE_REDUCE_OPLIST_SPLITTING
215 #define SK_DISABLE_REDUCE_OPLIST_SPLITTING
216 #endif
217
218 #ifndef SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS
219 #define SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS
220 #endif
221
222 // Max. verb count for paths rendered by the edge-AA tessellating path renderer.
223 #define GR_AA_TESSELLATOR_MAX_VERB_COUNT 100
224
225 #ifndef SK_SUPPORT_LEGACY_AAA_CHOICE
226 #define SK_SUPPORT_LEGACY_AAA_CHOICE
227 #endif
228
229 // We're turning this off indefinitely,
230 // until we can figure out some fundamental problems with its approach.
231 //
232 // See chromium:913223, skia:6886.
233 #define SK_DISABLE_DAA
234
235 // Staging for lowp::bilerp_clamp_8888, and for planned misc. others.
236 #define SK_DISABLE_LOWP_BILERP_CLAMP_CLAMP_STAGE
237 #define SK_DISABLE_NEXT_BATCH_OF_LOWP_STAGES
238
239 ///////////////////////// Imported from BUILD.gn and skia_common.gypi
240
241 /* In some places Skia can use static initializers for global initialization,
242  *  or fall back to lazy runtime initialization. Chrome always wants the latter.
243  */
244 #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0
245
246 /* Restrict formats for Skia font matching to SFNT type fonts. */
247 #define SK_FONT_CONFIG_INTERFACE_ONLY_ALLOW_SFNT_FONTS
248
249 #define SK_IGNORE_BLURRED_RRECT_OPT
250 #define SK_USE_DISCARDABLE_SCALEDIMAGECACHE
251
252 #define SK_ATTR_DEPRECATED          SK_NOTHING_ARG1
253 #define GR_GL_CUSTOM_SETUP_HEADER   "GrGLConfig_chrome.h"
254
255 #endif