Subversion Repositories Kolibri OS

Rev

Rev 1891 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1891 Rev 3931
Line -... Line 1...
-
 
1
#include 
Line 1... Line 2...
1
#ifndef PIXMAN_PRIVATE_H
2
 
2
#define PIXMAN_PRIVATE_H
3
#ifndef PIXMAN_PRIVATE_H
Line -... Line 4...
-
 
4
#define PIXMAN_PRIVATE_H
-
 
5
 
-
 
6
/*
-
 
7
 * The defines which are shared between C and assembly code
-
 
8
 */
-
 
9
 
-
 
10
/* bilinear interpolation precision (must be <= 8) */
-
 
11
#define BILINEAR_INTERPOLATION_BITS 7
-
 
12
#define BILINEAR_INTERPOLATION_RANGE (1 << BILINEAR_INTERPOLATION_BITS)
-
 
13
 
-
 
14
/*
-
 
15
 * C specific part
-
 
16
 */
-
 
17
 
-
 
18
#ifndef __ASSEMBLER__
-
 
19
 
-
 
20
#ifndef PACKAGE
-
 
21
#  error config.h must be included before pixman-private.h
3
 
22
#endif
4
#define PIXMAN_DISABLE_DEPRECATED
23
 
Line 5... Line 24...
5
#define PIXMAN_USE_INTERNAL_API
24
#define PIXMAN_DISABLE_DEPRECATED
6
 
25
#define PIXMAN_USE_INTERNAL_API
7
#include "pixman.h"
26
 
8
#include 
27
#include "pixman.h"
9
#include 
28
#include 
-
 
29
#include 
Line 10... Line 30...
10
#include 
30
#include 
Line 11... Line 31...
11
#include 
31
#include 
12
 
32
#include 
13
#include "pixman-compiler.h"
33
 
14
 
34
#include "pixman-compiler.h"
15
/*
-
 
16
 * Images
35
 
17
 */
36
/*
18
typedef struct image_common image_common_t;
37
 * Images
19
typedef struct source_image source_image_t;
38
 */
20
typedef struct solid_fill solid_fill_t;
39
typedef struct image_common image_common_t;
21
typedef struct gradient gradient_t;
40
typedef struct solid_fill solid_fill_t;
22
typedef struct linear_gradient linear_gradient_t;
41
typedef struct gradient gradient_t;
23
typedef struct horizontal_gradient horizontal_gradient_t;
42
typedef struct linear_gradient linear_gradient_t;
24
typedef struct vertical_gradient vertical_gradient_t;
43
typedef struct horizontal_gradient horizontal_gradient_t;
Line -... Line 44...
-
 
44
typedef struct vertical_gradient vertical_gradient_t;
-
 
45
typedef struct conical_gradient conical_gradient_t;
-
 
46
typedef struct radial_gradient radial_gradient_t;
-
 
47
typedef struct bits_image bits_image_t;
-
 
48
typedef struct circle circle_t;
-
 
49
 
-
 
50
typedef struct argb_t argb_t;
-
 
51
 
-
 
52
struct argb_t
-
 
53
{
25
typedef struct conical_gradient conical_gradient_t;
54
    float a;
26
typedef struct radial_gradient radial_gradient_t;
55
    float r;
27
typedef struct bits_image bits_image_t;
56
    float g;
28
typedef struct circle circle_t;
57
    float b;
29
 
58
};
Line 37... Line 66...
37
typedef uint32_t (*fetch_pixel_32_t) (bits_image_t *image,
66
 
38
				      int           x,
67
typedef uint32_t (*fetch_pixel_32_t) (bits_image_t *image,
39
				      int           y);
68
				      int           x,
Line 40... Line 69...
40
 
69
				      int           y);
41
typedef uint64_t (*fetch_pixel_64_t) (bits_image_t *image,
70
 
42
				      int           x,
71
typedef argb_t (*fetch_pixel_float_t) (bits_image_t *image,
Line 43... Line 72...
43
				      int           y);
72
				       int           x,
44
 
73
				       int           y);
Line 56... Line 85...
56
    RADIAL,
85
    CONICAL,
57
    SOLID
86
    RADIAL,
58
} image_type_t;
87
    SOLID
59
 
88
} image_type_t;
Line 60... Line -...
60
typedef enum
-
 
61
{
-
 
62
    SOURCE_IMAGE_CLASS_UNKNOWN,
-
 
63
    SOURCE_IMAGE_CLASS_HORIZONTAL,
-
 
64
} source_image_class_t;
-
 
65
 
-
 
66
typedef source_image_class_t (*classify_func_t) (pixman_image_t *image,
-
 
67
						int             x,
-
 
68
						int             y,
-
 
69
						int             width,
-
 
70
						int             height);
-
 
71
typedef void (*property_changed_func_t) (pixman_image_t *image);
89
 
Line 72... Line 90...
72
 
90
typedef void (*property_changed_func_t) (pixman_image_t *image);
73
struct image_common
91
 
74
{
92
struct image_common
Line 91... Line 109...
91
    bits_image_t *              alpha_map;
109
    int                         n_filter_params;
92
    int                         alpha_origin_x;
110
    bits_image_t *              alpha_map;
93
    int                         alpha_origin_y;
111
    int                         alpha_origin_x;
94
    pixman_bool_t               component_alpha;
112
    int                         alpha_origin_y;
95
    classify_func_t             classify;
113
    pixman_bool_t               component_alpha;
96
    property_changed_func_t     property_changed;
-
 
97
    fetch_scanline_t            get_scanline_32;
114
    property_changed_func_t     property_changed;
98
    fetch_scanline_t            get_scanline_64;
-
 
99
 
-
 
Line 100... Line 115...
100
    pixman_image_destroy_func_t destroy_func;
115
 
101
    void *                      destroy_data;
116
    pixman_image_destroy_func_t destroy_func;
Line 102... Line 117...
102
 
117
    void *                      destroy_data;
103
    uint32_t			flags;
118
 
104
    pixman_format_code_t	extended_format_code;
119
    uint32_t			flags;
Line 105... Line -...
105
};
-
 
106
 
-
 
107
struct source_image
-
 
108
{
-
 
109
    image_common_t common;
-
 
110
};
120
    pixman_format_code_t	extended_format_code;
111
 
121
};
112
struct solid_fill
122
 
113
{
123
struct solid_fill
Line 114... Line 124...
114
    source_image_t common;
124
{
115
    pixman_color_t color;
125
    image_common_t common;
116
 
126
    pixman_color_t color;
Line 117... Line 127...
117
    uint32_t	   color_32;
127
 
118
    uint64_t	   color_64;
128
    uint32_t	   color_32;
119
};
129
    argb_t	   color_float;
120
 
130
};
121
struct gradient
131
 
122
{
-
 
123
    source_image_t          common;
132
struct gradient
Line 124... Line 133...
124
    int                     n_stops;
133
{
125
    pixman_gradient_stop_t *stops;
134
    image_common_t	    common;
126
    int                     stop_range;
135
    int                     n_stops;
Line 174... Line 183...
174
    fetch_scanline_t           fetch_scanline_32;
183
 
175
    fetch_pixel_32_t	       fetch_pixel_32;
184
    fetch_scanline_t           fetch_scanline_32;
176
    store_scanline_t           store_scanline_32;
185
    fetch_pixel_32_t	       fetch_pixel_32;
Line 177... Line 186...
177
 
186
    store_scanline_t           store_scanline_32;
178
    fetch_scanline_t           fetch_scanline_64;
187
 
179
    fetch_pixel_64_t	       fetch_pixel_64;
188
    fetch_scanline_t	       fetch_scanline_float;
Line 180... Line 189...
180
    store_scanline_t           store_scanline_64;
189
    fetch_pixel_float_t	       fetch_pixel_float;
181
 
190
    store_scanline_t           store_scanline_float;
182
    /* Used for indirect access to the bits */
191
 
183
    pixman_read_memory_func_t  read_func;
192
    /* Used for indirect access to the bits */
Line 188... Line 197...
188
{
197
union pixman_image
189
    image_type_t       type;
198
{
190
    image_common_t     common;
199
    image_type_t       type;
191
    bits_image_t       bits;
200
    image_common_t     common;
192
    source_image_t     source;
201
    bits_image_t       bits;
193
    gradient_t         gradient;
-
 
194
    linear_gradient_t  linear;
202
    gradient_t         gradient;
195
    conical_gradient_t conical;
203
    linear_gradient_t  linear;
196
    radial_gradient_t  radial;
204
    conical_gradient_t conical;
197
    solid_fill_t       solid;
205
    radial_gradient_t  radial;
198
};
206
    solid_fill_t       solid;
199
 
207
};
Line -... Line 208...
-
 
208
 
-
 
209
typedef struct pixman_iter_t pixman_iter_t;
-
 
210
typedef uint32_t *(* pixman_iter_get_scanline_t) (pixman_iter_t *iter, const uint32_t *mask);
-
 
211
typedef void      (* pixman_iter_write_back_t)   (pixman_iter_t *iter);
-
 
212
 
-
 
213
typedef enum
-
 
214
{
-
 
215
    ITER_NARROW =		(1 << 0),
-
 
216
 
-
 
217
    /* "Localized alpha" is when the alpha channel is used only to compute
-
 
218
     * the alpha value of the destination. This means that the computation
-
 
219
     * of the RGB values of the result is independent of the alpha value.
-
 
220
     *
-
 
221
     * For example, the OVER operator has localized alpha for the
-
 
222
     * destination, because the RGB values of the result can be computed
-
 
223
     * without knowing the destination alpha. Similarly, ADD has localized
-
 
224
     * alpha for both source and destination because the RGB values of the
-
 
225
     * result can be computed without knowing the alpha value of source or
-
 
226
     * destination.
-
 
227
     *
-
 
228
     * When he destination is xRGB, this is useful knowledge, because then
-
 
229
     * we can treat it as if it were ARGB, which means in some cases we can
-
 
230
     * avoid copying it to a temporary buffer.
-
 
231
     */
-
 
232
    ITER_LOCALIZED_ALPHA =	(1 << 1),
-
 
233
    ITER_IGNORE_ALPHA =		(1 << 2),
-
 
234
    ITER_IGNORE_RGB =		(1 << 3)
-
 
235
} iter_flags_t;
-
 
236
 
-
 
237
struct pixman_iter_t
-
 
238
{
-
 
239
    /* These are initialized by _pixman_implementation_{src,dest}_init */
-
 
240
    pixman_image_t *		image;
-
 
241
    uint32_t *			buffer;
-
 
242
    int				x, y;
-
 
243
    int				width;
-
 
244
    int				height;
-
 
245
    iter_flags_t		iter_flags;
-
 
246
    uint32_t			image_flags;
-
 
247
 
-
 
248
    /* These function pointers are initialized by the implementation */
-
 
249
    pixman_iter_get_scanline_t	get_scanline;
-
 
250
    pixman_iter_write_back_t	write_back;
-
 
251
 
-
 
252
    /* These fields are scratch data that implementations can use */
-
 
253
    void *			data;
-
 
254
    uint8_t *			bits;
-
 
255
    int				stride;
-
 
256
};
200
void
257
 
201
_pixman_bits_image_setup_accessors (bits_image_t *image);
258
void
Line 202... Line 259...
202
 
259
_pixman_bits_image_setup_accessors (bits_image_t *image);
203
void
260
 
204
_pixman_image_get_scanline_generic_64  (pixman_image_t *image,
-
 
205
                                        int             x,
-
 
206
                                        int             y,
-
 
207
                                        int             width,
-
 
208
                                        uint32_t *      buffer,
-
 
Line 209... Line 261...
209
                                        const uint32_t *mask);
261
void
210
 
262
_pixman_bits_image_src_iter_init (pixman_image_t *image, pixman_iter_t *iter);
211
source_image_class_t
-
 
212
_pixman_image_classify (pixman_image_t *image,
-
 
213
                        int             x,
-
 
214
                        int             y,
-
 
Line 215... Line 263...
215
                        int             width,
263
 
216
                        int             height);
264
void
217
 
-
 
218
void
-
 
219
_pixman_image_get_scanline_32 (pixman_image_t *image,
-
 
220
                               int             x,
-
 
221
                               int             y,
-
 
Line 222... Line -...
222
                               int             width,
-
 
223
                               uint32_t *      buffer,
-
 
224
                               const uint32_t *mask);
-
 
225
 
265
_pixman_bits_image_dest_iter_init (pixman_image_t *image, pixman_iter_t *iter);
226
/* Even thought the type of buffer is uint32_t *, the function actually expects
266
 
227
 * a uint64_t *buffer.
-
 
228
 */
-
 
229
void
-
 
230
_pixman_image_get_scanline_64 (pixman_image_t *image,
-
 
231
                               int             x,
-
 
Line 232... Line 267...
232
                               int             y,
267
void
233
                               int             width,
268
_pixman_linear_gradient_iter_init (pixman_image_t *image, pixman_iter_t  *iter);
234
                               uint32_t *      buffer,
-
 
235
                               const uint32_t *unused);
-
 
236
 
-
 
237
void
-
 
Line 238... Line -...
238
_pixman_image_store_scanline_32 (bits_image_t *  image,
-
 
239
                                 int             x,
-
 
240
                                 int             y,
-
 
241
                                 int             width,
269
 
242
                                 const uint32_t *buffer);
270
void
-
 
271
_pixman_radial_gradient_iter_init (pixman_image_t *image, pixman_iter_t *iter);
-
 
272
 
243
 
273
void
244
/* Even though the type of buffer is uint32_t *, the function
274
_pixman_conical_gradient_iter_init (pixman_image_t *image, pixman_iter_t *iter);
245
 * actually expects a uint64_t *buffer.
275
 
-
 
276
void
-
 
277
_pixman_image_init (pixman_image_t *image);
246
 */
278
 
-
 
279
pixman_bool_t
-
 
280
_pixman_bits_image_init (pixman_image_t *     image,
-
 
281
                         pixman_format_code_t format,
Line 247... Line 282...
247
void
282
                         int                  width,
248
_pixman_image_store_scanline_64 (bits_image_t *  image,
283
                         int                  height,
Line 249... Line 284...
249
                                 int             x,
284
                         uint32_t *           bits,
Line 263... Line 298...
263
 
298
_pixman_image_reset_clip_region (pixman_image_t *image);
Line 264... Line 299...
264
void
299
 
265
_pixman_image_validate (pixman_image_t *image);
300
void
Line 266... Line -...
266
 
-
 
267
uint32_t
-
 
268
_pixman_image_get_solid (pixman_image_t *     image,
-
 
269
                         pixman_format_code_t format);
-
 
270
 
301
_pixman_image_validate (pixman_image_t *image);
271
#define PIXMAN_IMAGE_GET_LINE(image, x, y, type, out_stride, line, mul)	\
302
 
272
    do									\
303
#define PIXMAN_IMAGE_GET_LINE(image, x, y, type, out_stride, line, mul)	\
273
    {									\
304
    do									\
274
	uint32_t *__bits__;						\
305
    {									\
Line 286... Line 317...
286
 * Gradient walker
317
/*
287
 */
318
 * Gradient walker
288
typedef struct
319
 */
289
{
320
typedef struct
290
    uint32_t                left_ag;
321
{
291
    uint32_t                left_rb;
322
    float		    a_s, a_b;
292
    uint32_t                right_ag;
323
    float		    r_s, r_b;
293
    uint32_t                right_rb;
324
    float		    g_s, g_b;
294
    int32_t                 left_x;
325
    float		    b_s, b_b;
295
    int32_t                 right_x;
326
    pixman_fixed_t	    left_x;
296
    int32_t                 stepper;
327
    pixman_fixed_t          right_x;
297
 
-
 
Line 298... Line 328...
298
    pixman_gradient_stop_t *stops;
328
 
299
    int                     num_stops;
329
    pixman_gradient_stop_t *stops;
300
    unsigned int            spread;
330
    int                     num_stops;
Line 301... Line 331...
301
 
331
    pixman_repeat_t	    repeat;
302
    int                     need_reset;
332
 
Line 303... Line 333...
303
} pixman_gradient_walker_t;
333
    pixman_bool_t           need_reset;
304
 
334
} pixman_gradient_walker_t;
305
void
335
 
306
_pixman_gradient_walker_init (pixman_gradient_walker_t *walker,
336
void
Line 307... Line 337...
307
                              gradient_t *              gradient,
337
_pixman_gradient_walker_init (pixman_gradient_walker_t *walker,
308
                              unsigned int              spread);
338
                              gradient_t *              gradient,
309
 
339
			      pixman_repeat_t           repeat);
Line 310... Line 340...
310
void
340
 
311
_pixman_gradient_walker_reset (pixman_gradient_walker_t *walker,
341
void
312
                               pixman_fixed_32_32_t      pos);
342
_pixman_gradient_walker_reset (pixman_gradient_walker_t *walker,
Line 313... Line 343...
313
 
343
                               pixman_fixed_48_16_t      pos);
314
uint32_t
344
 
315
_pixman_gradient_walker_pixel (pixman_gradient_walker_t *walker,
345
uint32_t
Line 350... Line 380...
350
 * Implementations
380
/*
351
 */
381
 * Implementations
352
typedef struct pixman_implementation_t pixman_implementation_t;
382
 */
353
 
383
typedef struct pixman_implementation_t pixman_implementation_t;
Line -... Line 384...
-
 
384
 
-
 
385
typedef struct
-
 
386
{
-
 
387
    pixman_op_t              op;
-
 
388
    pixman_image_t *         src_image;
-
 
389
    pixman_image_t *         mask_image;
-
 
390
    pixman_image_t *         dest_image;
-
 
391
    int32_t                  src_x;
-
 
392
    int32_t                  src_y;
-
 
393
    int32_t                  mask_x;
-
 
394
    int32_t                  mask_y;
-
 
395
    int32_t                  dest_x;
-
 
396
    int32_t                  dest_y;
-
 
397
    int32_t                  width;
-
 
398
    int32_t                  height;
-
 
399
 
-
 
400
    uint32_t                 src_flags;
-
 
401
    uint32_t                 mask_flags;
-
 
402
    uint32_t                 dest_flags;
-
 
403
} pixman_composite_info_t;
-
 
404
 
-
 
405
#define PIXMAN_COMPOSITE_ARGS(info)					\
-
 
406
    MAYBE_UNUSED pixman_op_t        op = info->op;			\
-
 
407
    MAYBE_UNUSED pixman_image_t *   src_image = info->src_image;	\
-
 
408
    MAYBE_UNUSED pixman_image_t *   mask_image = info->mask_image;	\
-
 
409
    MAYBE_UNUSED pixman_image_t *   dest_image = info->dest_image;	\
-
 
410
    MAYBE_UNUSED int32_t            src_x = info->src_x;		\
-
 
411
    MAYBE_UNUSED int32_t            src_y = info->src_y;		\
-
 
412
    MAYBE_UNUSED int32_t            mask_x = info->mask_x;		\
-
 
413
    MAYBE_UNUSED int32_t            mask_y = info->mask_y;		\
-
 
414
    MAYBE_UNUSED int32_t            dest_x = info->dest_x;		\
-
 
415
    MAYBE_UNUSED int32_t            dest_y = info->dest_y;		\
-
 
416
    MAYBE_UNUSED int32_t            width = info->width;		\
-
 
417
    MAYBE_UNUSED int32_t            height = info->height
354
typedef void (*pixman_combine_32_func_t) (pixman_implementation_t *imp,
418
 
355
					  pixman_op_t              op,
419
typedef void (*pixman_combine_32_func_t) (pixman_implementation_t *imp,
356
					  uint32_t *               dest,
420
					  pixman_op_t              op,
357
					  const uint32_t *         src,
421
					  uint32_t *               dest,
358
					  const uint32_t *         mask,
422
					  const uint32_t *         src,
359
					  int                      width);
423
					  const uint32_t *         mask,
Line 360... Line 424...
360
 
424
					  int                      width);
361
typedef void (*pixman_combine_64_func_t) (pixman_implementation_t *imp,
425
 
362
					  pixman_op_t              op,
426
typedef void (*pixman_combine_float_func_t) (pixman_implementation_t *imp,
363
					  uint64_t *               dest,
427
					     pixman_op_t	      op,
364
					  const uint64_t *         src,
428
					     float *		      dest,
365
					  const uint64_t *         mask,
429
					     const float *	      src,
Line 366... Line 430...
366
					  int                      width);
430
					     const float *	      mask,
367
 
431
					     int		      n_pixels);
368
typedef void (*pixman_composite_func_t) (pixman_implementation_t *imp,
-
 
369
					 pixman_op_t              op,
-
 
370
					 pixman_image_t *         src,
-
 
371
					 pixman_image_t *         mask,
-
 
372
					 pixman_image_t *         dest,
-
 
373
					 int32_t                  src_x,
-
 
374
					 int32_t                  src_y,
-
 
375
					 int32_t                  mask_x,
-
 
376
					 int32_t                  mask_y,
-
 
377
					 int32_t                  dest_x,
-
 
378
					 int32_t                  dest_y,
-
 
379
					 int32_t                  width,
432
 
380
					 int32_t                  height);
433
typedef void (*pixman_composite_func_t) (pixman_implementation_t *imp,
381
typedef pixman_bool_t (*pixman_blt_func_t) (pixman_implementation_t *imp,
434
					 pixman_composite_info_t *info);
382
					    uint32_t *               src_bits,
435
typedef pixman_bool_t (*pixman_blt_func_t) (pixman_implementation_t *imp,
383
					    uint32_t *               dst_bits,
436
					    uint32_t *               src_bits,
384
					    int                      src_stride,
437
					    uint32_t *               dst_bits,
385
					    int                      dst_stride,
438
					    int                      src_stride,
386
					    int                      src_bpp,
439
					    int                      dst_stride,
387
					    int                      dst_bpp,
440
					    int                      src_bpp,
388
					    int                      src_x,
441
					    int                      dst_bpp,
389
					    int                      src_y,
442
					    int                      src_x,
390
					    int                      dst_x,
443
					    int                      src_y,
391
					    int                      dst_y,
444
					    int                      dest_x,
392
					    int                      width,
445
					    int                      dest_y,
393
					    int                      height);
446
					    int                      width,
394
typedef pixman_bool_t (*pixman_fill_func_t) (pixman_implementation_t *imp,
447
					    int                      height);
395
					     uint32_t *               bits,
448
typedef pixman_bool_t (*pixman_fill_func_t) (pixman_implementation_t *imp,
396
					     int                      stride,
449
					     uint32_t *               bits,
397
					     int                      bpp,
450
					     int                      stride,
398
					     int                      x,
451
					     int                      bpp,
399
					     int                      y,
452
					     int                      x,
400
					     int                      width,
453
					     int                      y,
-
 
454
					     int                      width,
-
 
455
					     int                      height,
Line 401... Line 456...
401
					     int                      height,
456
					     uint32_t                 filler);
402
					     uint32_t                 xor);
457
typedef pixman_bool_t (*pixman_iter_init_func_t) (pixman_implementation_t *imp,
Line 403... Line 458...
403
 
458
						  pixman_iter_t           *iter);
404
void _pixman_setup_combiner_functions_32 (pixman_implementation_t *imp);
459
 
405
void _pixman_setup_combiner_functions_64 (pixman_implementation_t *imp);
460
void _pixman_setup_combiner_functions_32 (pixman_implementation_t *imp);
406
 
461
void _pixman_setup_combiner_functions_float (pixman_implementation_t *imp);
Line 418... Line 473...
418
 
473
} pixman_fast_path_t;
Line 419... Line 474...
419
struct pixman_implementation_t
474
 
420
{
475
struct pixman_implementation_t
421
    pixman_implementation_t *	toplevel;
476
{
422
    pixman_implementation_t *	delegate;
477
    pixman_implementation_t *	toplevel;
423
    const pixman_fast_path_t *	fast_paths;
478
    pixman_implementation_t *	fallback;
Line 424... Line 479...
424
 
479
    const pixman_fast_path_t *	fast_paths;
425
    pixman_blt_func_t		blt;
480
 
-
 
481
    pixman_blt_func_t		blt;
-
 
482
    pixman_fill_func_t		fill;
Line 426... Line 483...
426
    pixman_fill_func_t		fill;
483
    pixman_iter_init_func_t     src_iter_init;
427
 
484
    pixman_iter_init_func_t     dest_iter_init;
428
    pixman_combine_32_func_t	combine_32[PIXMAN_N_OPERATORS];
485
 
429
    pixman_combine_32_func_t	combine_32_ca[PIXMAN_N_OPERATORS];
486
    pixman_combine_32_func_t	combine_32[PIXMAN_N_OPERATORS];
430
    pixman_combine_64_func_t	combine_64[PIXMAN_N_OPERATORS];
487
    pixman_combine_32_func_t	combine_32_ca[PIXMAN_N_OPERATORS];
Line -... Line 488...
-
 
488
    pixman_combine_float_func_t	combine_float[PIXMAN_N_OPERATORS];
-
 
489
    pixman_combine_float_func_t	combine_float_ca[PIXMAN_N_OPERATORS];
-
 
490
};
-
 
491
 
-
 
492
uint32_t
431
    pixman_combine_64_func_t	combine_64_ca[PIXMAN_N_OPERATORS];
493
_pixman_image_get_solid (pixman_implementation_t *imp,
432
};
494
			 pixman_image_t *         image,
433
 
495
                         pixman_format_code_t     format);
Line 434... Line 496...
434
pixman_implementation_t *
496
 
435
_pixman_implementation_create (pixman_implementation_t *delegate,
497
pixman_implementation_t *
436
			       const pixman_fast_path_t *fast_paths);
-
 
437
 
-
 
438
void
-
 
439
_pixman_implementation_combine_32 (pixman_implementation_t *imp,
-
 
440
                                   pixman_op_t              op,
-
 
441
                                   uint32_t *               dest,
-
 
442
                                   const uint32_t *         src,
-
 
443
                                   const uint32_t *         mask,
-
 
444
                                   int                      width);
-
 
445
void
-
 
446
_pixman_implementation_combine_64 (pixman_implementation_t *imp,
-
 
447
                                   pixman_op_t              op,
-
 
448
                                   uint64_t *               dest,
-
 
449
                                   const uint64_t *         src,
-
 
450
                                   const uint64_t *         mask,
498
_pixman_implementation_create (pixman_implementation_t *fallback,
-
 
499
			       const pixman_fast_path_t *fast_paths);
451
                                   int                      width);
500
 
-
 
501
void
452
void
502
_pixman_implementation_lookup_composite (pixman_implementation_t  *toplevel,
453
_pixman_implementation_combine_32_ca (pixman_implementation_t *imp,
503
					 pixman_op_t               op,
454
                                      pixman_op_t              op,
504
					 pixman_format_code_t      src_format,
-
 
505
					 uint32_t                  src_flags,
-
 
506
					 pixman_format_code_t      mask_format,
455
                                      uint32_t *               dest,
507
					 uint32_t                  mask_flags,
-
 
508
					 pixman_format_code_t      dest_format,
456
                                      const uint32_t *         src,
509
					 uint32_t                  dest_flags,
457
                                      const uint32_t *         mask,
510
					 pixman_implementation_t **out_imp,
458
                                      int                      width);
-
 
459
void
-
 
460
_pixman_implementation_combine_64_ca (pixman_implementation_t *imp,
511
					 pixman_composite_func_t  *out_func);
461
                                      pixman_op_t              op,
512
 
Line 462... Line 513...
462
                                      uint64_t *               dest,
513
pixman_combine_32_func_t
463
                                      const uint64_t *         src,
514
_pixman_implementation_lookup_combiner (pixman_implementation_t *imp,
464
                                      const uint64_t *         mask,
515
					pixman_op_t		 op,
465
                                      int                      width);
516
					pixman_bool_t		 component_alpha,
Line 473... Line 524...
473
                            int                      src_bpp,
524
                            int                      dst_stride,
474
                            int                      dst_bpp,
525
                            int                      src_bpp,
475
                            int                      src_x,
526
                            int                      dst_bpp,
476
                            int                      src_y,
527
                            int                      src_x,
477
                            int                      dst_x,
528
                            int                      src_y,
478
                            int                      dst_y,
529
                            int                      dest_x,
479
                            int                      width,
530
                            int                      dest_y,
480
                            int                      height);
531
                            int                      width,
481
 
532
                            int                      height);
Line 482... Line 533...
482
pixman_bool_t
533
 
483
_pixman_implementation_fill (pixman_implementation_t *imp,
534
pixman_bool_t
Line 487... Line 538...
487
                             int                      x,
538
                             int                      bpp,
488
                             int                      y,
539
                             int                      x,
489
                             int                      width,
540
                             int                      y,
490
                             int                      height,
541
                             int                      width,
491
                             uint32_t                 xor);
542
                             int                      height,
492
 
543
                             uint32_t                 filler);
-
 
544
 
-
 
545
pixman_bool_t
-
 
546
_pixman_implementation_src_iter_init (pixman_implementation_t       *imp,
-
 
547
				      pixman_iter_t                 *iter,
-
 
548
				      pixman_image_t                *image,
-
 
549
				      int                            x,
-
 
550
				      int                            y,
-
 
551
				      int                            width,
-
 
552
				      int                            height,
-
 
553
				      uint8_t                       *buffer,
-
 
554
				      iter_flags_t                   flags,
-
 
555
				      uint32_t                       image_flags);
-
 
556
 
-
 
557
pixman_bool_t
-
 
558
_pixman_implementation_dest_iter_init (pixman_implementation_t       *imp,
-
 
559
				       pixman_iter_t                 *iter,
-
 
560
				       pixman_image_t                *image,
-
 
561
				       int                            x,
-
 
562
				       int                            y,
-
 
563
				       int                            width,
-
 
564
				       int                            height,
-
 
565
				       uint8_t                       *buffer,
-
 
566
				       iter_flags_t                   flags,
-
 
567
				       uint32_t                       image_flags);
Line 493... Line 568...
493
/* Specific implementations */
568
 
494
pixman_implementation_t *
569
/* Specific implementations */
495
_pixman_implementation_create_general (void);
570
pixman_implementation_t *
Line 496... Line 571...
496
 
571
_pixman_implementation_create_general (void);
497
pixman_implementation_t *
572
 
Line 498... Line -...
498
_pixman_implementation_create_fast_path (void);
-
 
499
 
573
pixman_implementation_t *
-
 
574
_pixman_implementation_create_fast_path (pixman_implementation_t *fallback);
-
 
575
 
-
 
576
pixman_implementation_t *
500
#ifdef USE_MMX
577
_pixman_implementation_create_noop (pixman_implementation_t *fallback);
-
 
578
 
501
pixman_implementation_t *
579
#if defined USE_X86_MMX || defined USE_ARM_IWMMXT || defined USE_LOONGSON_MMI
Line 502... Line 580...
502
_pixman_implementation_create_mmx (void);
580
pixman_implementation_t *
503
#endif
581
_pixman_implementation_create_mmx (pixman_implementation_t *fallback);
504
 
582
#endif
505
#ifdef USE_SSE2
583
 
Line 506... Line 584...
506
pixman_implementation_t *
584
#ifdef USE_SSE2
507
_pixman_implementation_create_sse2 (void);
585
pixman_implementation_t *
508
#endif
586
_pixman_implementation_create_sse2 (pixman_implementation_t *fallback);
509
 
587
#endif
Line 510... Line 588...
510
#ifdef USE_ARM_SIMD
588
 
511
pixman_implementation_t *
589
#ifdef USE_ARM_SIMD
512
_pixman_implementation_create_arm_simd (void);
590
pixman_implementation_t *
-
 
591
_pixman_implementation_create_arm_simd (pixman_implementation_t *fallback);
-
 
592
#endif
-
 
593
 
-
 
594
#ifdef USE_ARM_NEON
-
 
595
pixman_implementation_t *
513
#endif
596
_pixman_implementation_create_arm_neon (pixman_implementation_t *fallback);
Line 514... Line 597...
514
 
597
#endif
515
#ifdef USE_ARM_NEON
598
 
516
pixman_implementation_t *
599
#ifdef USE_MIPS_DSPR2
517
_pixman_implementation_create_arm_neon (void);
600
pixman_implementation_t *
Line -... Line 601...
-
 
601
_pixman_implementation_create_mips_dspr2 (pixman_implementation_t *fallback);
-
 
602
#endif
-
 
603
 
-
 
604
#ifdef USE_VMX
-
 
605
pixman_implementation_t *
-
 
606
_pixman_implementation_create_vmx (pixman_implementation_t *fallback);
-
 
607
#endif
-
 
608
 
-
 
609
pixman_bool_t
-
 
610
_pixman_implementation_disabled (const char *name);
-
 
611
 
-
 
612
pixman_implementation_t *
-
 
613
_pixman_x86_get_implementations (pixman_implementation_t *imp);
-
 
614
 
-
 
615
pixman_implementation_t *
518
#endif
616
_pixman_arm_get_implementations (pixman_implementation_t *imp);
519
 
617
 
Line -... Line 618...
-
 
618
pixman_implementation_t *
-
 
619
_pixman_ppc_get_implementations (pixman_implementation_t *imp);
Line 520... Line 620...
520
#ifdef USE_VMX
620
 
521
pixman_implementation_t *
621
pixman_implementation_t *
522
_pixman_implementation_create_vmx (void);
622
_pixman_mips_get_implementations (pixman_implementation_t *imp);
-
 
623
 
-
 
624
pixman_implementation_t *
-
 
625
_pixman_choose_implementation (void);
-
 
626
 
-
 
627
pixman_bool_t
-
 
628
_pixman_disabled (const char *name);
-
 
629
 
-
 
630
 
-
 
631
/*
-
 
632
 * Utilities
-
 
633
 */
-
 
634
pixman_bool_t
-
 
635
_pixman_compute_composite_region32 (pixman_region32_t * region,
-
 
636
				    pixman_image_t *    src_image,
-
 
637
				    pixman_image_t *    mask_image,
Line 523... Line 638...
523
#endif
638
				    pixman_image_t *    dest_image,
524
 
639
				    int32_t             src_x,
525
pixman_implementation_t *
640
				    int32_t             src_y,
526
_pixman_choose_implementation (void);
641
				    int32_t             mask_x,
Line 556... Line 671...
556
#define FAST_PATH_SCALE_TRANSFORM		(1 << 10)
671
#define FAST_PATH_UNIFIED_ALPHA			(1 <<  9)
557
#define FAST_PATH_NEAREST_FILTER		(1 << 11)
672
#define FAST_PATH_SCALE_TRANSFORM		(1 << 10)
558
#define FAST_PATH_HAS_TRANSFORM			(1 << 12)
673
#define FAST_PATH_NEAREST_FILTER		(1 << 11)
559
#define FAST_PATH_IS_OPAQUE			(1 << 13)
674
#define FAST_PATH_HAS_TRANSFORM			(1 << 12)
560
#define FAST_PATH_NEEDS_WORKAROUND		(1 << 14)
675
#define FAST_PATH_IS_OPAQUE			(1 << 13)
561
#define FAST_PATH_NO_NONE_REPEAT		(1 << 15)
676
#define FAST_PATH_NO_NORMAL_REPEAT		(1 << 14)
562
#define FAST_PATH_SAMPLES_COVER_CLIP		(1 << 16)
677
#define FAST_PATH_NO_NONE_REPEAT		(1 << 15)
563
#define FAST_PATH_X_UNIT_POSITIVE		(1 << 17)
678
#define FAST_PATH_X_UNIT_POSITIVE		(1 << 16)
-
 
679
#define FAST_PATH_AFFINE_TRANSFORM		(1 << 17)
564
#define FAST_PATH_AFFINE_TRANSFORM		(1 << 18)
680
#define FAST_PATH_Y_UNIT_ZERO			(1 << 18)
-
 
681
#define FAST_PATH_BILINEAR_FILTER		(1 << 19)
565
#define FAST_PATH_Y_UNIT_ZERO			(1 << 19)
682
#define FAST_PATH_ROTATE_90_TRANSFORM		(1 << 20)
566
#define FAST_PATH_BILINEAR_FILTER		(1 << 20)
683
#define FAST_PATH_ROTATE_180_TRANSFORM		(1 << 21)
567
#define FAST_PATH_NO_NORMAL_REPEAT		(1 << 21)
684
#define FAST_PATH_ROTATE_270_TRANSFORM		(1 << 22)
-
 
685
#define FAST_PATH_SAMPLES_COVER_CLIP_NEAREST	(1 << 23)
-
 
686
#define FAST_PATH_SAMPLES_COVER_CLIP_BILINEAR	(1 << 24)
568
 
687
#define FAST_PATH_BITS_IMAGE			(1 << 25)
-
 
688
#define FAST_PATH_SEPARABLE_CONVOLUTION_FILTER  (1 << 26)
Line 569... Line 689...
569
#define FAST_PATH_PAD_REPEAT						\
689
 
570
    (FAST_PATH_NO_NONE_REPEAT		|				\
690
#define FAST_PATH_PAD_REPEAT						\
571
     FAST_PATH_NO_NORMAL_REPEAT		|				\
691
    (FAST_PATH_NO_NONE_REPEAT		|				\
572
     FAST_PATH_NO_REFLECT_REPEAT)
692
     FAST_PATH_NO_NORMAL_REPEAT		|				\
Line 599... Line 719...
599
 
719
     FAST_PATH_NARROW_FORMAT)
Line 600... Line 720...
600
#define SOURCE_FLAGS(format)						\
720
 
601
    (FAST_PATH_STANDARD_FLAGS |						\
721
#define SOURCE_FLAGS(format)						\
602
     ((PIXMAN_ ## format == PIXMAN_solid) ?				\
722
    (FAST_PATH_STANDARD_FLAGS |						\
603
      0 : (FAST_PATH_SAMPLES_COVER_CLIP | FAST_PATH_ID_TRANSFORM)))
723
     ((PIXMAN_ ## format == PIXMAN_solid) ?				\
Line 604... Line 724...
604
 
724
      0 : (FAST_PATH_SAMPLES_COVER_CLIP_NEAREST | FAST_PATH_NEAREST_FILTER | FAST_PATH_ID_TRANSFORM)))
605
#define MASK_FLAGS(format, extra)					\
725
 
Line 606... Line 726...
606
    ((PIXMAN_ ## format == PIXMAN_null) ? 0 : (SOURCE_FLAGS (format) | extra))
726
#define MASK_FLAGS(format, extra)					\
Line 630... Line 750...
630
	    mask, MASK_FLAGS (mask, FAST_PATH_COMPONENT_ALPHA),		\
750
	    src,  SOURCE_FLAGS (src),					\
631
	    dest, FAST_PATH_STD_DEST_FLAGS,				\
751
	    mask, MASK_FLAGS (mask, FAST_PATH_COMPONENT_ALPHA),		\
632
	    func) }
752
	    dest, FAST_PATH_STD_DEST_FLAGS,				\
633
 
753
	    func) }
Line -... Line 754...
-
 
754
 
-
 
755
extern pixman_implementation_t *global_implementation;
-
 
756
 
-
 
757
static force_inline pixman_implementation_t *
-
 
758
get_implementation (void)
-
 
759
{
-
 
760
#ifndef TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR
-
 
761
    if (!global_implementation)
-
 
762
	global_implementation = _pixman_choose_implementation ();
-
 
763
#endif
-
 
764
    return global_implementation;
-
 
765
}
-
 
766
 
-
 
767
/* This function is exported for the sake of the test suite and not part
-
 
768
 * of the ABI.
-
 
769
 */
-
 
770
PIXMAN_EXPORT pixman_implementation_t *
-
 
771
_pixman_internal_only_get_implementation (void);
634
/* Memory allocation helpers */
772
 
635
void *
773
/* Memory allocation helpers */
636
pixman_malloc_ab (unsigned int n, unsigned int b);
774
void *
Line 637... Line 775...
637
 
775
pixman_malloc_ab (unsigned int n, unsigned int b);
638
void *
776
 
Line 639... Line 777...
639
pixman_malloc_abc (unsigned int a, unsigned int b, unsigned int c);
777
void *
-
 
778
pixman_malloc_abc (unsigned int a, unsigned int b, unsigned int c);
-
 
779
 
-
 
780
pixman_bool_t
640
 
781
_pixman_multiply_overflows_size (size_t a, size_t b);
Line 641... Line 782...
641
pixman_bool_t
782
 
642
pixman_multiply_overflows_int (unsigned int a, unsigned int b);
783
pixman_bool_t
Line 643... Line 784...
643
 
784
_pixman_multiply_overflows_int (unsigned int a, unsigned int b);
644
pixman_bool_t
785
 
645
pixman_addition_overflows_int (unsigned int a, unsigned int b);
786
pixman_bool_t
646
 
787
_pixman_addition_overflows_int (unsigned int a, unsigned int b);
647
/* Compositing utilities */
788
 
648
void
789
/* Compositing utilities */
Line 649... Line 790...
649
pixman_expand (uint64_t *           dst,
790
void
650
               const uint32_t *     src,
791
pixman_expand_to_float (argb_t               *dst,
651
               pixman_format_code_t format,
792
			const uint32_t       *src,
652
               int                  width);
793
			pixman_format_code_t  format,
Line 653... Line -...
653
 
-
 
654
void
794
			int                   width);
655
pixman_contract (uint32_t *      dst,
795
 
656
                 const uint64_t *src,
796
void
657
                 int             width);
797
pixman_contract_from_float (uint32_t     *dst,
Line 658... Line 798...
658
 
798
			    const argb_t *src,
659
 
799
			    int           width);
660
/* Region Helpers */
800
 
Line -... Line 801...
-
 
801
/* Region Helpers */
-
 
802
pixman_bool_t
-
 
803
pixman_region32_copy_from_region16 (pixman_region32_t *dst,
-
 
804
                                    pixman_region16_t *src);
-
 
805
 
-
 
806
pixman_bool_t
-
 
807
pixman_region16_copy_from_region32 (pixman_region16_t *dst,
-
 
808
                                    pixman_region32_t *src);
-
 
809
 
-
 
810
/* Doubly linked lists */
-
 
811
typedef struct pixman_link_t pixman_link_t;
-
 
812
struct pixman_link_t
-
 
813
{
-
 
814
    pixman_link_t *next;
-
 
815
    pixman_link_t *prev;
-
 
816
};
-
 
817
 
-
 
818
typedef struct pixman_list_t pixman_list_t;
-
 
819
struct pixman_list_t
-
 
820
{
-
 
821
    pixman_link_t *head;
-
 
822
    pixman_link_t *tail;
-
 
823
};
-
 
824
 
-
 
825
static force_inline void
-
 
826
pixman_list_init (pixman_list_t *list)
-
 
827
{
-
 
828
    list->head = (pixman_link_t *)list;
-
 
829
    list->tail = (pixman_link_t *)list;
-
 
830
}
-
 
831
 
-
 
832
static force_inline void
-
 
833
pixman_list_prepend (pixman_list_t *list, pixman_link_t *link)
-
 
834
{
-
 
835
    link->next = list->head;
-
 
836
    link->prev = (pixman_link_t *)list;
-
 
837
    list->head->prev = link;
-
 
838
    list->head = link;
-
 
839
}
-
 
840
 
-
 
841
static force_inline void
-
 
842
pixman_list_unlink (pixman_link_t *link)
-
 
843
{
-
 
844
    link->prev->next = link->next;
Line 661... Line 845...
661
pixman_bool_t
845
    link->next->prev = link->prev;
Line 662... Line 846...
662
pixman_region32_copy_from_region16 (pixman_region32_t *dst,
846
}
663
                                    pixman_region16_t *src);
847
 
Line 694... Line 878...
694
#define MOD(a, b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
878
/* Modulus that produces the remainder wrt. DIV */
695
 
879
#define MOD(a, b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
Line 696... Line 880...
696
#define CLIP(v, low, high) ((v) < (low) ? (low) : ((v) > (high) ? (high) : (v)))
880
 
Line -... Line 881...
-
 
881
#define CLIP(v, low, high) ((v) < (low) ? (low) : ((v) > (high) ? (high) : (v)))
-
 
882
 
697
 
883
#define FLOAT_IS_ZERO(f)     (-FLT_MIN < (f) && (f) < FLT_MIN)
Line -... Line 884...
-
 
884
 
698
/* Conversion between 8888 and 0565 */
885
/* Conversion between 8888 and 0565 */
-
 
886
 
699
 
887
static force_inline uint16_t
700
#define CONVERT_8888_TO_0565(s)						\
888
convert_8888_to_0565 (uint32_t s)
701
    ((((s) >> 3) & 0x001f) |						\
889
{
702
     (((s) >> 5) & 0x07e0) |						\
-
 
703
     (((s) >> 8) & 0xf800))
890
    /* The following code can be compiled into just 4 instructions on ARM */
704
 
891
    uint32_t a, b;
705
#define CONVERT_0565_TO_0888(s)						\
892
    a = (s >> 3) & 0x1F001F;
706
    (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) |			\
893
    b = s & 0xFC00;
-
 
894
    a |= a >> 5;
Line -... Line 895...
-
 
895
    a |= b >> 5;
-
 
896
    return (uint16_t)a;
-
 
897
}
-
 
898
 
-
 
899
static force_inline uint32_t
-
 
900
convert_0565_to_0888 (uint16_t s)
-
 
901
{
-
 
902
    return (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) |
-
 
903
            ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) |
-
 
904
            ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)));
-
 
905
}
707
     ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) |			\
906
 
-
 
907
static force_inline uint32_t
Line 708... Line 908...
708
     ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
908
convert_0565_to_8888 (uint16_t s)
-
 
909
{
-
 
910
    return convert_0565_to_0888 (s) | 0xff000000;
709
 
911
}
-
 
912
 
-
 
913
/* Trivial versions that are useful in macros */
-
 
914
 
-
 
915
static force_inline uint32_t
-
 
916
convert_8888_to_8888 (uint32_t s)
-
 
917
{
-
 
918
    return s;
-
 
919
}
-
 
920
 
-
 
921
static force_inline uint32_t
-
 
922
convert_x888_to_8888 (uint32_t s)
710
#define CONVERT_0565_TO_8888(s) (CONVERT_0565_TO_0888(s) | 0xff000000)
923
{
-
 
924
    return s | 0xff000000;
-
 
925
}
-
 
926
 
Line 711... Line 927...
711
 
927
static force_inline uint16_t
712
/* Trivial versions that are useful in macros */
928
convert_0565_to_0565 (uint16_t s)
713
#define CONVERT_8888_TO_8888(s) (s)
929
{
714
#define CONVERT_0565_TO_0565(s) (s)
930
    return s;
715
 
931
}
-
 
932
 
Line 716... Line 933...
716
#define PIXMAN_FORMAT_IS_WIDE(f)					\
933
#define PIXMAN_FORMAT_IS_WIDE(f)					\
717
    (PIXMAN_FORMAT_A (f) > 8 ||						\
934
    (PIXMAN_FORMAT_A (f) > 8 ||						\
718
     PIXMAN_FORMAT_R (f) > 8 ||						\
935
     PIXMAN_FORMAT_R (f) > 8 ||						\
719
     PIXMAN_FORMAT_G (f) > 8 ||						\
936
     PIXMAN_FORMAT_G (f) > 8 ||						\
720
     PIXMAN_FORMAT_B (f) > 8)
937
     PIXMAN_FORMAT_B (f) > 8 ||						\
721
 
938
     PIXMAN_FORMAT_TYPE (f) == PIXMAN_TYPE_ARGB_SRGB)
722
#ifdef WORDS_BIGENDIAN
939
 
Line -... Line 940...
-
 
940
#ifdef WORDS_BIGENDIAN
-
 
941
#   define SCREEN_SHIFT_LEFT(x,n)	((x) << (n))
-
 
942
#   define SCREEN_SHIFT_RIGHT(x,n)	((x) >> (n))
-
 
943
#else
-
 
944
#   define SCREEN_SHIFT_LEFT(x,n)	((x) >> (n))
-
 
945
#   define SCREEN_SHIFT_RIGHT(x,n)	((x) << (n))
-
 
946
#endif
-
 
947
 
-
 
948
static force_inline uint32_t
-
 
949
unorm_to_unorm (uint32_t val, int from_bits, int to_bits)
-
 
950
{
-
 
951
    uint32_t result;
-
 
952
 
-
 
953
    if (from_bits == 0)
-
 
954
	return 0;
-
 
955
 
-
 
956
    /* Delete any extra bits */
-
 
957
    val &= ((1 << from_bits) - 1);
-
 
958
 
-
 
959
    if (from_bits >= to_bits)
-
 
960
	return val >> (from_bits - to_bits);
-
 
961
 
-
 
962
    /* Start out with the high bit of val in the high bit of result. */
-
 
963
    result = val << (to_bits - from_bits);
-
 
964
 
-
 
965
    /* Copy the bits in result, doubling the number of bits each time, until
-
 
966
     * we fill all to_bits. Unrolled manually because from_bits and to_bits
-
 
967
     * are usually known statically, so the compiler can turn all of this
-
 
968
     * into a few shifts.
-
 
969
     */
-
 
970
#define REPLICATE()							\
-
 
971
    do									\
-
 
972
    {									\
-
 
973
	if (from_bits < to_bits)					\
-
 
974
	{								\
-
 
975
	    result |= result >> from_bits;				\
-
 
976
									\
-
 
977
	    from_bits *= 2;						\
-
 
978
	}								\
-
 
979
    }									\
-
 
980
    while (0)
-
 
981
 
-
 
982
    REPLICATE();
-
 
983
    REPLICATE();
-
 
984
    REPLICATE();
-
 
985
    REPLICATE();
723
#   define SCREEN_SHIFT_LEFT(x,n)	((x) << (n))
986
    REPLICATE();
724
#   define SCREEN_SHIFT_RIGHT(x,n)	((x) >> (n))
987
 
725
#else
988
    return result;
Line 726... Line 989...
726
#   define SCREEN_SHIFT_LEFT(x,n)	((x) >> (n))
989
}
Line 752... Line 1015...
752
#    define DEBUG
1015
 
Line 753... Line 1016...
753
 
1016
#    define DEBUG
Line 754... Line -...
754
#endif
-
 
755
 
-
 
756
#ifdef DEBUG
1017
 
757
 
1018
#endif
Line 758... Line 1019...
758
void
1019
 
759
_pixman_log_error (const char *function, const char *message);
1020
void
760
 
1021
_pixman_log_error (const char *function, const char *message);
761
#define return_if_fail(expr)                                            \
1022
 
762
    do                                                                  \
1023
#define return_if_fail(expr)                                            \
763
    {                                                                   \
1024
    do                                                                  \
764
	if (!(expr))							\
1025
    {                                                                   \
765
	{								\
1026
	if (unlikely (!(expr)))                                         \
766
	    _pixman_log_error (FUNC, "The expression " # expr " was false"); \
1027
	{								\
767
	    return;							\
1028
	    _pixman_log_error (FUNC, "The expression " # expr " was false"); \
Line 768... Line 1029...
768
	}								\
1029
	    return;							\
769
    }                                                                   \
1030
	}								\
770
    while (0)
1031
    }                                                                   \
771
 
1032
    while (0)
772
#define return_val_if_fail(expr, retval)                                \
1033
 
773
    do                                                                  \
1034
#define return_val_if_fail(expr, retval)                                \
774
    {                                                                   \
1035
    do                                                                  \
775
	if (!(expr))                                                    \
1036
    {                                                                   \
776
	{								\
1037
	if (unlikely (!(expr)))                                         \
777
	    _pixman_log_error (FUNC, "The expression " # expr " was false"); \
1038
	{								\
Line 778... Line 1039...
778
	    return (retval);						\
1039
	    _pixman_log_error (FUNC, "The expression " # expr " was false"); \
779
	}								\
1040
	    return (retval);						\
780
    }                                                                   \
1041
	}								\
781
    while (0)
1042
    }                                                                   \
782
 
1043
    while (0)
783
#define critical_if_fail(expr)						\
1044
 
784
    do									\
1045
#define critical_if_fail(expr)						\
Line -... Line 1046...
-
 
1046
    do									\
-
 
1047
    {									\
-
 
1048
	if (unlikely (!(expr)))                                         \
Line 785... Line -...
785
    {									\
-
 
786
	if (!(expr))							\
-
 
787
	    _pixman_log_error (FUNC, "The expression " # expr " was false"); \
1049
	    _pixman_log_error (FUNC, "The expression " # expr " was false"); \
Line 788... Line 1050...
788
    }									\
1050
    }									\
789
    while (0)
1051
    while (0)
790
 
1052
 
791
 
-
 
792
#else
-
 
793
 
1053
/*
794
#define _pixman_log_error(f,m) do { } while (0)				\
-
 
Line -... Line 1054...
-
 
1054
 * Matrix
795
 
1055
 */
796
#define return_if_fail(expr)						\
-
 
797
    do                                                                  \
1056
 
798
    {                                                                   \
-
 
799
	if (!(expr))							\
-
 
800
	    return;							\
1057
typedef struct { pixman_fixed_48_16_t v[3]; } pixman_vector_48_16_t;
801
    }                                                                   \
-
 
Line 802... Line -...
802
    while (0)
-
 
803
 
-
 
804
#define return_val_if_fail(expr, retval)                                \
-
 
805
    do                                                                  \
-
 
806
    {                                                                   \
-
 
807
	if (!(expr))							\
1058
 
-
 
1059
pixman_bool_t
-
 
1060
pixman_transform_point_31_16 (const pixman_transform_t    *t,
-
 
1061
                              const pixman_vector_48_16_t *v,
Line 808... Line 1062...
808
	    return (retval);						\
1062
                              pixman_vector_48_16_t       *result);
809
    }                                                                   \
1063
 
810
    while (0)
1064
void
Line 811... Line 1065...
811
 
1065
pixman_transform_point_31_16_3d (const pixman_transform_t    *t,
Line 812... Line 1066...
812
#define critical_if_fail(expr)						\
1066
                                 const pixman_vector_48_16_t *v,
813
    do									\
1067
                                 pixman_vector_48_16_t       *result);
814
    {									\
1068
 
815
    }									\
1069
void
Line 816... Line 1070...
816
    while (0)
1070
pixman_transform_point_31_16_affine (const pixman_transform_t    *t,
-
 
1071
                                     const pixman_vector_48_16_t *v,
817
#endif
1072
                                     pixman_vector_48_16_t       *result);
818
 
1073
 
Line 819... Line 1074...
819
/*
1074
/*
Line 820... Line 1075...
820
 * Timers
1075
 * Timers
Line 866... Line 1121...
866
#define TIMER_END(tname)                                                \
1121
 
867
    timer ## tname.total += OIL_STAMP () - begin ## tname;		\
1122
#define TIMER_END(tname)                                                \
868
    }
1123
    timer ## tname.total += OIL_STAMP () - begin ## tname;		\
Line -... Line 1124...
-
 
1124
    }
-
 
1125
 
-
 
1126
#else
-
 
1127
 
-
 
1128
#define TIMER_BEGIN(tname)
869
 
1129
#define TIMER_END(tname)
Line -... Line 1130...
-
 
1130
 
-
 
1131
#endif /* PIXMAN_TIMERS */
870
#endif /* PIXMAN_TIMERS */
1132