• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "SkPreConfig.h"
16     #include "SkUserConfig.h"
17     #include "SkPostConfig.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 ordering to work in X windows.
104  */
105 // #ifdef SK_SAMPLES_FOR_X
106 //         #define SK_R32_SHIFT    16
107 //         #define SK_G32_SHIFT    8
108 //         #define SK_B32_SHIFT    0
109 //         #define SK_A32_SHIFT    24
110 // #endif
111 
112 
113 /* Determines whether to build code that supports the GPU backend. Some classes
114    that are not GPU-specific, such as SkShader subclasses, have optional code
115    that is used allows them to interact with the GPU backend. If you'd like to
116    omit this code set SK_SUPPORT_GPU to 0. This also allows you to omit the gpu
117    directories from your include search path when you're not building the GPU
118    backend. Defaults to 1 (build the GPU code).
119  */
120 // #define SK_SUPPORT_GPU 1
121 
122 /* Skia makes use of histogram logging macros to trace the frequency of
123  * events. By default, Skia provides no-op versions of these macros.
124  * Skia consumers can provide their own definitions of these macros to
125  * integrate with their histogram collection backend.
126  */
127 // #define SK_HISTOGRAM_BOOLEAN(name, value)
128 // #define SK_HISTOGRAM_ENUMERATION(name, value, boundary_value)
129 
130 // ===== Begin Chrome-specific definitions =====
131 
132 #define SK_MSCALAR_IS_FLOAT
133 #undef SK_MSCALAR_IS_DOUBLE
134 
135 #define GR_MAX_OFFSCREEN_AA_DIM 512
136 
137 // Log the file and line number for assertions.
138 #define SkDebugf(...) SkDebugf_FileLine(__FILE__, __LINE__, __VA_ARGS__)
139 SK_API void SkDebugf_FileLine(const char* file,
140                               int line,
141                               const char* format,
142                               ...);
143 
144 #if !defined(ANDROID)  // On Android, we use the skia default settings.
145 #define SK_A32_SHIFT 24
146 #define SK_R32_SHIFT 16
147 #define SK_G32_SHIFT 8
148 #define SK_B32_SHIFT 0
149 #endif
150 
151 #if defined(SK_BUILD_FOR_WIN32)
152 
153 #define SK_BUILD_FOR_WIN
154 
155 // Skia uses this deprecated bzero function to fill zeros into a string.
156 #define bzero(str, len) memset(str, 0, len)
157 
158 #elif defined(SK_BUILD_FOR_MAC)
159 
160 #define SK_CPU_LENDIAN
161 #undef SK_CPU_BENDIAN
162 
163 #elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID)
164 
165 // Prefer FreeType's emboldening algorithm to Skia's
166 // TODO: skia used to just use hairline, but has improved since then, so
167 // we should revisit this choice...
168 #define SK_USE_FREETYPE_EMBOLDEN
169 
170 #if defined(SK_BUILD_FOR_UNIX) && defined(SK_CPU_BENDIAN)
171 // Above we set the order for ARGB channels in registers. I suspect that, on
172 // big endian machines, you can keep this the same and everything will work.
173 // The in-memory order will be different, of course, but as long as everything
174 // is reading memory as words rather than bytes, it will all work. However, if
175 // you find that colours are messed up I thought that I would leave a helpful
176 // locator for you. Also see the comments in
177 // base/gfx/bitmap_platform_device_linux.h
178 #error Read the comment at this location
179 #endif
180 
181 #endif
182 
183 // These flags are no longer defined in Skia, but we have them (temporarily)
184 // until we update our call-sites (typically these are for API changes).
185 //
186 // Remove these as we update our sites.
187 //
188 #ifndef SK_SUPPORT_LEGACY_GETTOPDEVICE
189 #define SK_SUPPORT_LEGACY_GETTOPDEVICE
190 #endif
191 
192 #ifndef SK_SUPPORT_EXOTIC_CLIPOPS
193 #define SK_SUPPORT_EXOTIC_CLIPOPS
194 #endif
195 
196 #ifndef SK_SUPPORT_LEGACY_GETDEVICE
197 #define SK_SUPPORT_LEGACY_GETDEVICE
198 #endif
199 
200 // Workaround for poor anisotropic mipmap quality,
201 // pending Skia ripmap support.
202 // (https://bugs.chromium.org/p/skia/issues/detail?id=4863)
203 #ifndef SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE
204 #define SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE
205 #endif
206 
207 #ifndef SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX
208 #define SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX
209 #endif
210 
211 #ifndef SK_IGNORE_ETC1_SUPPORT
212 #define SK_IGNORE_ETC1_SUPPORT
213 #endif
214 
215 #ifndef SK_IGNORE_GPU_DITHER
216 #define SK_IGNORE_GPU_DITHER
217 #endif
218 
219 #ifndef SK_SUPPORT_LEGACY_EVAL_CUBIC
220 #define SK_SUPPORT_LEGACY_EVAL_CUBIC
221 #endif
222 
223 ///////////////////////// Imported from BUILD.gn
224 
225 /* In some places Skia can use static initializers for global initialization,
226  *  or fall back to lazy runtime initialization. Chrome always wants the latter.
227  */
228 #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0
229 
230 /* This flag forces Skia not to use typographic metrics with GDI.
231  */
232 #define SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS
233 
234 #define SK_IGNORE_BLURRED_RRECT_OPT
235 #define SK_USE_DISCARDABLE_SCALEDIMAGECACHE
236 #define SK_WILL_NEVER_DRAW_PERSPECTIVE_TEXT
237 
238 #define SK_ATTR_DEPRECATED SK_NOTHING_ARG1
239 #define SK_ENABLE_INST_COUNT 0
240 #define GR_GL_CUSTOM_SETUP_HEADER "GrGLConfig_chrome.h"
241 
242 // Blink layout tests are baselined to Clang optimizing through the UB in
243 // SkDivBits.
244 #define SK_SUPPORT_LEGACY_DIVBITS_UB
245 
246 // mtklein's fiddling with Src / SrcOver.  Will rebaseline these only once when
247 // done.
248 #define SK_SUPPORT_LEGACY_X86_BLITS
249 
250 #define SK_DISABLE_TILE_IMAGE_FILTER_OPTIMIZATION
251 
252 // ===== End Chrome-specific definitions =====
253 
254 #endif  // SKIA_CONFIG_SKUSERCONFIG_H_
255