Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: skia/config/SkUserConfig.h

Issue 65012: Move skia to DEPS, and put it in third_party. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_widget.cc ('k') | skia/config/win/stdint.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef SkUserConfig_DEFINED
18 #define SkUserConfig_DEFINED
19
20 /* SkTypes.h, the root of the public header files, does the following trick:
21
22 #include <SkPreConfig.h>
23 #include <SkUserConfig.h>
24 #include <SkPostConfig.h>
25
26 SkPreConfig.h runs first, and it is responsible for initializing certain
27 skia defines.
28
29 SkPostConfig.h runs last, and its job is to just check that the final
30 defines are consistent (i.e. that we don't have mutually conflicting
31 defines).
32
33 SkUserConfig.h (this file) runs in the middle. It gets to change or augment
34 the list of flags initially set in preconfig, and then postconfig checks
35 that everything still makes sense.
36
37 Below are optional defines that add, subtract, or change default behavior
38 in Skia. Your port can locally edit this file to enable/disable flags as
39 you choose, or these can be delared on your command line (i.e. -Dfoo).
40
41 By default, this include file will always default to having all of the flags
42 commented out, so including it will have no effect.
43 */
44
45 ///////////////////////////////////////////////////////////////////////////////
46
47 /* Scalars (the fractional value type in skia) can be implemented either as
48 floats or 16.16 integers (fixed). Exactly one of these two symbols must be
49 defined.
50 */
51 //#define SK_SCALAR_IS_FLOAT
52 //#define SK_SCALAR_IS_FIXED
53
54
55 /* Somewhat independent of how SkScalar is implemented, Skia also wants to know
56 if it can use floats at all. Naturally, if SK_SCALAR_IS_FLOAT is defined,
57 then so muse SK_CAN_USE_FLOAT, but if scalars are fixed, SK_CAN_USE_FLOAT
58 can go either way.
59 */
60 //#define SK_CAN_USE_FLOAT
61
62 /* For some performance-critical scalar operations, skia will optionally work
63 around the standard float operators if it knows that the CPU does not have
64 native support for floats. If your environment uses software floating point,
65 define this flag.
66 */
67 //#define SK_SOFTWARE_FLOAT
68
69
70 /* Skia has lots of debug-only code. Often this is just null checks or other
71 parameter checking, but sometimes it can be quite intrusive (e.g. check that
72 each 32bit pixel is in premultiplied form). This code can be very useful
73 during development, but will slow things down in a shipping product.
74
75 By default, these mutually exclusive flags are defined in SkPreConfig.h,
76 based on the presence or absence of NDEBUG, but that decision can be changed
77 here.
78 */
79 //#define SK_DEBUG
80 //#define SK_RELEASE
81
82
83 /* If, in debugging mode, Skia needs to stop (presumably to invoke a debugger)
84 it will call SK_CRASH(). If this is not defined it, it is defined in
85 SkPostConfig.h to write to an illegal address
86 */
87 //#define SK_CRASH() *(int *)(uintptr_t)0 = 0
88
89
90 /* preconfig will have attempted to determine the endianness of the system,
91 but you can change these mutually exclusive flags here.
92 */
93 //#define SK_CPU_BENDIAN
94 //#define SK_CPU_LENDIAN
95
96
97 /* Some compilers don't support long long for 64bit integers. If yours does
98 not, define this to the appropriate type.
99 */
100 //#define SkLONGLONG int64_t
101
102
103 /* Some envorinments do not suport writable globals (eek!). If yours does not,
104 define this flag.
105 */
106 //#define SK_USE_RUNTIME_GLOBALS
107
108
109 /* To write debug messages to a console, skia will call SkDebugf(...) following
110 printf conventions (e.g. const char* format, ...). If you want to redirect
111 this to something other than printf, define yours here
112 */
113 //#define SkDebugf(...) MyFunction(__VA_ARGS__)
114
115
116 /* If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST
117 which will run additional self-tests at startup. These can take a long time,
118 so this flag is optional.
119 */
120 #ifdef SK_DEBUG
121 #define SK_SUPPORT_UNITTEST
122 #endif
123
124 // ===== Begin Chrome-specific definitions =====
125
126 #define SK_SCALAR_IS_FLOAT
127 #undef SK_SCALAR_IS_FIXED
128
129 // Log the file and line number for assertions.
130 #define SkDebugf(...) SkDebugf_FileLine(__FILE__, __LINE__, false, __VA_ARGS__)
131 void SkDebugf_FileLine(const char* file, int line, bool fatal,
132 const char* format, ...);
133
134 // Marking the debug print as "fatal" will cause a debug break, so we don't need
135 // a separate crash call here.
136 #define SK_DEBUGBREAK(cond) do { if (!(cond)) { \
137 SkDebugf_FileLine(__FILE__, __LINE__, true, \
138 "%s:%d: failed assertion \"%s\"\n", \
139 __FILE__, __LINE__, #cond); } } while (false)
140
141 #if defined(SK_BUILD_FOR_WIN32)
142
143 #define SK_BUILD_FOR_WIN
144
145 // VC8 doesn't support stdint.h, so we define those types here.
146 #define SK_IGNORE_STDINT_DOT_H
147 typedef signed char int8_t;
148 typedef unsigned char uint8_t;
149 typedef short int16_t;
150 typedef unsigned short uint16_t;
151 typedef int int32_t;
152 typedef unsigned uint32_t;
153 #define SK_A32_SHIFT 24
154 #define SK_R32_SHIFT 16
155 #define SK_G32_SHIFT 8
156 #define SK_B32_SHIFT 0
157
158 // VC doesn't support __restrict__, so make it a NOP.
159 #undef SK_RESTRICT
160 #define SK_RESTRICT
161
162 // Skia uses this deprecated bzero function to fill zeros into a string.
163 #define bzero(str, len) memset(str, 0, len)
164
165 #elif defined(SK_BUILD_FOR_MAC)
166
167 #define SK_CPU_LENDIAN
168 #undef SK_CPU_BENDIAN
169 // we want (memory order) RGBA
170 #define SK_A32_SHIFT 24
171 #define SK_R32_SHIFT 0
172 #define SK_G32_SHIFT 8
173 #define SK_B32_SHIFT 16
174
175 #elif defined(SK_BUILD_FOR_UNIX)
176
177 #ifdef SK_CPU_BENDIAN
178 // Below we set the order for ARGB channels in registers. I suspect that, on
179 // big endian machines, you can keep this the same and everything will work.
180 // The in-memory order will be different, of course, but as long as everything
181 // is reading memory as words rather than bytes, it will all work. However, if
182 // you find that colours are messed up I thought that I would leave a helpful
183 // locator for you. Also see the comments in
184 // base/gfx/bitmap_platform_device_linux.h
185 #error Read the comment at this location
186 #endif
187
188 // For Linux we want to match the most common X visual, which is
189 // ARGB (in registers)
190 #define SK_A32_SHIFT 24
191 #define SK_R32_SHIFT 16
192 #define SK_G32_SHIFT 8
193 #define SK_B32_SHIFT 0
194
195 #endif
196
197 // The default crash macro writes to badbeef which can cause some strange
198 // problems. Instead, pipe this through to the logging function as a fatal
199 // assertion.
200 #define SK_CRASH() SkDebugf_FileLine(__FILE__, __LINE__, true, "SK_CRASH")
201
202 // TODO(brettw) bug 6373: Re-enable Skia assertions. This is blocked on fixing
203 // some of our transparency handling which generates purposely-invalid colors,
204 // in turn causing assertions.
205 //#ifndef NDEBUG
206 // #define SK_DEBUG
207 // #undef SK_RELEASE
208 #undef SK_SUPPORT_UNITTEST // This is only necessary in debug mode since
209 // we've disabled assertions. When we re-enable
210 // them, this line can be removed.
211 //#else
212 #define SK_RELEASE
213 #undef SK_DEBUG
214 //#endif
215
216 // For now (and to avoid rebaselining 1700+ tests), we'll use the old version
217 // of SkAlpha255To256.
218 #define SK_USE_OLD_255_TO_256
219
220 // ===== End Chrome-specific definitions =====
221
222 #endif
OLDNEW
« no previous file with comments | « chrome/renderer/render_widget.cc ('k') | skia/config/win/stdint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698