2 # error config.h must be included before pixman-private.h
5 #ifndef PIXMAN_PRIVATE_H
6 #define PIXMAN_PRIVATE_H
22 #ifdef WORDS_BIGENDIAN
23 # define IMAGE_BYTE_ORDER MSBFirst
24 # define BITMAP_BIT_ORDER MSBFirst
26 # define IMAGE_BYTE_ORDER LSBFirst
27 # define BITMAP_BIT_ORDER LSBFirst
33 #if defined (__GNUC__)
34 # define FUNC ((const char*) (__PRETTY_FUNCTION__))
35 #elif defined (__sun) || (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
36 # define FUNC ((const char*) (__func__))
38 # define FUNC ((const char*) ("???"))
42 # define INT16_MIN (-32767-1)
46 # define INT16_MAX (32767)
50 # define INT32_MIN (-2147483647-1)
54 # define INT32_MAX (2147483647)
58 # define UINT32_MIN (0)
62 # define UINT32_MAX (4294967295U)
66 # define M_PI 3.14159265358979323846
70 /* 'inline' is available only in C++ in MSVC */
71 # define inline __inline
72 # define force_inline __forceinline
73 #elif defined __GNUC__ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
74 # define inline __inline__
75 # define force_inline __inline__ __attribute__ ((__always_inline__))
78 # define force_inline inline
83 #define FB_UNIT (1 << FB_SHIFT)
84 #define FB_HALFUNIT (1 << (FB_SHIFT-1))
85 #define FB_MASK (FB_UNIT - 1)
86 #define FB_ALLONES ((uint32_t) -1)
88 /* Memory allocation helpers */
89 void *pixman_malloc_ab (unsigned int n, unsigned int b);
90 void *pixman_malloc_abc (unsigned int a, unsigned int b, unsigned int c);
91 pixman_bool_t pixman_multiply_overflows_int (unsigned int a, unsigned int b);
92 pixman_bool_t pixman_addition_overflows_int (unsigned int a, unsigned int b);
96 #define return_if_fail(expr) \
101 fprintf(stderr, "In %s: %s failed\n", FUNC, #expr); \
107 #define return_val_if_fail(expr, retval) \
112 fprintf(stderr, "In %s: %s failed\n", FUNC, #expr); \
120 #define return_if_fail(expr) \
128 #define return_val_if_fail(expr, retval) \
138 typedef struct image_common image_common_t;
139 typedef struct source_image source_image_t;
140 typedef struct solid_fill solid_fill_t;
141 typedef struct gradient gradient_t;
142 typedef struct linear_gradient linear_gradient_t;
143 typedef struct horizontal_gradient horizontal_gradient_t;
144 typedef struct vertical_gradient vertical_gradient_t;
145 typedef struct conical_gradient conical_gradient_t;
146 typedef struct radial_gradient radial_gradient_t;
147 typedef struct bits_image bits_image_t;
148 typedef struct circle circle_t;
149 typedef struct point point_t;
151 /* FIXME - the types and structures below should be give proper names
155 typedef FASTCALL void (*CombineFunc32) (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width);
156 typedef FASTCALL void (*fetchProc32)(bits_image_t *pict, int x, int y, int width,
158 typedef FASTCALL uint32_t (*fetchPixelProc32)(bits_image_t *pict, int offset, int line);
159 typedef FASTCALL void (*storeProc32)(pixman_image_t *, uint32_t *bits,
160 const uint32_t *values, int x, int width,
161 const pixman_indexed_t *);
163 typedef FASTCALL void (*CombineFunc64) (uint64_t *dest, const uint64_t *src, const uint64_t *mask, int width);
164 typedef FASTCALL void (*fetchProc64)(bits_image_t *pict, int x, int y, int width,
166 typedef FASTCALL uint64_t (*fetchPixelProc64)(bits_image_t *pict, int offset, int line);
167 typedef FASTCALL void (*storeProc64)(pixman_image_t *, uint32_t *bits,
168 const uint64_t *values, int x, int width,
169 const pixman_indexed_t *);
171 typedef struct _FbComposeData {
174 pixman_image_t *mask;
175 pixman_image_t *dest;
186 typedef struct _FbComposeFunctions32 {
187 CombineFunc32 *combineU;
188 CombineFunc32 *combineC;
189 } FbComposeFunctions32;
191 typedef struct _FbComposeFunctions64 {
192 CombineFunc64 *combineU;
193 CombineFunc64 *combineC;
194 } FbComposeFunctions64;
196 extern FbComposeFunctions32 pixman_composeFunctions;
197 extern FbComposeFunctions64 pixman_composeFunctions64;
199 void pixman_composite_rect_general_accessors (const FbComposeData *data,
204 void pixman_composite_rect_general (const FbComposeData *data);
206 fetchProc32 pixman_fetchProcForPicture32 (bits_image_t *);
207 fetchPixelProc32 pixman_fetchPixelProcForPicture32 (bits_image_t *);
208 storeProc32 pixman_storeProcForPicture32 (bits_image_t *);
209 fetchProc32 pixman_fetchProcForPicture32_accessors (bits_image_t *);
210 fetchPixelProc32 pixman_fetchPixelProcForPicture32_accessors (bits_image_t *);
211 storeProc32 pixman_storeProcForPicture32_accessors (bits_image_t *);
213 fetchProc64 pixman_fetchProcForPicture64 (bits_image_t *);
214 fetchPixelProc64 pixman_fetchPixelProcForPicture64 (bits_image_t *);
215 storeProc64 pixman_storeProcForPicture64 (bits_image_t *);
216 fetchProc64 pixman_fetchProcForPicture64_accessors (bits_image_t *);
217 fetchPixelProc64 pixman_fetchPixelProcForPicture64_accessors (bits_image_t *);
218 storeProc64 pixman_storeProcForPicture64_accessors (bits_image_t *);
220 void pixman_expand(uint64_t *dst, const uint32_t *src, pixman_format_code_t, int width);
221 void pixman_contract(uint32_t *dst, const uint64_t *src, int width);
223 void pixmanFetchSourcePict(source_image_t *, int x, int y, int width,
224 uint32_t *buffer, uint32_t *mask, uint32_t maskBits);
225 void pixmanFetchSourcePict64(source_image_t *, int x, int y, int width,
226 uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
228 void fbFetchTransformed(bits_image_t *, int x, int y, int width,
229 uint32_t *buffer, uint32_t *mask, uint32_t maskBits);
230 void fbStoreExternalAlpha(bits_image_t *, int x, int y, int width,
232 void fbFetchExternalAlpha(bits_image_t *, int x, int y, int width,
233 uint32_t *buffer, uint32_t *mask, uint32_t maskBits);
235 void fbFetchTransformed_accessors(bits_image_t *, int x, int y, int width,
236 uint32_t *buffer, uint32_t *mask,
238 void fbStoreExternalAlpha_accessors(bits_image_t *, int x, int y, int width,
240 void fbFetchExternalAlpha_accessors(bits_image_t *, int x, int y, int width,
241 uint32_t *buffer, uint32_t *mask,
244 void fbFetchTransformed64(bits_image_t *, int x, int y, int width,
245 uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
246 void fbStoreExternalAlpha64(bits_image_t *, int x, int y, int width,
248 void fbFetchExternalAlpha64(bits_image_t *, int x, int y, int width,
249 uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
251 void fbFetchTransformed64_accessors(bits_image_t *, int x, int y, int width,
252 uint64_t *buffer, uint64_t *mask,
254 void fbStoreExternalAlpha64_accessors(bits_image_t *, int x, int y, int width,
256 void fbFetchExternalAlpha64_accessors(bits_image_t *, int x, int y, int width,
257 uint64_t *buffer, uint64_t *mask,
271 #define IS_SOURCE_IMAGE(img) (((image_common_t *)img)->type > BITS)
275 SOURCE_IMAGE_CLASS_UNKNOWN,
276 SOURCE_IMAGE_CLASS_HORIZONTAL,
277 SOURCE_IMAGE_CLASS_VERTICAL,
278 } source_pict_class_t;
280 typedef void (*scanStoreProc)(pixman_image_t *, int, int, int, uint32_t *);
281 typedef void (*scanFetchProc)(pixman_image_t *, int, int, int, uint32_t *,
282 uint32_t *, uint32_t);
284 source_pict_class_t _pixman_image_classify (pixman_image_t *image,
291 _pixman_image_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
292 uint32_t *buffer, uint32_t *mask, uint32_t mask_bits);
294 /* Even thought the type of buffer is uint32_t *, the function actually expects
295 * a uint64_t *buffer.
298 _pixman_image_get_scanline_64 (pixman_image_t *image, int x, int y, int width,
299 uint32_t *buffer, uint32_t *unused, uint32_t unused2);
302 _pixman_image_get_storer (pixman_image_t *image,
306 _pixman_image_allocate (void);
309 _pixman_init_gradient (gradient_t *gradient,
310 const pixman_gradient_stop_t *stops,
313 _pixman_image_reset_clip_region (pixman_image_t *image);
320 typedef source_pict_class_t (* classify_func_t) (pixman_image_t *image,
325 typedef void (* property_changed_func_t) (pixman_image_t *image);
331 pixman_region32_t full_region;
332 pixman_region32_t clip_region;
333 pixman_region32_t *src_clip;
334 pixman_bool_t has_client_clip;
335 pixman_transform_t *transform;
336 pixman_repeat_t repeat;
337 pixman_filter_t filter;
338 pixman_fixed_t *filter_params;
340 bits_image_t *alpha_map;
341 point_t alpha_origin;
342 pixman_bool_t component_alpha;
343 pixman_read_memory_func_t read_func;
344 pixman_write_memory_func_t write_func;
345 classify_func_t classify;
346 property_changed_func_t property_changed;
347 scanFetchProc get_scanline_32;
348 scanFetchProc get_scanline_64;
353 image_common_t common;
354 source_pict_class_t class;
359 source_image_t common;
360 uint32_t color; /* FIXME: shouldn't this be a pixman_color_t? */
365 source_image_t common;
367 pixman_gradient_stop_t * stops;
369 uint32_t * color_table;
370 int color_table_size;
373 struct linear_gradient
376 pixman_point_fixed_t p1;
377 pixman_point_fixed_t p2;
384 pixman_fixed_t radius;
387 struct radial_gradient
399 struct conical_gradient
402 pixman_point_fixed_t center;
403 pixman_fixed_t angle;
408 image_common_t common;
409 pixman_format_code_t format;
410 const pixman_indexed_t *indexed;
415 int rowstride; /* in number of uint32_t's */
421 image_common_t common;
423 source_image_t source;
425 linear_gradient_t linear;
426 conical_gradient_t conical;
427 radial_gradient_t radial;
443 pixman_gradient_stop_t *stops;
451 _pixman_gradient_walker_init (GradientWalker *walker,
452 gradient_t *gradient,
453 unsigned int spread);
456 _pixman_gradient_walker_reset (GradientWalker *walker,
457 pixman_fixed_32_32_t pos);
460 _pixman_gradient_walker_pixel (GradientWalker *walker,
461 pixman_fixed_32_32_t x);
465 #define LOG2_BITMAP_PAD 5
466 #define FB_STIP_SHIFT LOG2_BITMAP_PAD
467 #define FB_STIP_UNIT (1 << FB_STIP_SHIFT)
468 #define FB_STIP_MASK (FB_STIP_UNIT - 1)
469 #define FB_STIP_ALLONES ((uint32_t) -1)
471 #if BITMAP_BIT_ORDER == LSBFirst
472 #define FbScrLeft(x,n) ((x) >> (n))
473 #define FbScrRight(x,n) ((x) << (n))
474 #define FbLeftStipBits(x,n) ((x) & ((((uint32_t) 1) << (n)) - 1))
476 #define FbScrLeft(x,n) ((x) << (n))
477 #define FbScrRight(x,n) ((x) >> (n))
478 #define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n)))
481 #define FbStipLeft(x,n) FbScrLeft(x,n)
482 #define FbStipRight(x,n) FbScrRight(x,n)
483 #define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \
484 FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK))
486 #define FbLeftMask(x) ( ((x) & FB_MASK) ? \
487 FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0)
488 #define FbRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \
489 FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0)
491 #define FbMaskBits(x,w,l,n,r) { \
493 r = FbRightMask((x)+n); \
496 n -= FB_UNIT - ((x) & FB_MASK); \
506 #if IMAGE_BYTE_ORDER == MSBFirst
507 #define Fetch24(img, a) ((unsigned long) (a) & 1 ? \
508 ((READ(img, a) << 16) | READ(img, (uint16_t *) ((a)+1))) : \
509 ((READ(img, (uint16_t *) (a)) << 8) | READ(img, (a)+2)))
510 #define Store24(img,a,v) ((unsigned long) (a) & 1 ? \
511 (WRITE(img, a, (uint8_t) ((v) >> 16)), \
512 WRITE(img, (uint16_t *) ((a)+1), (uint16_t) (v))) : \
513 (WRITE(img, (uint16_t *) (a), (uint16_t) ((v) >> 8)), \
514 WRITE(img, (a)+2, (uint8_t) (v))))
516 #define Fetch24(img,a) ((unsigned long) (a) & 1 ? \
517 (READ(img, a) | (READ(img, (uint16_t *) ((a)+1)) << 8)) : \
518 (READ(img, (uint16_t *) (a)) | (READ(img, (a)+2) << 16)))
519 #define Store24(img,a,v) ((unsigned long) (a) & 1 ? \
520 (WRITE(img, a, (uint8_t) (v)), \
521 WRITE(img, (uint16_t *) ((a)+1), (uint16_t) ((v) >> 8))) : \
522 (WRITE(img, (uint16_t *) (a), (uint16_t) (v)), \
523 WRITE(img, (a)+2, (uint8_t) ((v) >> 16))))
526 #define CvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \
527 (((s) >> 8) & 0xff) * 301 + \
528 (((s) ) & 0xff) * 58) >> 2)
529 #define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \
530 (((s) >> 6) & 0x03e0) | \
531 (((s) >> 9) & 0x7c00))
532 #define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15])
533 #define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24))
535 #define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
538 #define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) )
539 #define FbIntDiv(a,b) (((uint16_t) (a) * 255) / (b))
541 #define FbGet8(v,i) ((uint16_t) (uint8_t) ((v) >> i))
544 #define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \
545 (((s) >> 5) & 0x07e0) | \
546 (((s) >> 8) & 0xf800))
547 #define cvt0565to0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
548 ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
549 ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
552 * There are two ways of handling alpha -- either as a single unified value or
553 * a separate value for each component, hence each macro must have two
554 * versions. The unified alpha version has a 'U' at the end of the name,
555 * the component version has a 'C'. Similarly, functions which deal with
556 * this difference will have two versions using the same convention.
559 #define FbOverU(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),(a),(t)) + FbGet8(x,i), \
560 (uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
562 #define FbOverC(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),FbGet8(a,i),(t)) + FbGet8(x,i), \
563 (uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
565 #define FbInU(x,i,a,t) ((uint32_t) FbIntMult(FbGet8(x,i),(a),(t)) << (i))
567 #define FbInC(x,i,a,t) ((uint32_t) FbIntMult(FbGet8(x,i),FbGet8(a,i),(t)) << (i))
569 #define FbAdd(x,y,i,t) ((t) = FbGet8(x,i) + FbGet8(y,i), \
570 (uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
572 #define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8)
573 #define div_65535(x) (((x) + 0x8000 + (((x) + 0x8000) >> 16)) >> 16)
575 #define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
577 #define DIV(a,b) ((((a) < 0) == ((b) < 0)) ? (a) / (b) : \
578 ((a) - (b) + 1 - (((b) < 0) << 1)) / (b))
580 #define CLIP(a,b,c) ((a) < (b) ? (b) : ((a) > (c) ? (c) : (a)))
583 /* FIXME: the MOD macro above is equivalent, but faster I think */
584 #define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
587 /* FIXME: the (void)__read_func hides lots of warnings (which is what they
588 * are supposed to do), but some of them are real. For example the one
589 * where Fetch4 doesn't have a READ
593 /* Framebuffer access support macros */
594 #define ACCESS_MEM(code) \
596 const image_common_t *const com__ = \
597 (image_common_t *)image; \
599 if (!com__->read_func && !com__->write_func) \
601 const int do_access__ = 0; \
602 const pixman_read_memory_func_t read_func__ = NULL; \
603 const pixman_write_memory_func_t write_func__ = NULL; \
605 (void)write_func__; \
612 const int do_access__ = 1; \
613 const pixman_read_memory_func_t read_func__ = \
615 const pixman_write_memory_func_t write_func__ = \
618 (void)write_func__; \
626 #ifdef PIXMAN_FB_ACCESSORS
628 #define ACCESS(sym) sym##_accessors
630 #define READ(img, ptr) \
631 ((img)->common.read_func ((ptr), sizeof(*(ptr))))
632 #define WRITE(img, ptr,val) \
633 ((img)->common.write_func ((ptr), (val), sizeof (*(ptr))))
635 #define MEMCPY_WRAPPED(img, dst, src, size) \
638 uint8_t *_dst = (uint8_t*)(dst), *_src = (uint8_t*)(src); \
639 for(_i = 0; _i < size; _i++) { \
640 WRITE((img), _dst +_i, READ((img), _src + _i)); \
644 #define MEMSET_WRAPPED(img, dst, val, size) \
647 uint8_t *_dst = (uint8_t*)(dst); \
648 for(_i = 0; _i < (size_t) size; _i++) { \
649 WRITE((img), _dst +_i, (val)); \
655 #define ACCESS(sym) sym
657 #define READ(img, ptr) (*(ptr))
658 #define WRITE(img, ptr, val) (*(ptr) = (val))
659 #define MEMCPY_WRAPPED(img, dst, src, size) \
660 memcpy(dst, src, size)
661 #define MEMSET_WRAPPED(img, dst, val, size) \
662 memset(dst, val, size)
666 #define fbComposeGetSolid(img, res, fmt) \
669 pixman_format_code_t format__; \
670 if (img->type == SOLID) \
672 format__ = PIXMAN_a8r8g8b8; \
673 (res) = img->solid.color; \
677 uint32_t *bits__ = (img)->bits.bits; \
678 format__ = (img)->bits.format; \
680 switch (PIXMAN_FORMAT_BPP((img)->bits.format)) \
683 (res) = READ(img, (uint32_t *)bits__); \
686 (res) = Fetch24(img, (uint8_t *) bits__); \
689 (res) = READ(img, (uint16_t *) bits__); \
690 (res) = cvt0565to0888(res); \
693 (res) = READ(img, (uint8_t *) bits__); \
694 (res) = (res) << 24; \
697 (res) = READ(img, (uint32_t *) bits__); \
698 (res) = FbLeftStipBits((res),1) ? 0xff000000 : 0x00000000; \
703 /* manage missing src alpha */ \
704 if (!PIXMAN_FORMAT_A((img)->bits.format)) \
705 (res) |= 0xff000000; \
708 /* If necessary, convert RGB <--> BGR. */ \
709 if (PIXMAN_FORMAT_TYPE (format__) != PIXMAN_FORMAT_TYPE(fmt)) \
711 (res) = ((((res) & 0xff000000) >> 0) | \
712 (((res) & 0x00ff0000) >> 16) | \
713 (((res) & 0x0000ff00) >> 0) | \
714 (((res) & 0x000000ff) << 16)); \
719 #define fbComposeGetStart(pict,x,y,type,out_stride,line,mul) do { \
720 uint32_t *__bits__; \
724 __bits__ = pict->bits.bits; \
725 __stride__ = pict->bits.rowstride; \
726 __bpp__ = PIXMAN_FORMAT_BPP(pict->bits.format); \
727 (out_stride) = __stride__ * (int) sizeof (uint32_t) / (int) sizeof (type); \
728 (line) = ((type *) __bits__) + \
729 (out_stride) * (y) + (mul) * (x); \
733 #define PIXMAN_FORMAT_16BPC(f) (PIXMAN_FORMAT_A(f) > 8 || \
734 PIXMAN_FORMAT_R(f) > 8 || \
735 PIXMAN_FORMAT_G(f) > 8 || \
736 PIXMAN_FORMAT_B(f) > 8)
741 #define MAX_ALPHA(n) ((1 << (n)) - 1)
742 #define N_Y_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) - 1)
743 #define N_X_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) + 1)
745 #define STEP_Y_SMALL(n) (pixman_fixed_1 / N_Y_FRAC(n))
746 #define STEP_Y_BIG(n) (pixman_fixed_1 - (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
748 #define Y_FRAC_FIRST(n) (STEP_Y_SMALL(n) / 2)
749 #define Y_FRAC_LAST(n) (Y_FRAC_FIRST(n) + (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
751 #define STEP_X_SMALL(n) (pixman_fixed_1 / N_X_FRAC(n))
752 #define STEP_X_BIG(n) (pixman_fixed_1 - (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
754 #define X_FRAC_FIRST(n) (STEP_X_SMALL(n) / 2)
755 #define X_FRAC_LAST(n) (X_FRAC_FIRST(n) + (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
757 #define RenderSamplesX(x,n) ((n) == 1 ? 0 : (pixman_fixed_frac (x) + X_FRAC_FIRST(n)) / STEP_X_SMALL(n))
760 * Step across a small sample grid gap
762 #define RenderEdgeStepSmall(edge) { \
763 edge->x += edge->stepx_small; \
764 edge->e += edge->dx_small; \
767 edge->e -= edge->dy; \
768 edge->x += edge->signdx; \
773 * Step across a large sample grid gap
775 #define RenderEdgeStepBig(edge) { \
776 edge->x += edge->stepx_big; \
777 edge->e += edge->dx_big; \
780 edge->e -= edge->dy; \
781 edge->x += edge->signdx; \
786 pixman_rasterize_edges_accessors (pixman_image_t *image,
793 pixman_image_is_opaque(pixman_image_t *image);
796 pixman_image_can_get_solid (pixman_image_t *image);
799 pixman_compute_composite_region32 (pixman_region32_t * pRegion,
800 pixman_image_t * pSrc,
801 pixman_image_t * pMask,
802 pixman_image_t * pDst,
813 #if defined(__GNUC__) && __GNUC__ >= 4
814 #define PIXMAN_EXPORT __attribute__ ((visibility("default")))
815 /* Sun Studio 8 visibility */
816 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
817 #define PIXMAN_EXPORT __global
819 #define PIXMAN_EXPORT
823 pixman_bool_t pixman_region32_copy_from_region16 (pixman_region32_t *dst,
824 pixman_region16_t *src);
825 pixman_bool_t pixman_region16_copy_from_region32 (pixman_region16_t *dst,
826 pixman_region32_t *src);
827 void pixman_region_internal_set_static_pointers (pixman_box16_t *empty_box,
828 pixman_region16_data_t *empty_data,
829 pixman_region16_data_t *broken_data);
834 static inline uint64_t
835 oil_profile_stamp_rdtsc (void)
838 __asm__ __volatile__("rdtsc\n" : "=A" (ts));
841 #define OIL_STAMP oil_profile_stamp_rdtsc
843 typedef struct PixmanTimer PixmanTimer;
854 extern int timer_defined;
855 void pixman_timer_register (PixmanTimer *timer);
857 #define TIMER_BEGIN(tname) \
859 static PixmanTimer timer##tname; \
860 uint64_t begin##tname; \
862 if (!timer##tname.initialized) \
864 timer##tname.initialized = 1; \
865 timer##tname.name = #tname; \
866 pixman_timer_register (&timer##tname); \
869 timer##tname.n_times++; \
870 begin##tname = OIL_STAMP();
872 #define TIMER_END(tname) \
873 timer##tname.total += OIL_STAMP() - begin##tname; \
876 #endif /* PIXMAN_TIMING */
878 #endif /* PIXMAN_PRIVATE_H */