Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | /***************************************************************************/ | - |
43 | /* */ | - |
44 | /* qgrayraster.c, derived from ftgrays.c */ | - |
45 | /* */ | - |
46 | /* A new `perfect' anti-aliasing renderer (body). */ | - |
47 | /* */ | - |
48 | /* Copyright 2000-2001, 2002, 2003 by */ | - |
49 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | - |
50 | /* */ | - |
51 | /* This file is part of the FreeType project, and may only be used, */ | - |
52 | /* modified, and distributed under the terms of the FreeType project */ | - |
53 | /* license, ../../3rdparty/freetype/docs/FTL.TXT. By continuing to use, */ | - |
54 | /* modify, or distribute this file you indicate that you have read */ | - |
55 | /* the license and understand and accept it fully. */ | - |
56 | /* */ | - |
57 | /***************************************************************************/ | - |
58 | | - |
59 | /*************************************************************************/ | - |
60 | /* */ | - |
61 | /* This file can be compiled without the rest of the FreeType engine, by */ | - |
62 | /* defining the _STANDALONE_ macro when compiling it. You also need to */ | - |
63 | /* put the files `ftgrays.h' and `ftimage.h' into the current */ | - |
64 | /* compilation directory. Typically, you could do something like */ | - |
65 | /* */ | - |
66 | /* - copy `src/smooth/ftgrays.c' (this file) to your current directory */ | - |
67 | /* */ | - |
68 | /* - copy `include/freetype/ftimage.h' and `src/smooth/ftgrays.h' to the */ | - |
69 | /* same directory */ | - |
70 | /* */ | - |
71 | /* - compile `ftgrays' with the _STANDALONE_ macro defined, as in */ | - |
72 | /* */ | - |
73 | /* cc -c -D_STANDALONE_ ftgrays.c */ | - |
74 | /* */ | - |
75 | /* The renderer can be initialized with a call to */ | - |
76 | /* `qt_ft_gray_raster.raster_new'; an anti-aliased bitmap can be generated */ | - |
77 | /* with a call to `qt_ft_gray_raster.raster_render'. */ | - |
78 | /* */ | - |
79 | /* See the comments and documentation in the file `ftimage.h' for more */ | - |
80 | /* details on how the raster works. */ | - |
81 | /* */ | - |
82 | /*************************************************************************/ | - |
83 | | - |
84 | /*************************************************************************/ | - |
85 | /* */ | - |
86 | /* This is a new anti-aliasing scan-converter for FreeType 2. The */ | - |
87 | /* algorithm used here is _very_ different from the one in the standard */ | - |
88 | /* `ftraster' module. Actually, `ftgrays' computes the _exact_ */ | - |
89 | /* coverage of the outline on each pixel cell. */ | - |
90 | /* */ | - |
91 | /* It is based on ideas that I initially found in Raph Levien's */ | - |
92 | /* excellent LibArt graphics library (see http://www.levien.com/libart */ | - |
93 | /* for more information, though the web pages do not tell anything */ | - |
94 | /* about the renderer; you'll have to dive into the source code to */ | - |
95 | /* understand how it works). */ | - |
96 | /* */ | - |
97 | /* Note, however, that this is a _very_ different implementation */ | - |
98 | /* compared to Raph's. Coverage information is stored in a very */ | - |
99 | /* different way, and I don't use sorted vector paths. Also, it doesn't */ | - |
100 | /* use floating point values. */ | - |
101 | /* */ | - |
102 | /* This renderer has the following advantages: */ | - |
103 | /* */ | - |
104 | /* - It doesn't need an intermediate bitmap. Instead, one can supply a */ | - |
105 | /* callback function that will be called by the renderer to draw gray */ | - |
106 | /* spans on any target surface. You can thus do direct composition on */ | - |
107 | /* any kind of bitmap, provided that you give the renderer the right */ | - |
108 | /* callback. */ | - |
109 | /* */ | - |
110 | /* - A perfect anti-aliaser, i.e., it computes the _exact_ coverage on */ | - |
111 | /* each pixel cell. */ | - |
112 | /* */ | - |
113 | /* - It performs a single pass on the outline (the `standard' FT2 */ | - |
114 | /* renderer makes two passes). */ | - |
115 | /* */ | - |
116 | /* - It can easily be modified to render to _any_ number of gray levels */ | - |
117 | /* cheaply. */ | - |
118 | /* */ | - |
119 | /* - For small (< 20) pixel sizes, it is faster than the standard */ | - |
120 | /* renderer. */ | - |
121 | /* */ | - |
122 | /*************************************************************************/ | - |
123 | | - |
124 | /* experimental support for gamma correction within the rasterizer */ | - |
125 | #define xxxGRAYS_USE_GAMMA | - |
126 | | - |
127 | | - |
128 | /*************************************************************************/ | - |
129 | /* */ | - |
130 | /* The macro QT_FT_COMPONENT is used in trace mode. It is an implicit */ | - |
131 | /* parameter of the QT_FT_TRACE() and QT_FT_ERROR() macros, used to print/log */ | - |
132 | /* messages during execution. */ | - |
133 | /* */ | - |
134 | #undef QT_FT_COMPONENT | - |
135 | #define QT_FT_COMPONENT trace_smooth | - |
136 | | - |
137 | | - |
138 | #define ErrRaster_MemoryOverflow -4 | - |
139 | | - |
140 | #if defined(VXWORKS) | - |
141 | # include <vxWorksCommon.h> /* needed for setjmp.h */ | - |
142 | #endif | - |
143 | #include <string.h> /* for qt_ft_memcpy() */ | - |
144 | #include <setjmp.h> | - |
145 | #include <limits.h> | - |
146 | | - |
147 | #define QT_FT_UINT_MAX UINT_MAX | - |
148 | | - |
149 | #define qt_ft_memset memset | - |
150 | | - |
151 | #define qt_ft_setjmp setjmp | - |
152 | #define qt_ft_longjmp longjmp | - |
153 | #define qt_ft_jmp_buf jmp_buf | - |
154 | | - |
155 | #define ErrRaster_Invalid_Mode -2 | - |
156 | #define ErrRaster_Invalid_Outline -1 | - |
157 | #define ErrRaster_Invalid_Argument -3 | - |
158 | #define ErrRaster_Memory_Overflow -4 | - |
159 | #define ErrRaster_OutOfMemory -6 | - |
160 | | - |
161 | #define QT_FT_BEGIN_HEADER | - |
162 | #define QT_FT_END_HEADER | - |
163 | | - |
164 | #include <private/qrasterdefs_p.h> | - |
165 | #include <private/qgrayraster_p.h> | - |
166 | | - |
167 | #include <stdlib.h> | - |
168 | #include <stdio.h> | - |
169 | | - |
170 | /* This macro is used to indicate that a function parameter is unused. */ | - |
171 | /* Its purpose is simply to reduce compiler warnings. Note also that */ | - |
172 | /* simply defining it as `(void)x' doesn't avoid warnings with certain */ | - |
173 | /* ANSI compilers (e.g. LCC). */ | - |
174 | #define QT_FT_UNUSED( x ) (x) = (x) | - |
175 | | - |
176 | /* Disable the tracing mechanism for simplicity -- developers can */ | - |
177 | /* activate it easily by redefining these two macros. */ | - |
178 | #ifndef QT_FT_ERROR | - |
179 | #define QT_FT_ERROR( x ) do ; while ( 0 ) /* nothing */ | - |
180 | #endif | - |
181 | | - |
182 | #ifndef QT_FT_TRACE | - |
183 | #define QT_FT_TRACE( x ) do ; while ( 0 ) /* nothing */ | - |
184 | #endif | - |
185 | | - |
186 | #ifndef QT_FT_MEM_SET | - |
187 | #define QT_FT_MEM_SET( d, s, c ) qt_ft_memset( d, s, c ) | - |
188 | #endif | - |
189 | | - |
190 | #ifndef QT_FT_MEM_ZERO | - |
191 | #define QT_FT_MEM_ZERO( dest, count ) QT_FT_MEM_SET( dest, 0, count ) | - |
192 | #endif | - |
193 | | - |
194 | /* define this to dump debugging information */ | - |
195 | #define xxxDEBUG_GRAYS | - |
196 | | - |
197 | | - |
198 | #define RAS_ARG PWorker worker | - |
199 | #define RAS_ARG_ PWorker worker, | - |
200 | | - |
201 | #define RAS_VAR worker | - |
202 | #define RAS_VAR_ worker, | - |
203 | | - |
204 | #define ras (*worker) | - |
205 | | - |
206 | | - |
207 | /* must be at least 6 bits! */ | - |
208 | #define PIXEL_BITS 8 | - |
209 | | - |
210 | #define ONE_PIXEL ( 1L << PIXEL_BITS ) | - |
211 | #define PIXEL_MASK ( -1L << PIXEL_BITS ) | - |
212 | #define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) ) | - |
213 | #define SUBPIXELS( x ) ( (TPos)(x) << PIXEL_BITS ) | - |
214 | #define FLOOR( x ) ( (x) & -ONE_PIXEL ) | - |
215 | #define CEILING( x ) ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL ) | - |
216 | #define ROUND( x ) ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL ) | - |
217 | | - |
218 | #if PIXEL_BITS >= 6 | - |
219 | #define UPSCALE( x ) ( (x) << ( PIXEL_BITS - 6 ) ) | - |
220 | #define DOWNSCALE( x ) ( (x) >> ( PIXEL_BITS - 6 ) ) | - |
221 | #else | - |
222 | #define UPSCALE( x ) ( (x) >> ( 6 - PIXEL_BITS ) ) | - |
223 | #define DOWNSCALE( x ) ( (x) << ( 6 - PIXEL_BITS ) ) | - |
224 | #endif | - |
225 | | - |
226 | /*************************************************************************/ | - |
227 | /* */ | - |
228 | /* TYPE DEFINITIONS */ | - |
229 | /* */ | - |
230 | | - |
231 | /* don't change the following types to QT_FT_Int or QT_FT_Pos, since we might */ | - |
232 | /* need to define them to "float" or "double" when experimenting with */ | - |
233 | /* new algorithms */ | - |
234 | | - |
235 | typedef int TCoord; /* integer scanline/pixel coordinate */ | - |
236 | typedef int TPos; /* sub-pixel coordinate */ | - |
237 | | - |
238 | /* determine the type used to store cell areas. This normally takes at */ | - |
239 | /* least PIXEL_BITS*2 + 1 bits. On 16-bit systems, we need to use */ | - |
240 | /* `long' instead of `int', otherwise bad things happen */ | - |
241 | | - |
242 | #if PIXEL_BITS <= 7 | - |
243 | | - |
244 | typedef int TArea; | - |
245 | | - |
246 | #else /* PIXEL_BITS >= 8 */ | - |
247 | | - |
248 | /* approximately determine the size of integers using an ANSI-C header */ | - |
249 | #if QT_FT_UINT_MAX == 0xFFFFU | - |
250 | typedef long TArea; | - |
251 | #else | - |
252 | typedef int TArea; | - |
253 | #endif | - |
254 | | - |
255 | #endif /* PIXEL_BITS >= 8 */ | - |
256 | | - |
257 | | - |
258 | /* maximal number of gray spans in a call to the span callback */ | - |
259 | #define QT_FT_MAX_GRAY_SPANS 256 | - |
260 | | - |
261 | | - |
262 | typedef struct TCell_* PCell; | - |
263 | | - |
264 | typedef struct TCell_ | - |
265 | { | - |
266 | int x; | - |
267 | int cover; | - |
268 | TArea area; | - |
269 | PCell next; | - |
270 | | - |
271 | } TCell; | - |
272 | | - |
273 | | - |
274 | typedef struct TWorker_ | - |
275 | { | - |
276 | TCoord ex, ey; | - |
277 | TPos min_ex, max_ex; | - |
278 | TPos min_ey, max_ey; | - |
279 | TPos count_ex, count_ey; | - |
280 | | - |
281 | TArea area; | - |
282 | int cover; | - |
283 | int invalid; | - |
284 | | - |
285 | PCell cells; | - |
286 | int max_cells; | - |
287 | int num_cells; | - |
288 | | - |
289 | TCoord cx, cy; | - |
290 | TPos x, y; | - |
291 | | - |
292 | TPos last_ey; | - |
293 | | - |
294 | QT_FT_Vector bez_stack[32 * 3 + 1]; | - |
295 | int lev_stack[32]; | - |
296 | | - |
297 | QT_FT_Outline outline; | - |
298 | QT_FT_Bitmap target; | - |
299 | QT_FT_BBox clip_box; | - |
300 | | - |
301 | QT_FT_Span gray_spans[QT_FT_MAX_GRAY_SPANS]; | - |
302 | int num_gray_spans; | - |
303 | | - |
304 | QT_FT_Raster_Span_Func render_span; | - |
305 | void* render_span_data; | - |
306 | | - |
307 | int band_size; | - |
308 | int band_shoot; | - |
309 | int conic_level; | - |
310 | int cubic_level; | - |
311 | | - |
312 | qt_ft_jmp_buf jump_buffer; | - |
313 | | - |
314 | void* buffer; | - |
315 | long buffer_size; | - |
316 | | - |
317 | PCell* ycells; | - |
318 | int ycount; | - |
319 | | - |
320 | int skip_spans; | - |
321 | } TWorker, *PWorker; | - |
322 | | - |
323 | | - |
324 | typedef struct TRaster_ | - |
325 | { | - |
326 | void* buffer; | - |
327 | long buffer_size; | - |
328 | long buffer_allocated_size; | - |
329 | int band_size; | - |
330 | void* memory; | - |
331 | PWorker worker; | - |
332 | | - |
333 | } TRaster, *PRaster; | - |
334 | | - |
335 | int q_gray_rendered_spans(TRaster *raster) | - |
336 | { | - |
337 | if ( raster && raster->worker ) never evaluated: raster never evaluated: raster->worker | 0 |
338 | return raster->worker->skip_spans > 0 ? 0 : -raster->worker->skip_spans; never executed: return raster->worker->skip_spans > 0 ? 0 : -raster->worker->skip_spans; | 0 |
339 | return 0; never executed: return 0; | 0 |
340 | } | - |
341 | | - |
342 | /*************************************************************************/ | - |
343 | /* */ | - |
344 | /* Initialize the cells table. */ | - |
345 | /* */ | - |
346 | static void | - |
347 | gray_init_cells( RAS_ARG_ void* buffer, | - |
348 | long byte_size ) | - |
349 | { | - |
350 | ras.buffer = buffer; executed (the execution status of this line is deduced): (*worker).buffer = buffer; | - |
351 | ras.buffer_size = byte_size; executed (the execution status of this line is deduced): (*worker).buffer_size = byte_size; | - |
352 | | - |
353 | ras.ycells = (PCell*) buffer; executed (the execution status of this line is deduced): (*worker).ycells = (PCell*) buffer; | - |
354 | ras.cells = NULL; executed (the execution status of this line is deduced): (*worker).cells = ((void *)0); | - |
355 | ras.max_cells = 0; executed (the execution status of this line is deduced): (*worker).max_cells = 0; | - |
356 | ras.num_cells = 0; executed (the execution status of this line is deduced): (*worker).num_cells = 0; | - |
357 | ras.area = 0; executed (the execution status of this line is deduced): (*worker).area = 0; | - |
358 | ras.cover = 0; executed (the execution status of this line is deduced): (*worker).cover = 0; | - |
359 | ras.invalid = 1; executed (the execution status of this line is deduced): (*worker).invalid = 1; | - |
360 | } executed: } Execution Count:16545 | 16545 |
361 | | - |
362 | | - |
363 | /*************************************************************************/ | - |
364 | /* */ | - |
365 | /* Compute the outline bounding box. */ | - |
366 | /* */ | - |
367 | static void | - |
368 | gray_compute_cbox( RAS_ARG ) | - |
369 | { | - |
370 | QT_FT_Outline* outline = &ras.outline; executed (the execution status of this line is deduced): QT_FT_Outline* outline = &(*worker).outline; | - |
371 | QT_FT_Vector* vec = outline->points; executed (the execution status of this line is deduced): QT_FT_Vector* vec = outline->points; | - |
372 | QT_FT_Vector* limit = vec + outline->n_points; executed (the execution status of this line is deduced): QT_FT_Vector* limit = vec + outline->n_points; | - |
373 | | - |
374 | | - |
375 | if ( outline->n_points <= 0 ) partially evaluated: outline->n_points <= 0 no Evaluation Count:0 | yes Evaluation Count:16545 |
| 0-16545 |
376 | { | - |
377 | ras.min_ex = ras.max_ex = 0; never executed (the execution status of this line is deduced): (*worker).min_ex = (*worker).max_ex = 0; | - |
378 | ras.min_ey = ras.max_ey = 0; never executed (the execution status of this line is deduced): (*worker).min_ey = (*worker).max_ey = 0; | - |
379 | return; | 0 |
380 | } | - |
381 | | - |
382 | ras.min_ex = ras.max_ex = vec->x; executed (the execution status of this line is deduced): (*worker).min_ex = (*worker).max_ex = vec->x; | - |
383 | ras.min_ey = ras.max_ey = vec->y; executed (the execution status of this line is deduced): (*worker).min_ey = (*worker).max_ey = vec->y; | - |
384 | | - |
385 | vec++; executed (the execution status of this line is deduced): vec++; | - |
386 | | - |
387 | for ( ; vec < limit; vec++ ) evaluated: vec < limit yes Evaluation Count:323169 | yes Evaluation Count:16545 |
| 16545-323169 |
388 | { | - |
389 | TPos x = vec->x; executed (the execution status of this line is deduced): TPos x = vec->x; | - |
390 | TPos y = vec->y; executed (the execution status of this line is deduced): TPos y = vec->y; | - |
391 | | - |
392 | | - |
393 | if ( x < ras.min_ex ) ras.min_ex = x; executed: (*worker).min_ex = x; Execution Count:7833 evaluated: x < (*worker).min_ex yes Evaluation Count:7833 | yes Evaluation Count:315336 |
| 7833-315336 |
394 | if ( x > ras.max_ex ) ras.max_ex = x; executed: (*worker).max_ex = x; Execution Count:62259 evaluated: x > (*worker).max_ex yes Evaluation Count:62259 | yes Evaluation Count:260910 |
| 62259-260910 |
395 | if ( y < ras.min_ey ) ras.min_ey = y; executed: (*worker).min_ey = y; Execution Count:3372 evaluated: y < (*worker).min_ey yes Evaluation Count:3372 | yes Evaluation Count:319797 |
| 3372-319797 |
396 | if ( y > ras.max_ey ) ras.max_ey = y; executed: (*worker).max_ey = y; Execution Count:56267 evaluated: y > (*worker).max_ey yes Evaluation Count:56267 | yes Evaluation Count:266902 |
| 56267-266902 |
397 | } executed: } Execution Count:323169 | 323169 |
398 | | - |
399 | /* truncate the bounding box to integer pixels */ | - |
400 | ras.min_ex = ras.min_ex >> 6; executed (the execution status of this line is deduced): (*worker).min_ex = (*worker).min_ex >> 6; | - |
401 | ras.min_ey = ras.min_ey >> 6; executed (the execution status of this line is deduced): (*worker).min_ey = (*worker).min_ey >> 6; | - |
402 | ras.max_ex = ( ras.max_ex + 63 ) >> 6; executed (the execution status of this line is deduced): (*worker).max_ex = ( (*worker).max_ex + 63 ) >> 6; | - |
403 | ras.max_ey = ( ras.max_ey + 63 ) >> 6; executed (the execution status of this line is deduced): (*worker).max_ey = ( (*worker).max_ey + 63 ) >> 6; | - |
404 | } executed: } Execution Count:16545 | 16545 |
405 | | - |
406 | | - |
407 | /*************************************************************************/ | - |
408 | /* */ | - |
409 | /* Record the current cell in the table. */ | - |
410 | /* */ | - |
411 | static void | - |
412 | gray_record_cell( RAS_ARG ) | - |
413 | { | - |
414 | PCell *pcell, cell; executed (the execution status of this line is deduced): PCell *pcell, cell; | - |
415 | int x = ras.ex; executed (the execution status of this line is deduced): int x = (*worker).ex; | - |
416 | | - |
417 | if ( ras.invalid || !( ras.area | ras.cover ) ) evaluated: (*worker).invalid yes Evaluation Count:34045 | yes Evaluation Count:135192 |
evaluated: !( (*worker).area | (*worker).cover ) yes Evaluation Count:41983 | yes Evaluation Count:93209 |
| 34045-135192 |
418 | return; executed: return; Execution Count:76028 | 76028 |
419 | | - |
420 | if ( x > ras.max_ex ) partially evaluated: x > (*worker).max_ex no Evaluation Count:0 | yes Evaluation Count:93209 |
| 0-93209 |
421 | x = ras.max_ex; never executed: x = (*worker).max_ex; | 0 |
422 | | - |
423 | pcell = &ras.ycells[ras.ey]; executed (the execution status of this line is deduced): pcell = &(*worker).ycells[(*worker).ey]; | - |
424 | | - |
425 | for (;;) executed (the execution status of this line is deduced): for (;;) | - |
426 | { | - |
427 | cell = *pcell; executed (the execution status of this line is deduced): cell = *pcell; | - |
428 | if ( cell == NULL || cell->x > x ) evaluated: cell == ((void *)0) yes Evaluation Count:59901 | yes Evaluation Count:199887 |
evaluated: cell->x > x yes Evaluation Count:29904 | yes Evaluation Count:169983 |
| 29904-199887 |
429 | break; executed: break; Execution Count:89805 | 89805 |
430 | | - |
431 | if ( cell->x == x ) { evaluated: cell->x == x yes Evaluation Count:3404 | yes Evaluation Count:166579 |
| 3404-166579 |
432 | cell->area += ras.area; executed (the execution status of this line is deduced): cell->area += (*worker).area; | - |
433 | cell->cover += ras.cover; executed (the execution status of this line is deduced): cell->cover += (*worker).cover; | - |
434 | return; executed: return; Execution Count:3404 | 3404 |
435 | } | - |
436 | | - |
437 | pcell = &cell->next; executed (the execution status of this line is deduced): pcell = &cell->next; | - |
438 | } executed: } Execution Count:166579 | 166579 |
439 | | - |
440 | if ( ras.num_cells >= ras.max_cells ) evaluated: (*worker).num_cells >= (*worker).max_cells yes Evaluation Count:66 | yes Evaluation Count:89739 |
| 66-89739 |
441 | qt_ft_longjmp( ras.jump_buffer, 1 ); executed: longjmp( (*worker).jump_buffer, 1 ); Execution Count:66 | 66 |
442 | | - |
443 | cell = ras.cells + ras.num_cells++; executed (the execution status of this line is deduced): cell = (*worker).cells + (*worker).num_cells++; | - |
444 | cell->x = x; executed (the execution status of this line is deduced): cell->x = x; | - |
445 | cell->area = ras.area; executed (the execution status of this line is deduced): cell->area = (*worker).area; | - |
446 | cell->cover = ras.cover; executed (the execution status of this line is deduced): cell->cover = (*worker).cover; | - |
447 | | - |
448 | cell->next = *pcell; executed (the execution status of this line is deduced): cell->next = *pcell; | - |
449 | *pcell = cell; executed (the execution status of this line is deduced): *pcell = cell; | - |
450 | } executed: } Execution Count:89739 | 89739 |
451 | | - |
452 | | - |
453 | /*************************************************************************/ | - |
454 | /* */ | - |
455 | /* Set the current cell to a new position. */ | - |
456 | /* */ | - |
457 | static void | - |
458 | gray_set_cell( RAS_ARG_ TCoord ex, | - |
459 | TCoord ey ) | - |
460 | { | - |
461 | /* Move the cell pointer to a new position. We set the `invalid' */ | - |
462 | /* flag to indicate that the cell isn't part of those we're interested */ | - |
463 | /* in during the render phase. This means that: */ | - |
464 | /* */ | - |
465 | /* . the new vertical position must be within min_ey..max_ey-1. */ | - |
466 | /* . the new horizontal position must be strictly less than max_ex */ | - |
467 | /* */ | - |
468 | /* Note that if a cell is to the left of the clipping region, it is */ | - |
469 | /* actually set to the (min_ex-1) horizontal position. */ | - |
470 | | - |
471 | /* All cells that are on the left of the clipping region go to the */ | - |
472 | /* min_ex - 1 horizontal position. */ | - |
473 | ey -= ras.min_ey; executed (the execution status of this line is deduced): ey -= (*worker).min_ey; | - |
474 | | - |
475 | if ( ex > ras.max_ex ) evaluated: ex > (*worker).max_ex yes Evaluation Count:49711 | yes Evaluation Count:327303 |
| 49711-327303 |
476 | ex = ras.max_ex; executed: ex = (*worker).max_ex; Execution Count:49711 | 49711 |
477 | | - |
478 | ex -= ras.min_ex; executed (the execution status of this line is deduced): ex -= (*worker).min_ex; | - |
479 | if ( ex < 0 ) evaluated: ex < 0 yes Evaluation Count:19528 | yes Evaluation Count:357486 |
| 19528-357486 |
480 | ex = -1; executed: ex = -1; Execution Count:19528 | 19528 |
481 | | - |
482 | /* are we moving to a different cell ? */ | - |
483 | if ( ex != ras.ex || ey != ras.ey ) evaluated: ex != (*worker).ex yes Evaluation Count:85653 | yes Evaluation Count:291361 |
evaluated: ey != (*worker).ey yes Evaluation Count:174984 | yes Evaluation Count:116377 |
| 85653-291361 |
484 | { | - |
485 | /* record the current one if it is valid */ | - |
486 | if ( !ras.invalid ) evaluated: !(*worker).invalid yes Evaluation Count:102159 | yes Evaluation Count:158478 |
| 102159-158478 |
487 | gray_record_cell( RAS_VAR ); executed: gray_record_cell( worker ); Execution Count:102159 | 102159 |
488 | | - |
489 | ras.area = 0; executed (the execution status of this line is deduced): (*worker).area = 0; | - |
490 | ras.cover = 0; executed (the execution status of this line is deduced): (*worker).cover = 0; | - |
491 | } executed: } Execution Count:260571 | 260571 |
492 | | - |
493 | ras.ex = ex; executed (the execution status of this line is deduced): (*worker).ex = ex; | - |
494 | ras.ey = ey; executed (the execution status of this line is deduced): (*worker).ey = ey; | - |
495 | ras.invalid = ( (unsigned)ey >= (unsigned)ras.count_ey || executed (the execution status of this line is deduced): (*worker).invalid = ( (unsigned)ey >= (unsigned)(*worker).count_ey || | - |
496 | ex >= ras.count_ex ); executed (the execution status of this line is deduced): ex >= (*worker).count_ex ); | - |
497 | } executed: } Execution Count:376948 | 376948 |
498 | | - |
499 | | - |
500 | /*************************************************************************/ | - |
501 | /* */ | - |
502 | /* Start a new contour at a given cell. */ | - |
503 | /* */ | - |
504 | static void | - |
505 | gray_start_cell( RAS_ARG_ TCoord ex, | - |
506 | TCoord ey ) | - |
507 | { | - |
508 | if ( ex > ras.max_ex ) evaluated: ex > (*worker).max_ex yes Evaluation Count:8255 | yes Evaluation Count:42020 |
| 8255-42020 |
509 | ex = (TCoord)( ras.max_ex ); executed: ex = (TCoord)( (*worker).max_ex ); Execution Count:8255 | 8255 |
510 | | - |
511 | if ( ex < ras.min_ex ) evaluated: ex < (*worker).min_ex yes Evaluation Count:57 | yes Evaluation Count:50218 |
| 57-50218 |
512 | ex = (TCoord)( ras.min_ex - 1 ); executed: ex = (TCoord)( (*worker).min_ex - 1 ); Execution Count:57 | 57 |
513 | | - |
514 | ras.area = 0; executed (the execution status of this line is deduced): (*worker).area = 0; | - |
515 | ras.cover = 0; executed (the execution status of this line is deduced): (*worker).cover = 0; | - |
516 | ras.ex = ex - ras.min_ex; executed (the execution status of this line is deduced): (*worker).ex = ex - (*worker).min_ex; | - |
517 | ras.ey = ey - ras.min_ey; executed (the execution status of this line is deduced): (*worker).ey = ey - (*worker).min_ey; | - |
518 | ras.last_ey = SUBPIXELS( ey ); executed (the execution status of this line is deduced): (*worker).last_ey = ( (TPos)(ey) << 8 ); | - |
519 | ras.invalid = 0; executed (the execution status of this line is deduced): (*worker).invalid = 0; | - |
520 | | - |
521 | gray_set_cell( RAS_VAR_ ex, ey ); executed (the execution status of this line is deduced): gray_set_cell( worker, ex, ey ); | - |
522 | } executed: } Execution Count:50275 | 50275 |
523 | | - |
524 | | - |
525 | /*************************************************************************/ | - |
526 | /* */ | - |
527 | /* Render a scanline as one or more cells. */ | - |
528 | /* */ | - |
529 | static void | - |
530 | gray_render_scanline( RAS_ARG_ TCoord ey, | - |
531 | TPos x1, | - |
532 | TCoord y1, | - |
533 | TPos x2, | - |
534 | TCoord y2 ) | - |
535 | { | - |
536 | TCoord ex1, ex2, fx1, fx2, delta; executed (the execution status of this line is deduced): TCoord ex1, ex2, fx1, fx2, delta; | - |
537 | int p, first, dx; executed (the execution status of this line is deduced): int p, first, dx; | - |
538 | int incr, lift, mod, rem; executed (the execution status of this line is deduced): int incr, lift, mod, rem; | - |
539 | | - |
540 | | - |
541 | dx = x2 - x1; executed (the execution status of this line is deduced): dx = x2 - x1; | - |
542 | | - |
543 | ex1 = TRUNC( x1 ); executed (the execution status of this line is deduced): ex1 = ( (TCoord)( (x1) >> 8 ) ); | - |
544 | ex2 = TRUNC( x2 ); executed (the execution status of this line is deduced): ex2 = ( (TCoord)( (x2) >> 8 ) ); | - |
545 | fx1 = (TCoord)( x1 - SUBPIXELS( ex1 ) ); executed (the execution status of this line is deduced): fx1 = (TCoord)( x1 - ( (TPos)(ex1) << 8 ) ); | - |
546 | fx2 = (TCoord)( x2 - SUBPIXELS( ex2 ) ); executed (the execution status of this line is deduced): fx2 = (TCoord)( x2 - ( (TPos)(ex2) << 8 ) ); | - |
547 | | - |
548 | /* trivial case. Happens often */ | - |
549 | if ( y1 == y2 ) evaluated: y1 == y2 yes Evaluation Count:103921 | yes Evaluation Count:120980 |
| 103921-120980 |
550 | { | - |
551 | gray_set_cell( RAS_VAR_ ex2, ey ); executed (the execution status of this line is deduced): gray_set_cell( worker, ex2, ey ); | - |
552 | return; executed: return; Execution Count:103921 | 103921 |
553 | } | - |
554 | | - |
555 | /* everything is located in a single cell. That is easy! */ | - |
556 | /* */ | - |
557 | if ( ex1 == ex2 ) evaluated: ex1 == ex2 yes Evaluation Count:102839 | yes Evaluation Count:18141 |
| 18141-102839 |
558 | { | - |
559 | delta = y2 - y1; executed (the execution status of this line is deduced): delta = y2 - y1; | - |
560 | ras.area += (TArea)( fx1 + fx2 ) * delta; executed (the execution status of this line is deduced): (*worker).area += (TArea)( fx1 + fx2 ) * delta; | - |
561 | ras.cover += delta; executed (the execution status of this line is deduced): (*worker).cover += delta; | - |
562 | return; executed: return; Execution Count:102839 | 102839 |
563 | } | - |
564 | | - |
565 | /* ok, we'll have to render a run of adjacent cells on the same */ | - |
566 | /* scanline... */ | - |
567 | /* */ | - |
568 | p = ( ONE_PIXEL - fx1 ) * ( y2 - y1 ); executed (the execution status of this line is deduced): p = ( ( 1L << 8 ) - fx1 ) * ( y2 - y1 ); | - |
569 | first = ONE_PIXEL; executed (the execution status of this line is deduced): first = ( 1L << 8 ); | - |
570 | incr = 1; executed (the execution status of this line is deduced): incr = 1; | - |
571 | | - |
572 | if ( dx < 0 ) evaluated: dx < 0 yes Evaluation Count:8667 | yes Evaluation Count:9474 |
| 8667-9474 |
573 | { | - |
574 | p = fx1 * ( y2 - y1 ); executed (the execution status of this line is deduced): p = fx1 * ( y2 - y1 ); | - |
575 | first = 0; executed (the execution status of this line is deduced): first = 0; | - |
576 | incr = -1; executed (the execution status of this line is deduced): incr = -1; | - |
577 | dx = -dx; executed (the execution status of this line is deduced): dx = -dx; | - |
578 | } executed: } Execution Count:8667 | 8667 |
579 | | - |
580 | delta = (TCoord)( p / dx ); executed (the execution status of this line is deduced): delta = (TCoord)( p / dx ); | - |
581 | mod = (TCoord)( p % dx ); executed (the execution status of this line is deduced): mod = (TCoord)( p % dx ); | - |
582 | if ( mod < 0 ) evaluated: mod < 0 yes Evaluation Count:6807 | yes Evaluation Count:11334 |
| 6807-11334 |
583 | { | - |
584 | delta--; executed (the execution status of this line is deduced): delta--; | - |
585 | mod += (TCoord)dx; executed (the execution status of this line is deduced): mod += (TCoord)dx; | - |
586 | } executed: } Execution Count:6807 | 6807 |
587 | | - |
588 | ras.area += (TArea)( fx1 + first ) * delta; executed (the execution status of this line is deduced): (*worker).area += (TArea)( fx1 + first ) * delta; | - |
589 | ras.cover += delta; executed (the execution status of this line is deduced): (*worker).cover += delta; | - |
590 | | - |
591 | ex1 += incr; executed (the execution status of this line is deduced): ex1 += incr; | - |
592 | gray_set_cell( RAS_VAR_ ex1, ey ); executed (the execution status of this line is deduced): gray_set_cell( worker, ex1, ey ); | - |
593 | y1 += delta; executed (the execution status of this line is deduced): y1 += delta; | - |
594 | | - |
595 | if ( ex1 != ex2 ) evaluated: ex1 != ex2 yes Evaluation Count:2098 | yes Evaluation Count:16021 |
| 2098-16021 |
596 | { | - |
597 | p = ONE_PIXEL * ( y2 - y1 + delta ); executed (the execution status of this line is deduced): p = ( 1L << 8 ) * ( y2 - y1 + delta ); | - |
598 | lift = (TCoord)( p / dx ); executed (the execution status of this line is deduced): lift = (TCoord)( p / dx ); | - |
599 | rem = (TCoord)( p % dx ); executed (the execution status of this line is deduced): rem = (TCoord)( p % dx ); | - |
600 | if ( rem < 0 ) evaluated: rem < 0 yes Evaluation Count:987 | yes Evaluation Count:1111 |
| 987-1111 |
601 | { | - |
602 | lift--; executed (the execution status of this line is deduced): lift--; | - |
603 | rem += (TCoord)dx; executed (the execution status of this line is deduced): rem += (TCoord)dx; | - |
604 | } executed: } Execution Count:987 | 987 |
605 | | - |
606 | mod -= (int)dx; executed (the execution status of this line is deduced): mod -= (int)dx; | - |
607 | | - |
608 | while ( ex1 != ex2 ) evaluated: ex1 != ex2 yes Evaluation Count:3784 | yes Evaluation Count:2098 |
| 2098-3784 |
609 | { | - |
610 | delta = lift; executed (the execution status of this line is deduced): delta = lift; | - |
611 | mod += rem; executed (the execution status of this line is deduced): mod += rem; | - |
612 | if ( mod >= 0 ) evaluated: mod >= 0 yes Evaluation Count:1839 | yes Evaluation Count:1945 |
| 1839-1945 |
613 | { | - |
614 | mod -= (TCoord)dx; executed (the execution status of this line is deduced): mod -= (TCoord)dx; | - |
615 | delta++; executed (the execution status of this line is deduced): delta++; | - |
616 | } executed: } Execution Count:1839 | 1839 |
617 | | - |
618 | ras.area += (TArea)ONE_PIXEL * delta; executed (the execution status of this line is deduced): (*worker).area += (TArea)( 1L << 8 ) * delta; | - |
619 | ras.cover += delta; executed (the execution status of this line is deduced): (*worker).cover += delta; | - |
620 | y1 += delta; executed (the execution status of this line is deduced): y1 += delta; | - |
621 | ex1 += incr; executed (the execution status of this line is deduced): ex1 += incr; | - |
622 | gray_set_cell( RAS_VAR_ ex1, ey ); executed (the execution status of this line is deduced): gray_set_cell( worker, ex1, ey ); | - |
623 | } executed: } Execution Count:3784 | 3784 |
624 | } executed: } Execution Count:2098 | 2098 |
625 | | - |
626 | delta = y2 - y1; executed (the execution status of this line is deduced): delta = y2 - y1; | - |
627 | ras.area += (TArea)( fx2 + ONE_PIXEL - first ) * delta; executed (the execution status of this line is deduced): (*worker).area += (TArea)( fx2 + ( 1L << 8 ) - first ) * delta; | - |
628 | ras.cover += delta; executed (the execution status of this line is deduced): (*worker).cover += delta; | - |
629 | } executed: } Execution Count:18119 | 18119 |
630 | | - |
631 | | - |
632 | /*************************************************************************/ | - |
633 | /* */ | - |
634 | /* Render a given line as a series of scanlines. */ | - |
635 | /* */ | - |
636 | static void | - |
637 | gray_render_line( RAS_ARG_ TPos to_x, | - |
638 | TPos to_y ) | - |
639 | { | - |
640 | TCoord ey1, ey2, fy1, fy2; executed (the execution status of this line is deduced): TCoord ey1, ey2, fy1, fy2; | - |
641 | TPos dx, dy, x, x2; executed (the execution status of this line is deduced): TPos dx, dy, x, x2; | - |
642 | int p, first; executed (the execution status of this line is deduced): int p, first; | - |
643 | int delta, rem, mod, lift, incr; executed (the execution status of this line is deduced): int delta, rem, mod, lift, incr; | - |
644 | | - |
645 | | - |
646 | ey1 = TRUNC( ras.last_ey ); executed (the execution status of this line is deduced): ey1 = ( (TCoord)( ((*worker).last_ey) >> 8 ) ); | - |
647 | ey2 = TRUNC( to_y ); /* if (ey2 >= ras.max_ey) ey2 = ras.max_ey-1; */ executed (the execution status of this line is deduced): ey2 = ( (TCoord)( (to_y) >> 8 ) ); | - |
648 | fy1 = (TCoord)( ras.y - ras.last_ey ); executed (the execution status of this line is deduced): fy1 = (TCoord)( (*worker).y - (*worker).last_ey ); | - |
649 | fy2 = (TCoord)( to_y - SUBPIXELS( ey2 ) ); executed (the execution status of this line is deduced): fy2 = (TCoord)( to_y - ( (TPos)(ey2) << 8 ) ); | - |
650 | | - |
651 | dx = to_x - ras.x; executed (the execution status of this line is deduced): dx = to_x - (*worker).x; | - |
652 | dy = to_y - ras.y; executed (the execution status of this line is deduced): dy = to_y - (*worker).y; | - |
653 | | - |
654 | /* XXX: we should do something about the trivial case where dx == 0, */ | - |
655 | /* as it happens very often! */ | - |
656 | | - |
657 | /* perform vertical clipping */ | - |
658 | { | - |
659 | TCoord min, max; executed (the execution status of this line is deduced): TCoord min, max; | - |
660 | | - |
661 | | - |
662 | min = ey1; executed (the execution status of this line is deduced): min = ey1; | - |
663 | max = ey2; executed (the execution status of this line is deduced): max = ey2; | - |
664 | if ( ey1 > ey2 ) evaluated: ey1 > ey2 yes Evaluation Count:82399 | yes Evaluation Count:725033 |
| 82399-725033 |
665 | { | - |
666 | min = ey2; executed (the execution status of this line is deduced): min = ey2; | - |
667 | max = ey1; executed (the execution status of this line is deduced): max = ey1; | - |
668 | } executed: } Execution Count:82399 | 82399 |
669 | if ( min >= ras.max_ey || max < ras.min_ey ) evaluated: min >= (*worker).max_ey yes Evaluation Count:396244 | yes Evaluation Count:411188 |
evaluated: max < (*worker).min_ey yes Evaluation Count:139954 | yes Evaluation Count:271234 |
| 139954-411188 |
670 | goto End; executed: goto End; Execution Count:536198 | 536198 |
671 | } | - |
672 | | - |
673 | /* everything is on a single scanline */ | - |
674 | if ( ey1 == ey2 ) evaluated: ey1 == ey2 yes Evaluation Count:175792 | yes Evaluation Count:95442 |
| 95442-175792 |
675 | { | - |
676 | gray_render_scanline( RAS_VAR_ ey1, ras.x, fy1, to_x, fy2 ); executed (the execution status of this line is deduced): gray_render_scanline( worker, ey1, (*worker).x, fy1, to_x, fy2 ); | - |
677 | goto End; executed: goto End; Execution Count:175776 | 175776 |
678 | } | - |
679 | | - |
680 | /* vertical line - avoid calling gray_render_scanline */ | - |
681 | incr = 1; executed (the execution status of this line is deduced): incr = 1; | - |
682 | | - |
683 | if ( dx == 0 ) evaluated: dx == 0 yes Evaluation Count:83924 | yes Evaluation Count:11518 |
| 11518-83924 |
684 | { | - |
685 | TCoord ex = TRUNC( ras.x ); executed (the execution status of this line is deduced): TCoord ex = ( (TCoord)( ((*worker).x) >> 8 ) ); | - |
686 | TCoord two_fx = (TCoord)( ( ras.x - SUBPIXELS( ex ) ) << 1 ); executed (the execution status of this line is deduced): TCoord two_fx = (TCoord)( ( (*worker).x - ( (TPos)(ex) << 8 ) ) << 1 ); | - |
687 | TPos area; executed (the execution status of this line is deduced): TPos area; | - |
688 | | - |
689 | | - |
690 | first = ONE_PIXEL; executed (the execution status of this line is deduced): first = ( 1L << 8 ); | - |
691 | if ( dy < 0 ) evaluated: dy < 0 yes Evaluation Count:41881 | yes Evaluation Count:42043 |
| 41881-42043 |
692 | { | - |
693 | first = 0; executed (the execution status of this line is deduced): first = 0; | - |
694 | incr = -1; executed (the execution status of this line is deduced): incr = -1; | - |
695 | } executed: } Execution Count:41881 | 41881 |
696 | | - |
697 | delta = (int)( first - fy1 ); executed (the execution status of this line is deduced): delta = (int)( first - fy1 ); | - |
698 | ras.area += (TArea)two_fx * delta; executed (the execution status of this line is deduced): (*worker).area += (TArea)two_fx * delta; | - |
699 | ras.cover += delta; executed (the execution status of this line is deduced): (*worker).cover += delta; | - |
700 | ey1 += incr; executed (the execution status of this line is deduced): ey1 += incr; | - |
701 | | - |
702 | gray_set_cell( &ras, ex, ey1 ); executed (the execution status of this line is deduced): gray_set_cell( &(*worker), ex, ey1 ); | - |
703 | | - |
704 | delta = (int)( first + first - ONE_PIXEL ); executed (the execution status of this line is deduced): delta = (int)( first + first - ( 1L << 8 ) ); | - |
705 | area = (TArea)two_fx * delta; executed (the execution status of this line is deduced): area = (TArea)two_fx * delta; | - |
706 | while ( ey1 != ey2 ) evaluated: ey1 != ey2 yes Evaluation Count:79350 | yes Evaluation Count:83908 |
| 79350-83908 |
707 | { | - |
708 | ras.area += area; executed (the execution status of this line is deduced): (*worker).area += area; | - |
709 | ras.cover += delta; executed (the execution status of this line is deduced): (*worker).cover += delta; | - |
710 | ey1 += incr; executed (the execution status of this line is deduced): ey1 += incr; | - |
711 | | - |
712 | gray_set_cell( &ras, ex, ey1 ); executed (the execution status of this line is deduced): gray_set_cell( &(*worker), ex, ey1 ); | - |
713 | } executed: } Execution Count:79336 | 79336 |
714 | | - |
715 | delta = (int)( fy2 - ONE_PIXEL + first ); executed (the execution status of this line is deduced): delta = (int)( fy2 - ( 1L << 8 ) + first ); | - |
716 | ras.area += (TArea)two_fx * delta; executed (the execution status of this line is deduced): (*worker).area += (TArea)two_fx * delta; | - |
717 | ras.cover += delta; executed (the execution status of this line is deduced): (*worker).cover += delta; | - |
718 | | - |
719 | goto End; executed: goto End; Execution Count:83908 | 83908 |
720 | } | - |
721 | | - |
722 | /* ok, we have to render several scanlines */ | - |
723 | p = ( ONE_PIXEL - fy1 ) * dx; executed (the execution status of this line is deduced): p = ( ( 1L << 8 ) - fy1 ) * dx; | - |
724 | first = ONE_PIXEL; executed (the execution status of this line is deduced): first = ( 1L << 8 ); | - |
725 | incr = 1; executed (the execution status of this line is deduced): incr = 1; | - |
726 | | - |
727 | if ( dy < 0 ) evaluated: dy < 0 yes Evaluation Count:5498 | yes Evaluation Count:6020 |
| 5498-6020 |
728 | { | - |
729 | p = fy1 * dx; executed (the execution status of this line is deduced): p = fy1 * dx; | - |
730 | first = 0; executed (the execution status of this line is deduced): first = 0; | - |
731 | incr = -1; executed (the execution status of this line is deduced): incr = -1; | - |
732 | dy = -dy; executed (the execution status of this line is deduced): dy = -dy; | - |
733 | } executed: } Execution Count:5498 | 5498 |
734 | | - |
735 | delta = (int)( p / dy ); executed (the execution status of this line is deduced): delta = (int)( p / dy ); | - |
736 | mod = (int)( p % dy ); executed (the execution status of this line is deduced): mod = (int)( p % dy ); | - |
737 | if ( mod < 0 ) evaluated: mod < 0 yes Evaluation Count:3531 | yes Evaluation Count:7987 |
| 3531-7987 |
738 | { | - |
739 | delta--; executed (the execution status of this line is deduced): delta--; | - |
740 | mod += (TCoord)dy; executed (the execution status of this line is deduced): mod += (TCoord)dy; | - |
741 | } executed: } Execution Count:3531 | 3531 |
742 | | - |
743 | x = ras.x + delta; executed (the execution status of this line is deduced): x = (*worker).x + delta; | - |
744 | gray_render_scanline( RAS_VAR_ ey1, ras.x, fy1, x, (TCoord)first ); executed (the execution status of this line is deduced): gray_render_scanline( worker, ey1, (*worker).x, fy1, x, (TCoord)first ); | - |
745 | | - |
746 | ey1 += incr; executed (the execution status of this line is deduced): ey1 += incr; | - |
747 | gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 ); executed (the execution status of this line is deduced): gray_set_cell( worker, ( (TCoord)( (x) >> 8 ) ), ey1 ); | - |
748 | | - |
749 | if ( ey1 != ey2 ) evaluated: ey1 != ey2 yes Evaluation Count:2624 | yes Evaluation Count:8872 |
| 2624-8872 |
750 | { | - |
751 | p = ONE_PIXEL * dx; executed (the execution status of this line is deduced): p = ( 1L << 8 ) * dx; | - |
752 | lift = (int)( p / dy ); executed (the execution status of this line is deduced): lift = (int)( p / dy ); | - |
753 | rem = (int)( p % dy ); executed (the execution status of this line is deduced): rem = (int)( p % dy ); | - |
754 | if ( rem < 0 ) evaluated: rem < 0 yes Evaluation Count:1039 | yes Evaluation Count:1585 |
| 1039-1585 |
755 | { | - |
756 | lift--; executed (the execution status of this line is deduced): lift--; | - |
757 | rem += (int)dy; executed (the execution status of this line is deduced): rem += (int)dy; | - |
758 | } executed: } Execution Count:1039 | 1039 |
759 | mod -= (int)dy; executed (the execution status of this line is deduced): mod -= (int)dy; | - |
760 | | - |
761 | while ( ey1 != ey2 ) evaluated: ey1 != ey2 yes Evaluation Count:26104 | yes Evaluation Count:2615 |
| 2615-26104 |
762 | { | - |
763 | delta = lift; executed (the execution status of this line is deduced): delta = lift; | - |
764 | mod += rem; executed (the execution status of this line is deduced): mod += rem; | - |
765 | if ( mod >= 0 ) evaluated: mod >= 0 yes Evaluation Count:13752 | yes Evaluation Count:12352 |
| 12352-13752 |
766 | { | - |
767 | mod -= (int)dy; executed (the execution status of this line is deduced): mod -= (int)dy; | - |
768 | delta++; executed (the execution status of this line is deduced): delta++; | - |
769 | } executed: } Execution Count:13752 | 13752 |
770 | | - |
771 | x2 = x + delta; executed (the execution status of this line is deduced): x2 = x + delta; | - |
772 | gray_render_scanline( RAS_VAR_ ey1, x, executed (the execution status of this line is deduced): gray_render_scanline( worker, ey1, x, | - |
773 | (TCoord)( ONE_PIXEL - first ), x2, executed (the execution status of this line is deduced): (TCoord)( ( 1L << 8 ) - first ), x2, | - |
774 | (TCoord)first ); executed (the execution status of this line is deduced): (TCoord)first ); | - |
775 | x = x2; executed (the execution status of this line is deduced): x = x2; | - |
776 | | - |
777 | ey1 += incr; executed (the execution status of this line is deduced): ey1 += incr; | - |
778 | gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 ); executed (the execution status of this line is deduced): gray_set_cell( worker, ( (TCoord)( (x) >> 8 ) ), ey1 ); | - |
779 | } executed: } Execution Count:26095 | 26095 |
780 | } executed: } Execution Count:2615 | 2615 |
781 | | - |
782 | gray_render_scanline( RAS_VAR_ ey1, x, executed (the execution status of this line is deduced): gray_render_scanline( worker, ey1, x, | - |
783 | (TCoord)( ONE_PIXEL - first ), to_x, executed (the execution status of this line is deduced): (TCoord)( ( 1L << 8 ) - first ), to_x, | - |
784 | fy2 ); executed (the execution status of this line is deduced): fy2 ); | - |
785 | | - |
786 | End: code before this statement executed: End: Execution Count:11484 | 11484 |
787 | ras.x = to_x; executed (the execution status of this line is deduced): (*worker).x = to_x; | - |
788 | ras.y = to_y; executed (the execution status of this line is deduced): (*worker).y = to_y; | - |
789 | ras.last_ey = SUBPIXELS( ey2 ); executed (the execution status of this line is deduced): (*worker).last_ey = ( (TPos)(ey2) << 8 ); | - |
790 | } executed: } Execution Count:807366 | 807366 |
791 | | - |
792 | | - |
793 | static void | - |
794 | gray_split_conic( QT_FT_Vector* base ) | - |
795 | { | - |
796 | TPos a, b; never executed (the execution status of this line is deduced): TPos a, b; | - |
797 | | - |
798 | | - |
799 | base[4].x = base[2].x; never executed (the execution status of this line is deduced): base[4].x = base[2].x; | - |
800 | b = base[1].x; never executed (the execution status of this line is deduced): b = base[1].x; | - |
801 | a = base[3].x = ( base[2].x + b ) / 2; never executed (the execution status of this line is deduced): a = base[3].x = ( base[2].x + b ) / 2; | - |
802 | b = base[1].x = ( base[0].x + b ) / 2; never executed (the execution status of this line is deduced): b = base[1].x = ( base[0].x + b ) / 2; | - |
803 | base[2].x = ( a + b ) / 2; never executed (the execution status of this line is deduced): base[2].x = ( a + b ) / 2; | - |
804 | | - |
805 | base[4].y = base[2].y; never executed (the execution status of this line is deduced): base[4].y = base[2].y; | - |
806 | b = base[1].y; never executed (the execution status of this line is deduced): b = base[1].y; | - |
807 | a = base[3].y = ( base[2].y + b ) / 2; never executed (the execution status of this line is deduced): a = base[3].y = ( base[2].y + b ) / 2; | - |
808 | b = base[1].y = ( base[0].y + b ) / 2; never executed (the execution status of this line is deduced): b = base[1].y = ( base[0].y + b ) / 2; | - |
809 | base[2].y = ( a + b ) / 2; never executed (the execution status of this line is deduced): base[2].y = ( a + b ) / 2; | - |
810 | } | 0 |
811 | | - |
812 | | - |
813 | static void | - |
814 | gray_render_conic( RAS_ARG_ const QT_FT_Vector* control, | - |
815 | const QT_FT_Vector* to ) | - |
816 | { | - |
817 | TPos dx, dy; never executed (the execution status of this line is deduced): TPos dx, dy; | - |
818 | int top, level; never executed (the execution status of this line is deduced): int top, level; | - |
819 | int* levels; never executed (the execution status of this line is deduced): int* levels; | - |
820 | QT_FT_Vector* arc; never executed (the execution status of this line is deduced): QT_FT_Vector* arc; | - |
821 | | - |
822 | | - |
823 | dx = DOWNSCALE( ras.x ) + to->x - ( control->x << 1 ); never executed (the execution status of this line is deduced): dx = ( ((*worker).x) >> ( 8 - 6 ) ) + to->x - ( control->x << 1 ); | - |
824 | if ( dx < 0 ) | 0 |
825 | dx = -dx; never executed: dx = -dx; | 0 |
826 | dy = DOWNSCALE( ras.y ) + to->y - ( control->y << 1 ); never executed (the execution status of this line is deduced): dy = ( ((*worker).y) >> ( 8 - 6 ) ) + to->y - ( control->y << 1 ); | - |
827 | if ( dy < 0 ) | 0 |
828 | dy = -dy; never executed: dy = -dy; | 0 |
829 | if ( dx < dy ) | 0 |
830 | dx = dy; | 0 |
831 | | - |
832 | level = 1; never executed (the execution status of this line is deduced): level = 1; | - |
833 | dx = dx / ras.conic_level; never executed (the execution status of this line is deduced): dx = dx / (*worker).conic_level; | - |
834 | while ( dx > 0 ) | 0 |
835 | { | - |
836 | dx >>= 2; never executed (the execution status of this line is deduced): dx >>= 2; | - |
837 | level++; never executed (the execution status of this line is deduced): level++; | - |
838 | } | 0 |
839 | | - |
840 | /* a shortcut to speed things up */ | - |
841 | if ( level <= 1 ) never evaluated: level <= 1 | 0 |
842 | { | - |
843 | /* we compute the mid-point directly in order to avoid */ | - |
844 | /* calling gray_split_conic() */ | - |
845 | TPos to_x, to_y, mid_x, mid_y; never executed (the execution status of this line is deduced): TPos to_x, to_y, mid_x, mid_y; | - |
846 | | - |
847 | | - |
848 | to_x = UPSCALE( to->x ); never executed (the execution status of this line is deduced): to_x = ( (to->x) << ( 8 - 6 ) ); | - |
849 | to_y = UPSCALE( to->y ); never executed (the execution status of this line is deduced): to_y = ( (to->y) << ( 8 - 6 ) ); | - |
850 | mid_x = ( ras.x + to_x + 2 * UPSCALE( control->x ) ) / 4; never executed (the execution status of this line is deduced): mid_x = ( (*worker).x + to_x + 2 * ( (control->x) << ( 8 - 6 ) ) ) / 4; | - |
851 | mid_y = ( ras.y + to_y + 2 * UPSCALE( control->y ) ) / 4; never executed (the execution status of this line is deduced): mid_y = ( (*worker).y + to_y + 2 * ( (control->y) << ( 8 - 6 ) ) ) / 4; | - |
852 | | - |
853 | gray_render_line( RAS_VAR_ mid_x, mid_y ); never executed (the execution status of this line is deduced): gray_render_line( worker, mid_x, mid_y ); | - |
854 | gray_render_line( RAS_VAR_ to_x, to_y ); never executed (the execution status of this line is deduced): gray_render_line( worker, to_x, to_y ); | - |
855 | | - |
856 | return; | 0 |
857 | } | - |
858 | | - |
859 | arc = ras.bez_stack; never executed (the execution status of this line is deduced): arc = (*worker).bez_stack; | - |
860 | levels = ras.lev_stack; never executed (the execution status of this line is deduced): levels = (*worker).lev_stack; | - |
861 | top = 0; never executed (the execution status of this line is deduced): top = 0; | - |
862 | levels[0] = level; never executed (the execution status of this line is deduced): levels[0] = level; | - |
863 | | - |
864 | arc[0].x = UPSCALE( to->x ); never executed (the execution status of this line is deduced): arc[0].x = ( (to->x) << ( 8 - 6 ) ); | - |
865 | arc[0].y = UPSCALE( to->y ); never executed (the execution status of this line is deduced): arc[0].y = ( (to->y) << ( 8 - 6 ) ); | - |
866 | arc[1].x = UPSCALE( control->x ); never executed (the execution status of this line is deduced): arc[1].x = ( (control->x) << ( 8 - 6 ) ); | - |
867 | arc[1].y = UPSCALE( control->y ); never executed (the execution status of this line is deduced): arc[1].y = ( (control->y) << ( 8 - 6 ) ); | - |
868 | arc[2].x = ras.x; never executed (the execution status of this line is deduced): arc[2].x = (*worker).x; | - |
869 | arc[2].y = ras.y; never executed (the execution status of this line is deduced): arc[2].y = (*worker).y; | - |
870 | | - |
871 | while ( top >= 0 ) never evaluated: top >= 0 | 0 |
872 | { | - |
873 | level = levels[top]; never executed (the execution status of this line is deduced): level = levels[top]; | - |
874 | if ( level > 1 ) never evaluated: level > 1 | 0 |
875 | { | - |
876 | /* check that the arc crosses the current band */ | - |
877 | TPos min, max, y; never executed (the execution status of this line is deduced): TPos min, max, y; | - |
878 | | - |
879 | | - |
880 | min = max = arc[0].y; never executed (the execution status of this line is deduced): min = max = arc[0].y; | - |
881 | | - |
882 | y = arc[1].y; never executed (the execution status of this line is deduced): y = arc[1].y; | - |
883 | if ( y < min ) min = y; never executed: min = y; never evaluated: y < min | 0 |
884 | if ( y > max ) max = y; never executed: max = y; never evaluated: y > max | 0 |
885 | | - |
886 | y = arc[2].y; never executed (the execution status of this line is deduced): y = arc[2].y; | - |
887 | if ( y < min ) min = y; never executed: min = y; never evaluated: y < min | 0 |
888 | if ( y > max ) max = y; never executed: max = y; never evaluated: y > max | 0 |
889 | | - |
890 | if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey ) never evaluated: ( (TCoord)( (min) >> 8 ) ) >= (*worker).max_ey never evaluated: ( (TCoord)( (max) >> 8 ) ) < (*worker).min_ey | 0 |
891 | goto Draw; never executed: goto Draw; | 0 |
892 | | - |
893 | gray_split_conic( arc ); never executed (the execution status of this line is deduced): gray_split_conic( arc ); | - |
894 | arc += 2; never executed (the execution status of this line is deduced): arc += 2; | - |
895 | top++; never executed (the execution status of this line is deduced): top++; | - |
896 | levels[top] = levels[top - 1] = level - 1; never executed (the execution status of this line is deduced): levels[top] = levels[top - 1] = level - 1; | - |
897 | continue; never executed: continue; | 0 |
898 | } | - |
899 | | - |
900 | Draw: code before this statement never executed: Draw: | 0 |
901 | { | - |
902 | TPos to_x, to_y, mid_x, mid_y; never executed (the execution status of this line is deduced): TPos to_x, to_y, mid_x, mid_y; | - |
903 | | - |
904 | | - |
905 | to_x = arc[0].x; never executed (the execution status of this line is deduced): to_x = arc[0].x; | - |
906 | to_y = arc[0].y; never executed (the execution status of this line is deduced): to_y = arc[0].y; | - |
907 | mid_x = ( ras.x + to_x + 2 * arc[1].x ) / 4; never executed (the execution status of this line is deduced): mid_x = ( (*worker).x + to_x + 2 * arc[1].x ) / 4; | - |
908 | mid_y = ( ras.y + to_y + 2 * arc[1].y ) / 4; never executed (the execution status of this line is deduced): mid_y = ( (*worker).y + to_y + 2 * arc[1].y ) / 4; | - |
909 | | - |
910 | gray_render_line( RAS_VAR_ mid_x, mid_y ); never executed (the execution status of this line is deduced): gray_render_line( worker, mid_x, mid_y ); | - |
911 | gray_render_line( RAS_VAR_ to_x, to_y ); never executed (the execution status of this line is deduced): gray_render_line( worker, to_x, to_y ); | - |
912 | | - |
913 | top--; never executed (the execution status of this line is deduced): top--; | - |
914 | arc -= 2; never executed (the execution status of this line is deduced): arc -= 2; | - |
915 | } | - |
916 | } | 0 |
917 | | - |
918 | return; | 0 |
919 | } | - |
920 | | - |
921 | | - |
922 | static void | - |
923 | gray_split_cubic( QT_FT_Vector* base ) | - |
924 | { | - |
925 | TPos a, b, c, d; never executed (the execution status of this line is deduced): TPos a, b, c, d; | - |
926 | | - |
927 | | - |
928 | base[6].x = base[3].x; never executed (the execution status of this line is deduced): base[6].x = base[3].x; | - |
929 | c = base[1].x; never executed (the execution status of this line is deduced): c = base[1].x; | - |
930 | d = base[2].x; never executed (the execution status of this line is deduced): d = base[2].x; | - |
931 | base[1].x = a = ( base[0].x + c ) / 2; never executed (the execution status of this line is deduced): base[1].x = a = ( base[0].x + c ) / 2; | - |
932 | base[5].x = b = ( base[3].x + d ) / 2; never executed (the execution status of this line is deduced): base[5].x = b = ( base[3].x + d ) / 2; | - |
933 | c = ( c + d ) / 2; never executed (the execution status of this line is deduced): c = ( c + d ) / 2; | - |
934 | base[2].x = a = ( a + c ) / 2; never executed (the execution status of this line is deduced): base[2].x = a = ( a + c ) / 2; | - |
935 | base[4].x = b = ( b + c ) / 2; never executed (the execution status of this line is deduced): base[4].x = b = ( b + c ) / 2; | - |
936 | base[3].x = ( a + b ) / 2; never executed (the execution status of this line is deduced): base[3].x = ( a + b ) / 2; | - |
937 | | - |
938 | base[6].y = base[3].y; never executed (the execution status of this line is deduced): base[6].y = base[3].y; | - |
939 | c = base[1].y; never executed (the execution status of this line is deduced): c = base[1].y; | - |
940 | d = base[2].y; never executed (the execution status of this line is deduced): d = base[2].y; | - |
941 | base[1].y = a = ( base[0].y + c ) / 2; never executed (the execution status of this line is deduced): base[1].y = a = ( base[0].y + c ) / 2; | - |
942 | base[5].y = b = ( base[3].y + d ) / 2; never executed (the execution status of this line is deduced): base[5].y = b = ( base[3].y + d ) / 2; | - |
943 | c = ( c + d ) / 2; never executed (the execution status of this line is deduced): c = ( c + d ) / 2; | - |
944 | base[2].y = a = ( a + c ) / 2; never executed (the execution status of this line is deduced): base[2].y = a = ( a + c ) / 2; | - |
945 | base[4].y = b = ( b + c ) / 2; never executed (the execution status of this line is deduced): base[4].y = b = ( b + c ) / 2; | - |
946 | base[3].y = ( a + b ) / 2; never executed (the execution status of this line is deduced): base[3].y = ( a + b ) / 2; | - |
947 | } | 0 |
948 | | - |
949 | | - |
950 | static void | - |
951 | gray_render_cubic( RAS_ARG_ const QT_FT_Vector* control1, | - |
952 | const QT_FT_Vector* control2, | - |
953 | const QT_FT_Vector* to ) | - |
954 | { | - |
955 | TPos dx, dy, da, db; never executed (the execution status of this line is deduced): TPos dx, dy, da, db; | - |
956 | int top, level; never executed (the execution status of this line is deduced): int top, level; | - |
957 | int* levels; never executed (the execution status of this line is deduced): int* levels; | - |
958 | QT_FT_Vector* arc; never executed (the execution status of this line is deduced): QT_FT_Vector* arc; | - |
959 | | - |
960 | | - |
961 | dx = DOWNSCALE( ras.x ) + to->x - ( control1->x << 1 ); never executed (the execution status of this line is deduced): dx = ( ((*worker).x) >> ( 8 - 6 ) ) + to->x - ( control1->x << 1 ); | - |
962 | if ( dx < 0 ) | 0 |
963 | dx = -dx; never executed: dx = -dx; | 0 |
964 | dy = DOWNSCALE( ras.y ) + to->y - ( control1->y << 1 ); never executed (the execution status of this line is deduced): dy = ( ((*worker).y) >> ( 8 - 6 ) ) + to->y - ( control1->y << 1 ); | - |
965 | if ( dy < 0 ) | 0 |
966 | dy = -dy; never executed: dy = -dy; | 0 |
967 | if ( dx < dy ) | 0 |
968 | dx = dy; | 0 |
969 | da = dx; never executed (the execution status of this line is deduced): da = dx; | - |
970 | | - |
971 | dx = DOWNSCALE( ras.x ) + to->x - 3 * ( control1->x + control2->x ); never executed (the execution status of this line is deduced): dx = ( ((*worker).x) >> ( 8 - 6 ) ) + to->x - 3 * ( control1->x + control2->x ); | - |
972 | if ( dx < 0 ) | 0 |
973 | dx = -dx; never executed: dx = -dx; | 0 |
974 | dy = DOWNSCALE( ras.y ) + to->y - 3 * ( control1->y + control2->y ); never executed (the execution status of this line is deduced): dy = ( ((*worker).y) >> ( 8 - 6 ) ) + to->y - 3 * ( control1->y + control2->y ); | - |
975 | if ( dy < 0 ) | 0 |
976 | dy = -dy; never executed: dy = -dy; | 0 |
977 | if ( dx < dy ) | 0 |
978 | dx = dy; | 0 |
979 | db = dx; never executed (the execution status of this line is deduced): db = dx; | - |
980 | | - |
981 | level = 1; never executed (the execution status of this line is deduced): level = 1; | - |
982 | da = da / ras.cubic_level; never executed (the execution status of this line is deduced): da = da / (*worker).cubic_level; | - |
983 | db = db / ras.conic_level; never executed (the execution status of this line is deduced): db = db / (*worker).conic_level; | - |
984 | while ( da > 0 || db > 0 ) never evaluated: da > 0 never evaluated: db > 0 | 0 |
985 | { | - |
986 | da >>= 2; never executed (the execution status of this line is deduced): da >>= 2; | - |
987 | db >>= 3; never executed (the execution status of this line is deduced): db >>= 3; | - |
988 | level++; never executed (the execution status of this line is deduced): level++; | - |
989 | } | 0 |
990 | | - |
991 | if ( level <= 1 ) never evaluated: level <= 1 | 0 |
992 | { | - |
993 | TPos to_x, to_y, mid_x, mid_y; never executed (the execution status of this line is deduced): TPos to_x, to_y, mid_x, mid_y; | - |
994 | | - |
995 | | - |
996 | to_x = UPSCALE( to->x ); never executed (the execution status of this line is deduced): to_x = ( (to->x) << ( 8 - 6 ) ); | - |
997 | to_y = UPSCALE( to->y ); never executed (the execution status of this line is deduced): to_y = ( (to->y) << ( 8 - 6 ) ); | - |
998 | mid_x = ( ras.x + to_x + never executed (the execution status of this line is deduced): mid_x = ( (*worker).x + to_x + | - |
999 | 3 * UPSCALE( control1->x + control2->x ) ) / 8; never executed (the execution status of this line is deduced): 3 * ( (control1->x + control2->x) << ( 8 - 6 ) ) ) / 8; | - |
1000 | mid_y = ( ras.y + to_y + never executed (the execution status of this line is deduced): mid_y = ( (*worker).y + to_y + | - |
1001 | 3 * UPSCALE( control1->y + control2->y ) ) / 8; never executed (the execution status of this line is deduced): 3 * ( (control1->y + control2->y) << ( 8 - 6 ) ) ) / 8; | - |
1002 | | - |
1003 | gray_render_line( RAS_VAR_ mid_x, mid_y ); never executed (the execution status of this line is deduced): gray_render_line( worker, mid_x, mid_y ); | - |
1004 | gray_render_line( RAS_VAR_ to_x, to_y ); never executed (the execution status of this line is deduced): gray_render_line( worker, to_x, to_y ); | - |
1005 | return; | 0 |
1006 | } | - |
1007 | | - |
1008 | arc = ras.bez_stack; never executed (the execution status of this line is deduced): arc = (*worker).bez_stack; | - |
1009 | arc[0].x = UPSCALE( to->x ); never executed (the execution status of this line is deduced): arc[0].x = ( (to->x) << ( 8 - 6 ) ); | - |
1010 | arc[0].y = UPSCALE( to->y ); never executed (the execution status of this line is deduced): arc[0].y = ( (to->y) << ( 8 - 6 ) ); | - |
1011 | arc[1].x = UPSCALE( control2->x ); never executed (the execution status of this line is deduced): arc[1].x = ( (control2->x) << ( 8 - 6 ) ); | - |
1012 | arc[1].y = UPSCALE( control2->y ); never executed (the execution status of this line is deduced): arc[1].y = ( (control2->y) << ( 8 - 6 ) ); | - |
1013 | arc[2].x = UPSCALE( control1->x ); never executed (the execution status of this line is deduced): arc[2].x = ( (control1->x) << ( 8 - 6 ) ); | - |
1014 | arc[2].y = UPSCALE( control1->y ); never executed (the execution status of this line is deduced): arc[2].y = ( (control1->y) << ( 8 - 6 ) ); | - |
1015 | arc[3].x = ras.x; never executed (the execution status of this line is deduced): arc[3].x = (*worker).x; | - |
1016 | arc[3].y = ras.y; never executed (the execution status of this line is deduced): arc[3].y = (*worker).y; | - |
1017 | | - |
1018 | levels = ras.lev_stack; never executed (the execution status of this line is deduced): levels = (*worker).lev_stack; | - |
1019 | top = 0; never executed (the execution status of this line is deduced): top = 0; | - |
1020 | levels[0] = level; never executed (the execution status of this line is deduced): levels[0] = level; | - |
1021 | | - |
1022 | while ( top >= 0 ) never evaluated: top >= 0 | 0 |
1023 | { | - |
1024 | level = levels[top]; never executed (the execution status of this line is deduced): level = levels[top]; | - |
1025 | if ( level > 1 ) never evaluated: level > 1 | 0 |
1026 | { | - |
1027 | /* check that the arc crosses the current band */ | - |
1028 | TPos min, max, y; never executed (the execution status of this line is deduced): TPos min, max, y; | - |
1029 | | - |
1030 | | - |
1031 | min = max = arc[0].y; never executed (the execution status of this line is deduced): min = max = arc[0].y; | - |
1032 | y = arc[1].y; never executed (the execution status of this line is deduced): y = arc[1].y; | - |
1033 | if ( y < min ) min = y; never executed: min = y; never evaluated: y < min | 0 |
1034 | if ( y > max ) max = y; never executed: max = y; never evaluated: y > max | 0 |
1035 | y = arc[2].y; never executed (the execution status of this line is deduced): y = arc[2].y; | - |
1036 | if ( y < min ) min = y; never executed: min = y; never evaluated: y < min | 0 |
1037 | if ( y > max ) max = y; never executed: max = y; never evaluated: y > max | 0 |
1038 | y = arc[3].y; never executed (the execution status of this line is deduced): y = arc[3].y; | - |
1039 | if ( y < min ) min = y; never executed: min = y; never evaluated: y < min | 0 |
1040 | if ( y > max ) max = y; never executed: max = y; never evaluated: y > max | 0 |
1041 | if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < 0 ) never evaluated: ( (TCoord)( (min) >> 8 ) ) >= (*worker).max_ey never evaluated: ( (TCoord)( (max) >> 8 ) ) < 0 | 0 |
1042 | goto Draw; never executed: goto Draw; | 0 |
1043 | gray_split_cubic( arc ); never executed (the execution status of this line is deduced): gray_split_cubic( arc ); | - |
1044 | arc += 3; never executed (the execution status of this line is deduced): arc += 3; | - |
1045 | top ++; never executed (the execution status of this line is deduced): top ++; | - |
1046 | levels[top] = levels[top - 1] = level - 1; never executed (the execution status of this line is deduced): levels[top] = levels[top - 1] = level - 1; | - |
1047 | continue; never executed: continue; | 0 |
1048 | } | - |
1049 | | - |
1050 | Draw: code before this statement never executed: Draw: | 0 |
1051 | { | - |
1052 | TPos to_x, to_y, mid_x, mid_y; never executed (the execution status of this line is deduced): TPos to_x, to_y, mid_x, mid_y; | - |
1053 | | - |
1054 | | - |
1055 | to_x = arc[0].x; never executed (the execution status of this line is deduced): to_x = arc[0].x; | - |
1056 | to_y = arc[0].y; never executed (the execution status of this line is deduced): to_y = arc[0].y; | - |
1057 | mid_x = ( ras.x + to_x + 3 * ( arc[1].x + arc[2].x ) ) / 8; never executed (the execution status of this line is deduced): mid_x = ( (*worker).x + to_x + 3 * ( arc[1].x + arc[2].x ) ) / 8; | - |
1058 | mid_y = ( ras.y + to_y + 3 * ( arc[1].y + arc[2].y ) ) / 8; never executed (the execution status of this line is deduced): mid_y = ( (*worker).y + to_y + 3 * ( arc[1].y + arc[2].y ) ) / 8; | - |
1059 | | - |
1060 | gray_render_line( RAS_VAR_ mid_x, mid_y ); never executed (the execution status of this line is deduced): gray_render_line( worker, mid_x, mid_y ); | - |
1061 | gray_render_line( RAS_VAR_ to_x, to_y ); never executed (the execution status of this line is deduced): gray_render_line( worker, to_x, to_y ); | - |
1062 | top --; never executed (the execution status of this line is deduced): top --; | - |
1063 | arc -= 3; never executed (the execution status of this line is deduced): arc -= 3; | - |
1064 | } | - |
1065 | } | 0 |
1066 | | - |
1067 | return; | 0 |
1068 | } | - |
1069 | | - |
1070 | | - |
1071 | | - |
1072 | static int | - |
1073 | gray_move_to( const QT_FT_Vector* to, | - |
1074 | PWorker worker ) | - |
1075 | { | - |
1076 | TPos x, y; executed (the execution status of this line is deduced): TPos x, y; | - |
1077 | | - |
1078 | | - |
1079 | /* record current cell, if any */ | - |
1080 | gray_record_cell( worker ); executed (the execution status of this line is deduced): gray_record_cell( worker ); | - |
1081 | | - |
1082 | /* start to a new position */ | - |
1083 | x = UPSCALE( to->x ); executed (the execution status of this line is deduced): x = ( (to->x) << ( 8 - 6 ) ); | - |
1084 | y = UPSCALE( to->y ); executed (the execution status of this line is deduced): y = ( (to->y) << ( 8 - 6 ) ); | - |
1085 | | - |
1086 | gray_start_cell( worker, TRUNC( x ), TRUNC( y ) ); executed (the execution status of this line is deduced): gray_start_cell( worker, ( (TCoord)( (x) >> 8 ) ), ( (TCoord)( (y) >> 8 ) ) ); | - |
1087 | | - |
1088 | worker->x = x; executed (the execution status of this line is deduced): worker->x = x; | - |
1089 | worker->y = y; executed (the execution status of this line is deduced): worker->y = y; | - |
1090 | return 0; executed: return 0; Execution Count:50275 | 50275 |
1091 | } | - |
1092 | | - |
1093 | static void | - |
1094 | gray_render_span( int count, | - |
1095 | const QT_FT_Span* spans, | - |
1096 | PWorker worker ) | - |
1097 | { | - |
1098 | unsigned char* p; never executed (the execution status of this line is deduced): unsigned char* p; | - |
1099 | QT_FT_Bitmap* map = &worker->target; never executed (the execution status of this line is deduced): QT_FT_Bitmap* map = &worker->target; | - |
1100 | | - |
1101 | for ( ; count > 0; count--, spans++ ) never evaluated: count > 0 | 0 |
1102 | { | - |
1103 | unsigned char coverage = spans->coverage; never executed (the execution status of this line is deduced): unsigned char coverage = spans->coverage; | - |
1104 | | - |
1105 | /* first of all, compute the scanline offset */ | - |
1106 | p = (unsigned char*)map->buffer - spans->y * map->pitch; never executed (the execution status of this line is deduced): p = (unsigned char*)map->buffer - spans->y * map->pitch; | - |
1107 | if ( map->pitch >= 0 ) never evaluated: map->pitch >= 0 | 0 |
1108 | p += ( map->rows - 1 ) * map->pitch; never executed: p += ( map->rows - 1 ) * map->pitch; | 0 |
1109 | | - |
1110 | | - |
1111 | if ( coverage ) never evaluated: coverage | 0 |
1112 | { | - |
1113 | /* For small-spans it is faster to do it by ourselves than | - |
1114 | * calling `memset'. This is mainly due to the cost of the | - |
1115 | * function call. | - |
1116 | */ | - |
1117 | if ( spans->len >= 8 ) never evaluated: spans->len >= 8 | 0 |
1118 | QT_FT_MEM_SET( p + spans->x, (unsigned char)coverage, spans->len ); never executed: memset( p + spans->x, (unsigned char)coverage, spans->len ); | 0 |
1119 | else | - |
1120 | { | - |
1121 | unsigned char* q = p + spans->x; never executed (the execution status of this line is deduced): unsigned char* q = p + spans->x; | - |
1122 | | - |
1123 | | - |
1124 | switch ( spans->len ) | - |
1125 | { | - |
1126 | case 7: *q++ = (unsigned char)coverage; never executed (the execution status of this line is deduced): case 7: *q++ = (unsigned char)coverage; | - |
1127 | case 6: *q++ = (unsigned char)coverage; code before this statement never executed: case 6: | 0 |
1128 | case 5: *q++ = (unsigned char)coverage; code before this statement never executed: case 5: | 0 |
1129 | case 4: *q++ = (unsigned char)coverage; code before this statement never executed: case 4: | 0 |
1130 | case 3: *q++ = (unsigned char)coverage; code before this statement never executed: case 3: | 0 |
1131 | case 2: *q++ = (unsigned char)coverage; code before this statement never executed: case 2: | 0 |
1132 | case 1: *q = (unsigned char)coverage; code before this statement never executed: case 1: | 0 |
1133 | default: code before this statement never executed: default: | 0 |
1134 | ; | - |
1135 | } | 0 |
1136 | } | 0 |
1137 | } | - |
1138 | } | 0 |
1139 | } | 0 |
1140 | | - |
1141 | | - |
1142 | static void | - |
1143 | gray_hline( RAS_ARG_ TCoord x, | - |
1144 | TCoord y, | - |
1145 | TPos area, | - |
1146 | int acount ) | - |
1147 | { | - |
1148 | QT_FT_Span* span; executed (the execution status of this line is deduced): QT_FT_Span* span; | - |
1149 | int coverage; executed (the execution status of this line is deduced): int coverage; | - |
1150 | int skip; executed (the execution status of this line is deduced): int skip; | - |
1151 | | - |
1152 | | - |
1153 | /* compute the coverage line's coverage, depending on the */ | - |
1154 | /* outline fill rule */ | - |
1155 | /* */ | - |
1156 | /* the coverage percentage is area/(PIXEL_BITS*PIXEL_BITS*2) */ | - |
1157 | /* */ | - |
1158 | coverage = (int)( area >> ( PIXEL_BITS * 2 + 1 - 8 ) ); executed (the execution status of this line is deduced): coverage = (int)( area >> ( 8 * 2 + 1 - 8 ) ); | - |
1159 | /* use range 0..256 */ | - |
1160 | if ( coverage < 0 ) evaluated: coverage < 0 yes Evaluation Count:78914 | yes Evaluation Count:1819 |
| 1819-78914 |
1161 | coverage = -coverage; executed: coverage = -coverage; Execution Count:78914 | 78914 |
1162 | | - |
1163 | if ( ras.outline.flags & QT_FT_OUTLINE_EVEN_ODD_FILL ) evaluated: (*worker).outline.flags & 0x2 yes Evaluation Count:50824 | yes Evaluation Count:29909 |
| 29909-50824 |
1164 | { | - |
1165 | coverage &= 511; executed (the execution status of this line is deduced): coverage &= 511; | - |
1166 | | - |
1167 | if ( coverage > 256 ) partially evaluated: coverage > 256 no Evaluation Count:0 | yes Evaluation Count:50824 |
| 0-50824 |
1168 | coverage = 512 - coverage; never executed: coverage = 512 - coverage; | 0 |
1169 | else if ( coverage == 256 ) evaluated: coverage == 256 yes Evaluation Count:38431 | yes Evaluation Count:12393 |
| 12393-38431 |
1170 | coverage = 255; executed: coverage = 255; Execution Count:38431 | 38431 |
1171 | } | - |
1172 | else | - |
1173 | { | - |
1174 | /* normal non-zero winding rule */ | - |
1175 | if ( coverage >= 256 ) evaluated: coverage >= 256 yes Evaluation Count:9857 | yes Evaluation Count:20052 |
| 9857-20052 |
1176 | coverage = 255; executed: coverage = 255; Execution Count:9857 | 9857 |
1177 | } executed: } Execution Count:29909 | 29909 |
1178 | | - |
1179 | y += (TCoord)ras.min_ey; executed (the execution status of this line is deduced): y += (TCoord)(*worker).min_ey; | - |
1180 | x += (TCoord)ras.min_ex; executed (the execution status of this line is deduced): x += (TCoord)(*worker).min_ex; | - |
1181 | | - |
1182 | /* QT_FT_Span.x is a 16-bit short, so limit our coordinates appropriately */ | - |
1183 | if ( x >= 32768 ) partially evaluated: x >= 32768 no Evaluation Count:0 | yes Evaluation Count:80733 |
| 0-80733 |
1184 | x = 32767; never executed: x = 32767; | 0 |
1185 | | - |
1186 | if ( coverage ) evaluated: coverage yes Evaluation Count:80712 | yes Evaluation Count:21 |
| 21-80712 |
1187 | { | - |
1188 | /* see whether we can add this span to the current list */ | - |
1189 | span = ras.gray_spans + ras.num_gray_spans - 1; executed (the execution status of this line is deduced): span = (*worker).gray_spans + (*worker).num_gray_spans - 1; | - |
1190 | if ( ras.num_gray_spans > 0 && evaluated: (*worker).num_gray_spans > 0 yes Evaluation Count:64172 | yes Evaluation Count:16540 |
| 16540-64172 |
1191 | span->y == y && evaluated: span->y == y yes Evaluation Count:47454 | yes Evaluation Count:16718 |
| 16718-47454 |
1192 | (int)span->x + span->len == (int)x && evaluated: (int)span->x + span->len == (int)x yes Evaluation Count:34531 | yes Evaluation Count:12923 |
| 12923-34531 |
1193 | span->coverage == coverage ) evaluated: span->coverage == coverage yes Evaluation Count:3134 | yes Evaluation Count:31397 |
| 3134-31397 |
1194 | { | - |
1195 | span->len = (unsigned short)( span->len + acount ); executed (the execution status of this line is deduced): span->len = (unsigned short)( span->len + acount ); | - |
1196 | return; executed: return; Execution Count:3134 | 3134 |
1197 | } | - |
1198 | | - |
1199 | if ( ras.num_gray_spans >= QT_FT_MAX_GRAY_SPANS ) evaluated: (*worker).num_gray_spans >= 256 yes Evaluation Count:102 | yes Evaluation Count:77476 |
| 102-77476 |
1200 | { | - |
1201 | if ( ras.render_span && ras.num_gray_spans > ras.skip_spans ) partially evaluated: (*worker).render_span yes Evaluation Count:102 | no Evaluation Count:0 |
partially evaluated: (*worker).num_gray_spans > (*worker).skip_spans yes Evaluation Count:102 | no Evaluation Count:0 |
| 0-102 |
1202 | { | - |
1203 | skip = ras.skip_spans > 0 ? ras.skip_spans : 0; partially evaluated: (*worker).skip_spans > 0 no Evaluation Count:0 | yes Evaluation Count:102 |
| 0-102 |
1204 | ras.render_span( ras.num_gray_spans - skip, executed (the execution status of this line is deduced): (*worker).render_span( (*worker).num_gray_spans - skip, | - |
1205 | ras.gray_spans + skip, executed (the execution status of this line is deduced): (*worker).gray_spans + skip, | - |
1206 | ras.render_span_data ); executed (the execution status of this line is deduced): (*worker).render_span_data ); | - |
1207 | } executed: } Execution Count:102 | 102 |
1208 | | - |
1209 | ras.skip_spans -= ras.num_gray_spans; executed (the execution status of this line is deduced): (*worker).skip_spans -= (*worker).num_gray_spans; | - |
1210 | | - |
1211 | /* ras.render_span( span->y, ras.gray_spans, count ); */ | - |
1212 | | - |
1213 | #ifdef DEBUG_GRAYS | - |
1214 | | - |
1215 | if ( 1 ) | - |
1216 | { | - |
1217 | int n; | - |
1218 | | - |
1219 | | - |
1220 | fprintf( stderr, "y=%3d ", y ); | - |
1221 | span = ras.gray_spans; | - |
1222 | for ( n = 0; n < count; n++, span++ ) | - |
1223 | fprintf( stderr, "[%d..%d]:%02x ", | - |
1224 | span->x, span->x + span->len - 1, span->coverage ); | - |
1225 | fprintf( stderr, "\n" ); | - |
1226 | } | - |
1227 | | - |
1228 | #endif /* DEBUG_GRAYS */ | - |
1229 | | - |
1230 | ras.num_gray_spans = 0; executed (the execution status of this line is deduced): (*worker).num_gray_spans = 0; | - |
1231 | | - |
1232 | span = ras.gray_spans; executed (the execution status of this line is deduced): span = (*worker).gray_spans; | - |
1233 | } executed: } Execution Count:102 | 102 |
1234 | else | - |
1235 | span++; executed: span++; Execution Count:77476 | 77476 |
1236 | | - |
1237 | /* add a gray span to the current list */ | - |
1238 | span->x = (short)x; executed (the execution status of this line is deduced): span->x = (short)x; | - |
1239 | span->len = (unsigned short)acount; executed (the execution status of this line is deduced): span->len = (unsigned short)acount; | - |
1240 | span->y = (short)y; executed (the execution status of this line is deduced): span->y = (short)y; | - |
1241 | span->coverage = (unsigned char)coverage; executed (the execution status of this line is deduced): span->coverage = (unsigned char)coverage; | - |
1242 | | - |
1243 | ras.num_gray_spans++; executed (the execution status of this line is deduced): (*worker).num_gray_spans++; | - |
1244 | } executed: } Execution Count:77578 | 77578 |
1245 | } executed: } Execution Count:77599 | 77599 |
1246 | | - |
1247 | | - |
1248 | #ifdef DEBUG_GRAYS | - |
1249 | | - |
1250 | /* to be called while in the debugger */ | - |
1251 | gray_dump_cells( RAS_ARG ) | - |
1252 | { | - |
1253 | int yindex; | - |
1254 | | - |
1255 | | - |
1256 | for ( yindex = 0; yindex < ras.ycount; yindex++ ) | - |
1257 | { | - |
1258 | PCell cell; | - |
1259 | | - |
1260 | | - |
1261 | printf( "%3d:", yindex ); | - |
1262 | | - |
1263 | for ( cell = ras.ycells[yindex]; cell != NULL; cell = cell->next ) | - |
1264 | printf( " (%3d, c:%4d, a:%6d)", cell->x, cell->cover, cell->area ); | - |
1265 | printf( "\n" ); | - |
1266 | } | - |
1267 | } | - |
1268 | | - |
1269 | #endif /* DEBUG_GRAYS */ | - |
1270 | | - |
1271 | | - |
1272 | static void | - |
1273 | gray_sweep( RAS_ARG_ const QT_FT_Bitmap* target ) | - |
1274 | { | - |
1275 | int yindex; executed (the execution status of this line is deduced): int yindex; | - |
1276 | | - |
1277 | QT_FT_UNUSED( target ); executed (the execution status of this line is deduced): (target) = (target); | - |
1278 | | - |
1279 | | - |
1280 | if ( ras.num_cells == 0 ) evaluated: (*worker).num_cells == 0 yes Evaluation Count:3 | yes Evaluation Count:16800 |
| 3-16800 |
1281 | return; executed: return; Execution Count:3 | 3 |
1282 | | - |
1283 | for ( yindex = 0; yindex < ras.ycount; yindex++ ) evaluated: yindex < (*worker).ycount yes Evaluation Count:41536 | yes Evaluation Count:16800 |
| 16800-41536 |
1284 | { | - |
1285 | PCell cell = ras.ycells[yindex]; executed (the execution status of this line is deduced): PCell cell = (*worker).ycells[yindex]; | - |
1286 | TCoord cover = 0; executed (the execution status of this line is deduced): TCoord cover = 0; | - |
1287 | TCoord x = 0; executed (the execution status of this line is deduced): TCoord x = 0; | - |
1288 | | - |
1289 | | - |
1290 | for ( ; cell != NULL; cell = cell->next ) evaluated: cell != ((void *)0) yes Evaluation Count:77214 | yes Evaluation Count:41536 |
| 41536-77214 |
1291 | { | - |
1292 | TArea area; executed (the execution status of this line is deduced): TArea area; | - |
1293 | | - |
1294 | | - |
1295 | if ( cell->x > x && cover != 0 ) evaluated: cell->x > x yes Evaluation Count:19010 | yes Evaluation Count:58204 |
evaluated: cover != 0 yes Evaluation Count:10769 | yes Evaluation Count:8241 |
| 8241-58204 |
1296 | gray_hline( RAS_VAR_ x, yindex, cover * ( ONE_PIXEL * 2 ), executed: gray_hline( worker, x, yindex, cover * ( ( 1L << 8 ) * 2 ), cell->x - x ); Execution Count:10769 | 10769 |
1297 | cell->x - x ); executed: gray_hline( worker, x, yindex, cover * ( ( 1L << 8 ) * 2 ), cell->x - x ); Execution Count:10769 | 10769 |
1298 | | - |
1299 | cover += cell->cover; executed (the execution status of this line is deduced): cover += cell->cover; | - |
1300 | area = cover * ( ONE_PIXEL * 2 ) - cell->area; executed (the execution status of this line is deduced): area = cover * ( ( 1L << 8 ) * 2 ) - cell->area; | - |
1301 | | - |
1302 | if ( area != 0 && cell->x >= 0 ) evaluated: area != 0 yes Evaluation Count:68473 | yes Evaluation Count:8741 |
evaluated: cell->x >= 0 yes Evaluation Count:67822 | yes Evaluation Count:651 |
| 651-68473 |
1303 | gray_hline( RAS_VAR_ cell->x, yindex, area, 1 ); executed: gray_hline( worker, cell->x, yindex, area, 1 ); Execution Count:67822 | 67822 |
1304 | | - |
1305 | x = cell->x + 1; executed (the execution status of this line is deduced): x = cell->x + 1; | - |
1306 | } executed: } Execution Count:77214 | 77214 |
1307 | | - |
1308 | if ( ras.count_ex > x && cover != 0 ) evaluated: (*worker).count_ex > x yes Evaluation Count:13686 | yes Evaluation Count:27850 |
evaluated: cover != 0 yes Evaluation Count:2142 | yes Evaluation Count:11544 |
| 2142-27850 |
1309 | gray_hline( RAS_VAR_ x, yindex, cover * ( ONE_PIXEL * 2 ), executed: gray_hline( worker, x, yindex, cover * ( ( 1L << 8 ) * 2 ), (*worker).count_ex - x ); Execution Count:2142 | 2142 |
1310 | ras.count_ex - x ); executed: gray_hline( worker, x, yindex, cover * ( ( 1L << 8 ) * 2 ), (*worker).count_ex - x ); Execution Count:2142 | 2142 |
1311 | } executed: } Execution Count:41536 | 41536 |
1312 | } executed: } Execution Count:16800 | 16800 |
1313 | | - |
1314 | /*************************************************************************/ | - |
1315 | /* */ | - |
1316 | /* The following function should only compile in stand_alone mode, */ | - |
1317 | /* i.e., when building this component without the rest of FreeType. */ | - |
1318 | /* */ | - |
1319 | /*************************************************************************/ | - |
1320 | | - |
1321 | /*************************************************************************/ | - |
1322 | /* */ | - |
1323 | /* <Function> */ | - |
1324 | /* QT_FT_Outline_Decompose */ | - |
1325 | /* */ | - |
1326 | /* <Description> */ | - |
1327 | /* Walks over an outline's structure to decompose it into individual */ | - |
1328 | /* segments and Bezier arcs. This function is also able to emit */ | - |
1329 | /* `move to' and `close to' operations to indicate the start and end */ | - |
1330 | /* of new contours in the outline. */ | - |
1331 | /* */ | - |
1332 | /* <Input> */ | - |
1333 | /* outline :: A pointer to the source target. */ | - |
1334 | /* */ | - |
1335 | /* user :: A typeless pointer which is passed to each */ | - |
1336 | /* emitter during the decomposition. It can be */ | - |
1337 | /* used to store the state during the */ | - |
1338 | /* decomposition. */ | - |
1339 | /* */ | - |
1340 | /* <Return> */ | - |
1341 | /* Error code. 0 means success. */ | - |
1342 | /* */ | - |
1343 | static | - |
1344 | int QT_FT_Outline_Decompose( const QT_FT_Outline* outline, | - |
1345 | void* user ) | - |
1346 | { | - |
1347 | #undef SCALED | - |
1348 | #define SCALED( x ) (x) | - |
1349 | | - |
1350 | QT_FT_Vector v_last; executed (the execution status of this line is deduced): QT_FT_Vector v_last; | - |
1351 | QT_FT_Vector v_control; executed (the execution status of this line is deduced): QT_FT_Vector v_control; | - |
1352 | QT_FT_Vector v_start; executed (the execution status of this line is deduced): QT_FT_Vector v_start; | - |
1353 | | - |
1354 | QT_FT_Vector* point; executed (the execution status of this line is deduced): QT_FT_Vector* point; | - |
1355 | QT_FT_Vector* limit; executed (the execution status of this line is deduced): QT_FT_Vector* limit; | - |
1356 | char* tags; executed (the execution status of this line is deduced): char* tags; | - |
1357 | | - |
1358 | int n; /* index of contour in outline */ executed (the execution status of this line is deduced): int n; | - |
1359 | int first; /* index of first point in contour */ executed (the execution status of this line is deduced): int first; | - |
1360 | int error; executed (the execution status of this line is deduced): int error; | - |
1361 | char tag; /* current point's state */ executed (the execution status of this line is deduced): char tag; | - |
1362 | | - |
1363 | first = 0; executed (the execution status of this line is deduced): first = 0; | - |
1364 | | - |
1365 | for ( n = 0; n < outline->n_contours; n++ ) evaluated: n < outline->n_contours yes Evaluation Count:50275 | yes Evaluation Count:16803 |
| 16803-50275 |
1366 | { | - |
1367 | int last; /* index of last point in contour */ executed (the execution status of this line is deduced): int last; | - |
1368 | | - |
1369 | | - |
1370 | last = outline->contours[n]; executed (the execution status of this line is deduced): last = outline->contours[n]; | - |
1371 | limit = outline->points + last; executed (the execution status of this line is deduced): limit = outline->points + last; | - |
1372 | | - |
1373 | v_start = outline->points[first]; executed (the execution status of this line is deduced): v_start = outline->points[first]; | - |
1374 | v_last = outline->points[last]; executed (the execution status of this line is deduced): v_last = outline->points[last]; | - |
1375 | | - |
1376 | v_start.x = SCALED( v_start.x ); executed (the execution status of this line is deduced): v_start.x = (v_start.x); | - |
1377 | v_start.y = SCALED( v_start.y ); executed (the execution status of this line is deduced): v_start.y = (v_start.y); | - |
1378 | | - |
1379 | v_last.x = SCALED( v_last.x ); executed (the execution status of this line is deduced): v_last.x = (v_last.x); | - |
1380 | v_last.y = SCALED( v_last.y ); executed (the execution status of this line is deduced): v_last.y = (v_last.y); | - |
1381 | | - |
1382 | v_control = v_start; executed (the execution status of this line is deduced): v_control = v_start; | - |
1383 | | - |
1384 | point = outline->points + first; executed (the execution status of this line is deduced): point = outline->points + first; | - |
1385 | tags = outline->tags + first; executed (the execution status of this line is deduced): tags = outline->tags + first; | - |
1386 | tag = QT_FT_CURVE_TAG( tags[0] ); executed (the execution status of this line is deduced): tag = ( tags[0] & 3 ); | - |
1387 | | - |
1388 | /* A contour cannot start with a cubic control point! */ | - |
1389 | if ( tag == QT_FT_CURVE_TAG_CUBIC ) partially evaluated: tag == 2 no Evaluation Count:0 | yes Evaluation Count:50275 |
| 0-50275 |
1390 | goto Invalid_Outline; never executed: goto Invalid_Outline; | 0 |
1391 | | - |
1392 | /* check first point to determine origin */ | - |
1393 | if ( tag == QT_FT_CURVE_TAG_CONIC ) partially evaluated: tag == 0 no Evaluation Count:0 | yes Evaluation Count:50275 |
| 0-50275 |
1394 | { | - |
1395 | /* first point is conic control. Yes, this happens. */ | - |
1396 | if ( QT_FT_CURVE_TAG( outline->tags[last] ) == QT_FT_CURVE_TAG_ON ) never evaluated: ( outline->tags[last] & 3 ) == 1 | 0 |
1397 | { | - |
1398 | /* start at last point if it is on the curve */ | - |
1399 | v_start = v_last; never executed (the execution status of this line is deduced): v_start = v_last; | - |
1400 | limit--; never executed (the execution status of this line is deduced): limit--; | - |
1401 | } | 0 |
1402 | else | - |
1403 | { | - |
1404 | /* if both first and last points are conic, */ | - |
1405 | /* start at their middle and record its position */ | - |
1406 | /* for closure */ | - |
1407 | v_start.x = ( v_start.x + v_last.x ) / 2; never executed (the execution status of this line is deduced): v_start.x = ( v_start.x + v_last.x ) / 2; | - |
1408 | v_start.y = ( v_start.y + v_last.y ) / 2; never executed (the execution status of this line is deduced): v_start.y = ( v_start.y + v_last.y ) / 2; | - |
1409 | | - |
1410 | v_last = v_start; never executed (the execution status of this line is deduced): v_last = v_start; | - |
1411 | } | 0 |
1412 | point--; never executed (the execution status of this line is deduced): point--; | - |
1413 | tags--; never executed (the execution status of this line is deduced): tags--; | - |
1414 | } | 0 |
1415 | | - |
1416 | error = gray_move_to( &v_start, user ); executed (the execution status of this line is deduced): error = gray_move_to( &v_start, user ); | - |
1417 | if ( error ) partially evaluated: error no Evaluation Count:0 | yes Evaluation Count:50275 |
| 0-50275 |
1418 | goto Exit; never executed: goto Exit; | 0 |
1419 | | - |
1420 | while ( point < limit ) evaluated: point < limit yes Evaluation Count:757223 | yes Evaluation Count:50209 |
| 50209-757223 |
1421 | { | - |
1422 | point++; executed (the execution status of this line is deduced): point++; | - |
1423 | tags++; executed (the execution status of this line is deduced): tags++; | - |
1424 | | - |
1425 | tag = QT_FT_CURVE_TAG( tags[0] ); executed (the execution status of this line is deduced): tag = ( tags[0] & 3 ); | - |
1426 | switch ( tag ) | - |
1427 | { | - |
1428 | case QT_FT_CURVE_TAG_ON: /* emit a single line_to */ | - |
1429 | { | - |
1430 | QT_FT_Vector vec; executed (the execution status of this line is deduced): QT_FT_Vector vec; | - |
1431 | | - |
1432 | | - |
1433 | vec.x = SCALED( point->x ); executed (the execution status of this line is deduced): vec.x = (point->x); | - |
1434 | vec.y = SCALED( point->y ); executed (the execution status of this line is deduced): vec.y = (point->y); | - |
1435 | | - |
1436 | gray_render_line(user, UPSCALE(vec.x), UPSCALE(vec.y)); executed (the execution status of this line is deduced): gray_render_line(user, ( (vec.x) << ( 8 - 6 ) ), ( (vec.y) << ( 8 - 6 ) )); | - |
1437 | continue; executed: continue; Execution Count:757157 | 757157 |
1438 | } | - |
1439 | | - |
1440 | case QT_FT_CURVE_TAG_CONIC: /* consume conic arcs */ | - |
1441 | { | - |
1442 | v_control.x = SCALED( point->x ); never executed (the execution status of this line is deduced): v_control.x = (point->x); | - |
1443 | v_control.y = SCALED( point->y ); never executed (the execution status of this line is deduced): v_control.y = (point->y); | - |
1444 | | - |
1445 | Do_Conic: code before this statement never executed: Do_Conic: | 0 |
1446 | if ( point < limit ) never evaluated: point < limit | 0 |
1447 | { | - |
1448 | QT_FT_Vector vec; never executed (the execution status of this line is deduced): QT_FT_Vector vec; | - |
1449 | QT_FT_Vector v_middle; never executed (the execution status of this line is deduced): QT_FT_Vector v_middle; | - |
1450 | | - |
1451 | | - |
1452 | point++; never executed (the execution status of this line is deduced): point++; | - |
1453 | tags++; never executed (the execution status of this line is deduced): tags++; | - |
1454 | tag = QT_FT_CURVE_TAG( tags[0] ); never executed (the execution status of this line is deduced): tag = ( tags[0] & 3 ); | - |
1455 | | - |
1456 | vec.x = SCALED( point->x ); never executed (the execution status of this line is deduced): vec.x = (point->x); | - |
1457 | vec.y = SCALED( point->y ); never executed (the execution status of this line is deduced): vec.y = (point->y); | - |
1458 | | - |
1459 | if ( tag == QT_FT_CURVE_TAG_ON ) never evaluated: tag == 1 | 0 |
1460 | { | - |
1461 | gray_render_conic(user, &v_control, &vec); never executed (the execution status of this line is deduced): gray_render_conic(user, &v_control, &vec); | - |
1462 | continue; never executed: continue; | 0 |
1463 | } | - |
1464 | | - |
1465 | if ( tag != QT_FT_CURVE_TAG_CONIC ) never evaluated: tag != 0 | 0 |
1466 | goto Invalid_Outline; never executed: goto Invalid_Outline; | 0 |
1467 | | - |
1468 | v_middle.x = ( v_control.x + vec.x ) / 2; never executed (the execution status of this line is deduced): v_middle.x = ( v_control.x + vec.x ) / 2; | - |
1469 | v_middle.y = ( v_control.y + vec.y ) / 2; never executed (the execution status of this line is deduced): v_middle.y = ( v_control.y + vec.y ) / 2; | - |
1470 | | - |
1471 | gray_render_conic(user, &v_control, &v_middle); never executed (the execution status of this line is deduced): gray_render_conic(user, &v_control, &v_middle); | - |
1472 | v_control = vec; never executed (the execution status of this line is deduced): v_control = vec; | - |
1473 | goto Do_Conic; never executed: goto Do_Conic; | 0 |
1474 | } | - |
1475 | | - |
1476 | gray_render_conic(user, &v_control, &v_start); never executed (the execution status of this line is deduced): gray_render_conic(user, &v_control, &v_start); | - |
1477 | goto Close; never executed: goto Close; | 0 |
1478 | } | - |
1479 | | - |
1480 | default: /* QT_FT_CURVE_TAG_CUBIC */ | - |
1481 | { | - |
1482 | QT_FT_Vector vec1, vec2; never executed (the execution status of this line is deduced): QT_FT_Vector vec1, vec2; | - |
1483 | | - |
1484 | | - |
1485 | if ( point + 1 > limit || never evaluated: point + 1 > limit | 0 |
1486 | QT_FT_CURVE_TAG( tags[1] ) != QT_FT_CURVE_TAG_CUBIC ) never evaluated: ( tags[1] & 3 ) != 2 | 0 |
1487 | goto Invalid_Outline; never executed: goto Invalid_Outline; | 0 |
1488 | | - |
1489 | point += 2; never executed (the execution status of this line is deduced): point += 2; | - |
1490 | tags += 2; never executed (the execution status of this line is deduced): tags += 2; | - |
1491 | | - |
1492 | vec1.x = SCALED( point[-2].x ); never executed (the execution status of this line is deduced): vec1.x = (point[-2].x); | - |
1493 | vec1.y = SCALED( point[-2].y ); never executed (the execution status of this line is deduced): vec1.y = (point[-2].y); | - |
1494 | | - |
1495 | vec2.x = SCALED( point[-1].x ); never executed (the execution status of this line is deduced): vec2.x = (point[-1].x); | - |
1496 | vec2.y = SCALED( point[-1].y ); never executed (the execution status of this line is deduced): vec2.y = (point[-1].y); | - |
1497 | | - |
1498 | if ( point <= limit ) never evaluated: point <= limit | 0 |
1499 | { | - |
1500 | QT_FT_Vector vec; never executed (the execution status of this line is deduced): QT_FT_Vector vec; | - |
1501 | | - |
1502 | | - |
1503 | vec.x = SCALED( point->x ); never executed (the execution status of this line is deduced): vec.x = (point->x); | - |
1504 | vec.y = SCALED( point->y ); never executed (the execution status of this line is deduced): vec.y = (point->y); | - |
1505 | | - |
1506 | gray_render_cubic(user, &vec1, &vec2, &vec); never executed (the execution status of this line is deduced): gray_render_cubic(user, &vec1, &vec2, &vec); | - |
1507 | continue; never executed: continue; | 0 |
1508 | } | - |
1509 | | - |
1510 | gray_render_cubic(user, &vec1, &vec2, &v_start); never executed (the execution status of this line is deduced): gray_render_cubic(user, &vec1, &vec2, &v_start); | - |
1511 | goto Close; never executed: goto Close; | 0 |
1512 | } | - |
1513 | } | - |
1514 | } | 0 |
1515 | | - |
1516 | /* close the contour with a line segment */ | - |
1517 | gray_render_line(user, UPSCALE(v_start.x), UPSCALE(v_start.y)); executed (the execution status of this line is deduced): gray_render_line(user, ( (v_start.x) << ( 8 - 6 ) ), ( (v_start.y) << ( 8 - 6 ) )); | - |
1518 | | - |
1519 | Close: code before this statement executed: Close: Execution Count:50209 | 50209 |
1520 | first = last + 1; executed (the execution status of this line is deduced): first = last + 1; | - |
1521 | } executed: } Execution Count:50209 | 50209 |
1522 | | - |
1523 | return 0; executed: return 0; Execution Count:16803 | 16803 |
1524 | | - |
1525 | Exit: | - |
1526 | return error; never executed: return error; | 0 |
1527 | | - |
1528 | Invalid_Outline: | - |
1529 | return ErrRaster_Invalid_Outline; never executed: return -1; | 0 |
1530 | } | - |
1531 | | - |
1532 | typedef struct TBand_ | - |
1533 | { | - |
1534 | TPos min, max; | - |
1535 | | - |
1536 | } TBand; | - |
1537 | | - |
1538 | | - |
1539 | static int | - |
1540 | gray_convert_glyph_inner( RAS_ARG ) | - |
1541 | { | - |
1542 | volatile int error = 0; executed (the execution status of this line is deduced): volatile int error = 0; | - |
1543 | | - |
1544 | if ( qt_ft_setjmp( ras.jump_buffer ) == 0 ) evaluated: _setjmp ((*worker).jump_buffer) == 0 yes Evaluation Count:16869 | yes Evaluation Count:66 |
| 66-16869 |
1545 | { | - |
1546 | error = QT_FT_Outline_Decompose( &ras.outline, &ras ); executed (the execution status of this line is deduced): error = QT_FT_Outline_Decompose( &(*worker).outline, &(*worker) ); | - |
1547 | gray_record_cell( RAS_VAR ); executed (the execution status of this line is deduced): gray_record_cell( worker ); | - |
1548 | } executed: } Execution Count:16803 | 16803 |
1549 | else | - |
1550 | { | - |
1551 | error = ErrRaster_Memory_Overflow; executed (the execution status of this line is deduced): error = -4; | - |
1552 | } executed: } Execution Count:66 | 66 |
1553 | | - |
1554 | return error; executed: return error; Execution Count:16869 | 16869 |
1555 | } | - |
1556 | | - |
1557 | | - |
1558 | static int | - |
1559 | gray_convert_glyph( RAS_ARG ) | - |
1560 | { | - |
1561 | TBand bands[40]; executed (the execution status of this line is deduced): TBand bands[40]; | - |
1562 | TBand* volatile band; executed (the execution status of this line is deduced): TBand* volatile band; | - |
1563 | int volatile n, num_bands; executed (the execution status of this line is deduced): int volatile n, num_bands; | - |
1564 | TPos volatile min, max, max_y; executed (the execution status of this line is deduced): TPos volatile min, max, max_y; | - |
1565 | QT_FT_BBox* clip; executed (the execution status of this line is deduced): QT_FT_BBox* clip; | - |
1566 | int skip; executed (the execution status of this line is deduced): int skip; | - |
1567 | | - |
1568 | ras.num_gray_spans = 0; executed (the execution status of this line is deduced): (*worker).num_gray_spans = 0; | - |
1569 | | - |
1570 | /* Set up state in the raster object */ | - |
1571 | gray_compute_cbox( RAS_VAR ); executed (the execution status of this line is deduced): gray_compute_cbox( worker ); | - |
1572 | | - |
1573 | /* clip to target bitmap, exit if nothing to do */ | - |
1574 | clip = &ras.clip_box; executed (the execution status of this line is deduced): clip = &(*worker).clip_box; | - |
1575 | | - |
1576 | if ( ras.max_ex <= clip->xMin || ras.min_ex >= clip->xMax || partially evaluated: (*worker).max_ex <= clip->xMin no Evaluation Count:0 | yes Evaluation Count:16545 |
evaluated: (*worker).min_ex >= clip->xMax yes Evaluation Count:5 | yes Evaluation Count:16540 |
| 0-16545 |
1577 | ras.max_ey <= clip->yMin || ras.min_ey >= clip->yMax ) partially evaluated: (*worker).max_ey <= clip->yMin no Evaluation Count:0 | yes Evaluation Count:16540 |
partially evaluated: (*worker).min_ey >= clip->yMax no Evaluation Count:0 | yes Evaluation Count:16540 |
| 0-16540 |
1578 | return 0; executed: return 0; Execution Count:5 | 5 |
1579 | | - |
1580 | if ( ras.min_ex < clip->xMin ) ras.min_ex = clip->xMin; executed: (*worker).min_ex = clip->xMin; Execution Count:11 evaluated: (*worker).min_ex < clip->xMin yes Evaluation Count:11 | yes Evaluation Count:16529 |
| 11-16529 |
1581 | if ( ras.min_ey < clip->yMin ) ras.min_ey = clip->yMin; executed: (*worker).min_ey = clip->yMin; Execution Count:6 evaluated: (*worker).min_ey < clip->yMin yes Evaluation Count:6 | yes Evaluation Count:16534 |
| 6-16534 |
1582 | | - |
1583 | if ( ras.max_ex > clip->xMax ) ras.max_ex = clip->xMax; executed: (*worker).max_ex = clip->xMax; Execution Count:8208 evaluated: (*worker).max_ex > clip->xMax yes Evaluation Count:8208 | yes Evaluation Count:8332 |
| 8208-8332 |
1584 | if ( ras.max_ey > clip->yMax ) ras.max_ey = clip->yMax; executed: (*worker).max_ey = clip->yMax; Execution Count:8221 evaluated: (*worker).max_ey > clip->yMax yes Evaluation Count:8221 | yes Evaluation Count:8319 |
| 8221-8319 |
1585 | | - |
1586 | ras.count_ex = ras.max_ex - ras.min_ex; executed (the execution status of this line is deduced): (*worker).count_ex = (*worker).max_ex - (*worker).min_ex; | - |
1587 | ras.count_ey = ras.max_ey - ras.min_ey; executed (the execution status of this line is deduced): (*worker).count_ey = (*worker).max_ey - (*worker).min_ey; | - |
1588 | | - |
1589 | /* simple heuristic used to speed-up the bezier decomposition -- see */ | - |
1590 | /* the code in gray_render_conic() and gray_render_cubic() for more */ | - |
1591 | /* details */ | - |
1592 | ras.conic_level = 32; executed (the execution status of this line is deduced): (*worker).conic_level = 32; | - |
1593 | ras.cubic_level = 16; executed (the execution status of this line is deduced): (*worker).cubic_level = 16; | - |
1594 | | - |
1595 | { | - |
1596 | int level = 0; executed (the execution status of this line is deduced): int level = 0; | - |
1597 | | - |
1598 | | - |
1599 | if ( ras.count_ex > 24 || ras.count_ey > 24 ) evaluated: (*worker).count_ex > 24 yes Evaluation Count:147 | yes Evaluation Count:16393 |
partially evaluated: (*worker).count_ey > 24 no Evaluation Count:0 | yes Evaluation Count:16393 |
| 0-16393 |
1600 | level++; executed: level++; Execution Count:147 | 147 |
1601 | if ( ras.count_ex > 120 || ras.count_ey > 120 ) evaluated: (*worker).count_ex > 120 yes Evaluation Count:38 | yes Evaluation Count:16502 |
evaluated: (*worker).count_ey > 120 yes Evaluation Count:3 | yes Evaluation Count:16499 |
| 3-16502 |
1602 | level++; executed: level++; Execution Count:41 | 41 |
1603 | | - |
1604 | ras.conic_level <<= level; executed (the execution status of this line is deduced): (*worker).conic_level <<= level; | - |
1605 | ras.cubic_level <<= level; executed (the execution status of this line is deduced): (*worker).cubic_level <<= level; | - |
1606 | } | - |
1607 | | - |
1608 | /* setup vertical bands */ | - |
1609 | num_bands = (int)( ( ras.max_ey - ras.min_ey ) / ras.band_size ); executed (the execution status of this line is deduced): num_bands = (int)( ( (*worker).max_ey - (*worker).min_ey ) / (*worker).band_size ); | - |
1610 | if ( num_bands == 0 ) num_bands = 1; executed: num_bands = 1; Execution Count:16416 evaluated: num_bands == 0 yes Evaluation Count:16416 | yes Evaluation Count:124 |
| 124-16416 |
1611 | if ( num_bands >= 39 ) num_bands = 39; never executed: num_bands = 39; partially evaluated: num_bands >= 39 no Evaluation Count:0 | yes Evaluation Count:16540 |
| 0-16540 |
1612 | | - |
1613 | ras.band_shoot = 0; executed (the execution status of this line is deduced): (*worker).band_shoot = 0; | - |
1614 | | - |
1615 | min = ras.min_ey; executed (the execution status of this line is deduced): min = (*worker).min_ey; | - |
1616 | max_y = ras.max_ey; executed (the execution status of this line is deduced): max_y = (*worker).max_ey; | - |
1617 | | - |
1618 | for ( n = 0; n < num_bands; n++, min = max ) evaluated: n < num_bands yes Evaluation Count:16737 | yes Evaluation Count:16540 |
| 16540-16737 |
1619 | { | - |
1620 | max = min + ras.band_size; executed (the execution status of this line is deduced): max = min + (*worker).band_size; | - |
1621 | if ( n == num_bands - 1 || max > max_y ) evaluated: n == num_bands - 1 yes Evaluation Count:16540 | yes Evaluation Count:197 |
partially evaluated: max > max_y no Evaluation Count:0 | yes Evaluation Count:197 |
| 0-16540 |
1622 | max = max_y; executed: max = max_y; Execution Count:16540 | 16540 |
1623 | | - |
1624 | bands[0].min = min; executed (the execution status of this line is deduced): bands[0].min = min; | - |
1625 | bands[0].max = max; executed (the execution status of this line is deduced): bands[0].max = max; | - |
1626 | band = bands; executed (the execution status of this line is deduced): band = bands; | - |
1627 | | - |
1628 | while ( band >= bands ) evaluated: band >= bands yes Evaluation Count:16869 | yes Evaluation Count:16737 |
| 16737-16869 |
1629 | { | - |
1630 | TPos bottom, top, middle; executed (the execution status of this line is deduced): TPos bottom, top, middle; | - |
1631 | int error; executed (the execution status of this line is deduced): int error; | - |
1632 | | - |
1633 | { | - |
1634 | PCell cells_max; executed (the execution status of this line is deduced): PCell cells_max; | - |
1635 | int yindex; executed (the execution status of this line is deduced): int yindex; | - |
1636 | int cell_start, cell_end, cell_mod; executed (the execution status of this line is deduced): int cell_start, cell_end, cell_mod; | - |
1637 | | - |
1638 | | - |
1639 | ras.ycells = (PCell*)ras.buffer; executed (the execution status of this line is deduced): (*worker).ycells = (PCell*)(*worker).buffer; | - |
1640 | ras.ycount = band->max - band->min; executed (the execution status of this line is deduced): (*worker).ycount = band->max - band->min; | - |
1641 | | - |
1642 | cell_start = sizeof ( PCell ) * ras.ycount; executed (the execution status of this line is deduced): cell_start = sizeof ( PCell ) * (*worker).ycount; | - |
1643 | cell_mod = cell_start % sizeof ( TCell ); executed (the execution status of this line is deduced): cell_mod = cell_start % sizeof ( TCell ); | - |
1644 | if ( cell_mod > 0 ) evaluated: cell_mod > 0 yes Evaluation Count:8359 | yes Evaluation Count:8510 |
| 8359-8510 |
1645 | cell_start += sizeof ( TCell ) - cell_mod; executed: cell_start += sizeof ( TCell ) - cell_mod; Execution Count:8359 | 8359 |
1646 | | - |
1647 | cell_end = ras.buffer_size; executed (the execution status of this line is deduced): cell_end = (*worker).buffer_size; | - |
1648 | cell_end -= cell_end % sizeof( TCell ); executed (the execution status of this line is deduced): cell_end -= cell_end % sizeof( TCell ); | - |
1649 | | - |
1650 | cells_max = (PCell)( (char*)ras.buffer + cell_end ); executed (the execution status of this line is deduced): cells_max = (PCell)( (char*)(*worker).buffer + cell_end ); | - |
1651 | ras.cells = (PCell)( (char*)ras.buffer + cell_start ); executed (the execution status of this line is deduced): (*worker).cells = (PCell)( (char*)(*worker).buffer + cell_start ); | - |
1652 | if ( ras.cells >= cells_max ) partially evaluated: (*worker).cells >= cells_max no Evaluation Count:0 | yes Evaluation Count:16869 |
| 0-16869 |
1653 | goto ReduceBands; never executed: goto ReduceBands; | 0 |
1654 | | - |
1655 | ras.max_cells = (int)(cells_max - ras.cells); executed (the execution status of this line is deduced): (*worker).max_cells = (int)(cells_max - (*worker).cells); | - |
1656 | if ( ras.max_cells < 2 ) partially evaluated: (*worker).max_cells < 2 no Evaluation Count:0 | yes Evaluation Count:16869 |
| 0-16869 |
1657 | goto ReduceBands; never executed: goto ReduceBands; | 0 |
1658 | | - |
1659 | for ( yindex = 0; yindex < ras.ycount; yindex++ ) evaluated: yindex < (*worker).ycount yes Evaluation Count:43193 | yes Evaluation Count:16869 |
| 16869-43193 |
1660 | ras.ycells[yindex] = NULL; executed: (*worker).ycells[yindex] = ((void *)0); Execution Count:43193 | 43193 |
1661 | } | - |
1662 | | - |
1663 | ras.num_cells = 0; executed (the execution status of this line is deduced): (*worker).num_cells = 0; | - |
1664 | ras.invalid = 1; executed (the execution status of this line is deduced): (*worker).invalid = 1; | - |
1665 | ras.min_ey = band->min; executed (the execution status of this line is deduced): (*worker).min_ey = band->min; | - |
1666 | ras.max_ey = band->max; executed (the execution status of this line is deduced): (*worker).max_ey = band->max; | - |
1667 | ras.count_ey = band->max - band->min; executed (the execution status of this line is deduced): (*worker).count_ey = band->max - band->min; | - |
1668 | | - |
1669 | error = gray_convert_glyph_inner( RAS_VAR ); executed (the execution status of this line is deduced): error = gray_convert_glyph_inner( worker ); | - |
1670 | | - |
1671 | if ( !error ) evaluated: !error yes Evaluation Count:16803 | yes Evaluation Count:66 |
| 66-16803 |
1672 | { | - |
1673 | gray_sweep( RAS_VAR_ &ras.target ); executed (the execution status of this line is deduced): gray_sweep( worker, &(*worker).target ); | - |
1674 | band--; executed (the execution status of this line is deduced): band--; | - |
1675 | continue; executed: continue; Execution Count:16803 | 16803 |
1676 | } | - |
1677 | else if ( error != ErrRaster_Memory_Overflow ) partially evaluated: error != -4 no Evaluation Count:0 | yes Evaluation Count:66 |
| 0-66 |
1678 | return 1; never executed: return 1; | 0 |
1679 | | - |
1680 | ReduceBands: code before this statement executed: ReduceBands: Execution Count:66 | 66 |
1681 | /* render pool overflow; we will reduce the render band by half */ | - |
1682 | bottom = band->min; executed (the execution status of this line is deduced): bottom = band->min; | - |
1683 | top = band->max; executed (the execution status of this line is deduced): top = band->max; | - |
1684 | middle = bottom + ( ( top - bottom ) >> 1 ); executed (the execution status of this line is deduced): middle = bottom + ( ( top - bottom ) >> 1 ); | - |
1685 | | - |
1686 | /* This is too complex for a single scanline; there must */ | - |
1687 | /* be some problems. */ | - |
1688 | if ( middle == bottom ) partially evaluated: middle == bottom no Evaluation Count:0 | yes Evaluation Count:66 |
| 0-66 |
1689 | { | - |
1690 | #ifdef DEBUG_GRAYS | - |
1691 | fprintf( stderr, "Rotten glyph!\n" ); | - |
1692 | #endif | - |
1693 | return ErrRaster_OutOfMemory; never executed: return -6; | 0 |
1694 | } | - |
1695 | | - |
1696 | if ( bottom-top >= ras.band_size ) partially evaluated: bottom-top >= (*worker).band_size no Evaluation Count:0 | yes Evaluation Count:66 |
| 0-66 |
1697 | ras.band_shoot++; never executed: (*worker).band_shoot++; | 0 |
1698 | | - |
1699 | band[1].min = bottom; executed (the execution status of this line is deduced): band[1].min = bottom; | - |
1700 | band[1].max = middle; executed (the execution status of this line is deduced): band[1].max = middle; | - |
1701 | band[0].min = middle; executed (the execution status of this line is deduced): band[0].min = middle; | - |
1702 | band[0].max = top; executed (the execution status of this line is deduced): band[0].max = top; | - |
1703 | band++; executed (the execution status of this line is deduced): band++; | - |
1704 | } executed: } Execution Count:66 | 66 |
1705 | } executed: } Execution Count:16737 | 16737 |
1706 | | - |
1707 | if ( ras.render_span && ras.num_gray_spans > ras.skip_spans ) partially evaluated: (*worker).render_span yes Evaluation Count:16540 | no Evaluation Count:0 |
partially evaluated: (*worker).num_gray_spans > (*worker).skip_spans yes Evaluation Count:16540 | no Evaluation Count:0 |
| 0-16540 |
1708 | { | - |
1709 | skip = ras.skip_spans > 0 ? ras.skip_spans : 0; partially evaluated: (*worker).skip_spans > 0 no Evaluation Count:0 | yes Evaluation Count:16540 |
| 0-16540 |
1710 | ras.render_span( ras.num_gray_spans - skip, executed (the execution status of this line is deduced): (*worker).render_span( (*worker).num_gray_spans - skip, | - |
1711 | ras.gray_spans + skip, executed (the execution status of this line is deduced): (*worker).gray_spans + skip, | - |
1712 | ras.render_span_data ); executed (the execution status of this line is deduced): (*worker).render_span_data ); | - |
1713 | } executed: } Execution Count:16540 | 16540 |
1714 | | - |
1715 | ras.skip_spans -= ras.num_gray_spans; executed (the execution status of this line is deduced): (*worker).skip_spans -= (*worker).num_gray_spans; | - |
1716 | | - |
1717 | if ( ras.band_shoot > 8 && ras.band_size > 16 ) partially evaluated: (*worker).band_shoot > 8 no Evaluation Count:0 | yes Evaluation Count:16540 |
never evaluated: (*worker).band_size > 16 | 0-16540 |
1718 | ras.band_size = ras.band_size / 2; never executed: (*worker).band_size = (*worker).band_size / 2; | 0 |
1719 | | - |
1720 | return 0; executed: return 0; Execution Count:16540 | 16540 |
1721 | } | - |
1722 | | - |
1723 | | - |
1724 | static int | - |
1725 | gray_raster_render( QT_FT_Raster raster, | - |
1726 | const QT_FT_Raster_Params* params ) | - |
1727 | { | - |
1728 | const QT_FT_Outline* outline = (const QT_FT_Outline*)params->source; executed (the execution status of this line is deduced): const QT_FT_Outline* outline = (const QT_FT_Outline*)params->source; | - |
1729 | const QT_FT_Bitmap* target_map = params->target; executed (the execution status of this line is deduced): const QT_FT_Bitmap* target_map = params->target; | - |
1730 | PWorker worker; executed (the execution status of this line is deduced): PWorker worker; | - |
1731 | | - |
1732 | | - |
1733 | if ( !raster || !raster->buffer || !raster->buffer_size ) partially evaluated: !raster no Evaluation Count:0 | yes Evaluation Count:16545 |
partially evaluated: !raster->buffer no Evaluation Count:0 | yes Evaluation Count:16545 |
partially evaluated: !raster->buffer_size no Evaluation Count:0 | yes Evaluation Count:16545 |
| 0-16545 |
1734 | return ErrRaster_Invalid_Argument; never executed: return -3; | 0 |
1735 | | - |
1736 | if ( raster->worker ) partially evaluated: raster->worker yes Evaluation Count:16545 | no Evaluation Count:0 |
| 0-16545 |
1737 | raster->worker->skip_spans = params->skip_spans; executed: raster->worker->skip_spans = params->skip_spans; Execution Count:16545 | 16545 |
1738 | | - |
1739 | // If raster object and raster buffer are allocated, but | - |
1740 | // raster size isn't of the minimum size, indicate out of | - |
1741 | // memory. | - |
1742 | if (raster->buffer_allocated_size < MINIMUM_POOL_SIZE ) partially evaluated: raster->buffer_allocated_size < 8192 no Evaluation Count:0 | yes Evaluation Count:16545 |
| 0-16545 |
1743 | return ErrRaster_OutOfMemory; never executed: return -6; | 0 |
1744 | | - |
1745 | /* return immediately if the outline is empty */ | - |
1746 | if ( outline->n_points == 0 || outline->n_contours <= 0 ) partially evaluated: outline->n_points == 0 no Evaluation Count:0 | yes Evaluation Count:16545 |
partially evaluated: outline->n_contours <= 0 no Evaluation Count:0 | yes Evaluation Count:16545 |
| 0-16545 |
1747 | return 0; never executed: return 0; | 0 |
1748 | | - |
1749 | if ( !outline || !outline->contours || !outline->points ) partially evaluated: !outline no Evaluation Count:0 | yes Evaluation Count:16545 |
partially evaluated: !outline->contours no Evaluation Count:0 | yes Evaluation Count:16545 |
partially evaluated: !outline->points no Evaluation Count:0 | yes Evaluation Count:16545 |
| 0-16545 |
1750 | return ErrRaster_Invalid_Outline; never executed: return -1; | 0 |
1751 | | - |
1752 | if ( outline->n_points != partially evaluated: outline->n_points != outline->contours[outline->n_contours - 1] + 1 no Evaluation Count:0 | yes Evaluation Count:16545 |
| 0-16545 |
1753 | outline->contours[outline->n_contours - 1] + 1 ) partially evaluated: outline->n_points != outline->contours[outline->n_contours - 1] + 1 no Evaluation Count:0 | yes Evaluation Count:16545 |
| 0-16545 |
1754 | return ErrRaster_Invalid_Outline; never executed: return -1; | 0 |
1755 | | - |
1756 | worker = raster->worker; executed (the execution status of this line is deduced): worker = raster->worker; | - |
1757 | | - |
1758 | /* if direct mode is not set, we must have a target bitmap */ | - |
1759 | if ( ( params->flags & QT_FT_RASTER_FLAG_DIRECT ) == 0 ) partially evaluated: ( params->flags & 0x2 ) == 0 no Evaluation Count:0 | yes Evaluation Count:16545 |
| 0-16545 |
1760 | { | - |
1761 | if ( !target_map ) never evaluated: !target_map | 0 |
1762 | return ErrRaster_Invalid_Argument; never executed: return -3; | 0 |
1763 | | - |
1764 | /* nothing to do */ | - |
1765 | if ( !target_map->width || !target_map->rows ) never evaluated: !target_map->width never evaluated: !target_map->rows | 0 |
1766 | return 0; never executed: return 0; | 0 |
1767 | | - |
1768 | if ( !target_map->buffer ) never evaluated: !target_map->buffer | 0 |
1769 | return ErrRaster_Invalid_Argument; never executed: return -3; | 0 |
1770 | } | 0 |
1771 | | - |
1772 | /* this version does not support monochrome rendering */ | - |
1773 | if ( !( params->flags & QT_FT_RASTER_FLAG_AA ) ) partially evaluated: !( params->flags & 0x1 ) no Evaluation Count:0 | yes Evaluation Count:16545 |
| 0-16545 |
1774 | return ErrRaster_Invalid_Mode; never executed: return -2; | 0 |
1775 | | - |
1776 | /* compute clipping box */ | - |
1777 | if ( ( params->flags & QT_FT_RASTER_FLAG_DIRECT ) == 0 ) partially evaluated: ( params->flags & 0x2 ) == 0 no Evaluation Count:0 | yes Evaluation Count:16545 |
| 0-16545 |
1778 | { | - |
1779 | /* compute clip box from target pixmap */ | - |
1780 | ras.clip_box.xMin = 0; never executed (the execution status of this line is deduced): (*worker).clip_box.xMin = 0; | - |
1781 | ras.clip_box.yMin = 0; never executed (the execution status of this line is deduced): (*worker).clip_box.yMin = 0; | - |
1782 | ras.clip_box.xMax = target_map->width; never executed (the execution status of this line is deduced): (*worker).clip_box.xMax = target_map->width; | - |
1783 | ras.clip_box.yMax = target_map->rows; never executed (the execution status of this line is deduced): (*worker).clip_box.yMax = target_map->rows; | - |
1784 | } | 0 |
1785 | else if ( params->flags & QT_FT_RASTER_FLAG_CLIP ) partially evaluated: params->flags & 0x4 yes Evaluation Count:16545 | no Evaluation Count:0 |
| 0-16545 |
1786 | { | - |
1787 | ras.clip_box = params->clip_box; executed (the execution status of this line is deduced): (*worker).clip_box = params->clip_box; | - |
1788 | } executed: } Execution Count:16545 | 16545 |
1789 | else | - |
1790 | { | - |
1791 | ras.clip_box.xMin = -32768L; never executed (the execution status of this line is deduced): (*worker).clip_box.xMin = -32768L; | - |
1792 | ras.clip_box.yMin = -32768L; never executed (the execution status of this line is deduced): (*worker).clip_box.yMin = -32768L; | - |
1793 | ras.clip_box.xMax = 32767L; never executed (the execution status of this line is deduced): (*worker).clip_box.xMax = 32767L; | - |
1794 | ras.clip_box.yMax = 32767L; never executed (the execution status of this line is deduced): (*worker).clip_box.yMax = 32767L; | - |
1795 | } | 0 |
1796 | | - |
1797 | gray_init_cells( worker, raster->buffer, raster->buffer_size ); executed (the execution status of this line is deduced): gray_init_cells( worker, raster->buffer, raster->buffer_size ); | - |
1798 | | - |
1799 | ras.outline = *outline; executed (the execution status of this line is deduced): (*worker).outline = *outline; | - |
1800 | ras.num_cells = 0; executed (the execution status of this line is deduced): (*worker).num_cells = 0; | - |
1801 | ras.invalid = 1; executed (the execution status of this line is deduced): (*worker).invalid = 1; | - |
1802 | ras.band_size = raster->band_size; executed (the execution status of this line is deduced): (*worker).band_size = raster->band_size; | - |
1803 | | - |
1804 | if ( target_map ) partially evaluated: target_map no Evaluation Count:0 | yes Evaluation Count:16545 |
| 0-16545 |
1805 | ras.target = *target_map; never executed: (*worker).target = *target_map; | 0 |
1806 | | - |
1807 | ras.render_span = (QT_FT_Raster_Span_Func)gray_render_span; executed (the execution status of this line is deduced): (*worker).render_span = (QT_FT_SpanFunc)gray_render_span; | - |
1808 | ras.render_span_data = &ras; executed (the execution status of this line is deduced): (*worker).render_span_data = &(*worker); | - |
1809 | | - |
1810 | if ( params->flags & QT_FT_RASTER_FLAG_DIRECT ) partially evaluated: params->flags & 0x2 yes Evaluation Count:16545 | no Evaluation Count:0 |
| 0-16545 |
1811 | { | - |
1812 | ras.render_span = (QT_FT_Raster_Span_Func)params->gray_spans; executed (the execution status of this line is deduced): (*worker).render_span = (QT_FT_SpanFunc)params->gray_spans; | - |
1813 | ras.render_span_data = params->user; executed (the execution status of this line is deduced): (*worker).render_span_data = params->user; | - |
1814 | } executed: } Execution Count:16545 | 16545 |
1815 | | - |
1816 | return gray_convert_glyph( worker ); executed: return gray_convert_glyph( worker ); Execution Count:16545 | 16545 |
1817 | } | - |
1818 | | - |
1819 | | - |
1820 | /**** RASTER OBJECT CREATION: In standalone mode, we simply use *****/ | - |
1821 | /**** a static object. *****/ | - |
1822 | | - |
1823 | static int | - |
1824 | gray_raster_new( QT_FT_Raster* araster ) | - |
1825 | { | - |
1826 | *araster = malloc(sizeof(TRaster)); executed (the execution status of this line is deduced): *araster = malloc(sizeof(TRaster)); | - |
1827 | if (!*araster) { partially evaluated: !*araster no Evaluation Count:0 | yes Evaluation Count:5615 |
| 0-5615 |
1828 | *araster = 0; never executed (the execution status of this line is deduced): *araster = 0; | - |
1829 | return ErrRaster_Memory_Overflow; never executed: return -4; | 0 |
1830 | } | - |
1831 | QT_FT_MEM_ZERO(*araster, sizeof(TRaster)); executed (the execution status of this line is deduced): memset( *araster, 0, sizeof(TRaster) ); | - |
1832 | | - |
1833 | return 0; executed: return 0; Execution Count:5615 | 5615 |
1834 | } | - |
1835 | | - |
1836 | | - |
1837 | static void | - |
1838 | gray_raster_done( QT_FT_Raster raster ) | - |
1839 | { | - |
1840 | free(raster); executed (the execution status of this line is deduced): free(raster); | - |
1841 | } executed: } Execution Count:5604 | 5604 |
1842 | | - |
1843 | | - |
1844 | static void | - |
1845 | gray_raster_reset( QT_FT_Raster raster, | - |
1846 | char* pool_base, | - |
1847 | long pool_size ) | - |
1848 | { | - |
1849 | PRaster rast = (PRaster)raster; executed (the execution status of this line is deduced): PRaster rast = (PRaster)raster; | - |
1850 | | - |
1851 | if ( raster ) partially evaluated: raster yes Evaluation Count:16545 | no Evaluation Count:0 |
| 0-16545 |
1852 | { | - |
1853 | if ( pool_base && ( pool_size >= MINIMUM_POOL_SIZE ) ) partially evaluated: pool_base yes Evaluation Count:16545 | no Evaluation Count:0 |
partially evaluated: ( pool_size >= 8192 ) yes Evaluation Count:16545 | no Evaluation Count:0 |
| 0-16545 |
1854 | { | - |
1855 | PWorker worker = (PWorker)pool_base; executed (the execution status of this line is deduced): PWorker worker = (PWorker)pool_base; | - |
1856 | | - |
1857 | | - |
1858 | rast->worker = worker; executed (the execution status of this line is deduced): rast->worker = worker; | - |
1859 | rast->buffer = pool_base + executed (the execution status of this line is deduced): rast->buffer = pool_base + | - |
1860 | ( ( sizeof ( TWorker ) + sizeof ( TCell ) - 1 ) & executed (the execution status of this line is deduced): ( ( sizeof ( TWorker ) + sizeof ( TCell ) - 1 ) & | - |
1861 | ~( sizeof ( TCell ) - 1 ) ); executed (the execution status of this line is deduced): ~( sizeof ( TCell ) - 1 ) ); | - |
1862 | rast->buffer_size = (long)( ( pool_base + pool_size ) - executed (the execution status of this line is deduced): rast->buffer_size = (long)( ( pool_base + pool_size ) - | - |
1863 | (char*)rast->buffer ) & executed (the execution status of this line is deduced): (char*)rast->buffer ) & | - |
1864 | ~( sizeof ( TCell ) - 1 ); executed (the execution status of this line is deduced): ~( sizeof ( TCell ) - 1 ); | - |
1865 | rast->band_size = (int)( rast->buffer_size / executed (the execution status of this line is deduced): rast->band_size = (int)( rast->buffer_size / | - |
1866 | ( sizeof ( TCell ) * 8 ) ); executed (the execution status of this line is deduced): ( sizeof ( TCell ) * 8 ) ); | - |
1867 | } executed: } Execution Count:16545 | 16545 |
1868 | else if ( pool_base) never evaluated: pool_base | 0 |
1869 | { // Case when there is a raster pool allocated, but it | - |
1870 | // doesn't have the minimum size (and so memory will be reallocated) | - |
1871 | rast->buffer = pool_base; never executed (the execution status of this line is deduced): rast->buffer = pool_base; | - |
1872 | rast->worker = NULL; never executed (the execution status of this line is deduced): rast->worker = ((void *)0); | - |
1873 | rast->buffer_size = pool_size; never executed (the execution status of this line is deduced): rast->buffer_size = pool_size; | - |
1874 | } | 0 |
1875 | else | - |
1876 | { | - |
1877 | rast->buffer = NULL; never executed (the execution status of this line is deduced): rast->buffer = ((void *)0); | - |
1878 | rast->buffer_size = 0; never executed (the execution status of this line is deduced): rast->buffer_size = 0; | - |
1879 | rast->worker = NULL; never executed (the execution status of this line is deduced): rast->worker = ((void *)0); | - |
1880 | } | 0 |
1881 | rast->buffer_allocated_size = pool_size; executed (the execution status of this line is deduced): rast->buffer_allocated_size = pool_size; | - |
1882 | } executed: } Execution Count:16545 | 16545 |
1883 | } executed: } Execution Count:16545 | 16545 |
1884 | | - |
1885 | const QT_FT_Raster_Funcs qt_ft_grays_raster = | - |
1886 | { | - |
1887 | QT_FT_GLYPH_FORMAT_OUTLINE, | - |
1888 | | - |
1889 | (QT_FT_Raster_New_Func) gray_raster_new, | - |
1890 | (QT_FT_Raster_Reset_Func) gray_raster_reset, | - |
1891 | (QT_FT_Raster_Set_Mode_Func)0, | - |
1892 | (QT_FT_Raster_Render_Func) gray_raster_render, | - |
1893 | (QT_FT_Raster_Done_Func) gray_raster_done | - |
1894 | }; | - |
1895 | | - |
1896 | /* END */ | - |
1897 | | - |
| | |