2 # error config.h must be included before pixman-private.h
5 #ifndef PIXMAN_PRIVATE_H
6 #define PIXMAN_PRIVATE_H
23 #ifdef WORDS_BIGENDIAN
24 # define IMAGE_BYTE_ORDER MSBFirst
25 # define BITMAP_BIT_ORDER MSBFirst
27 # define IMAGE_BYTE_ORDER LSBFirst
28 # define BITMAP_BIT_ORDER LSBFirst
34 #if defined (__GNUC__)
35 # define FUNC ((const char*) (__PRETTY_FUNCTION__))
36 #elif defined (__sun) || (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
37 # define FUNC ((const char*) (__func__))
39 # define FUNC ((const char*) ("???"))
43 # define INT16_MIN (-32767-1)
47 # define INT16_MAX (32767)
51 # define INT32_MIN (-2147483647-1)
55 # define INT32_MAX (2147483647)
59 # define UINT32_MIN (0)
63 # define UINT32_MAX (4294967295U)
67 # define M_PI 3.14159265358979323846
71 /* 'inline' is available only in C++ in MSVC */
72 # define inline __inline
73 # define force_inline __forceinline
74 #elif defined __GNUC__ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
75 # define inline __inline__
76 # define force_inline __inline__ __attribute__ ((__always_inline__))
79 # define force_inline inline
84 #define FB_UNIT (1 << FB_SHIFT)
85 #define FB_HALFUNIT (1 << (FB_SHIFT-1))
86 #define FB_MASK (FB_UNIT - 1)
87 #define FB_ALLONES ((uint32_t) -1)
89 /* Memory allocation helpers */
90 void *pixman_malloc_ab (unsigned int n, unsigned int b);
91 void *pixman_malloc_abc (unsigned int a, unsigned int b, unsigned int c);
92 pixman_bool_t pixman_multiply_overflows_int (unsigned int a, unsigned int b);
93 pixman_bool_t pixman_addition_overflows_int (unsigned int a, unsigned int b);
97 #define return_if_fail(expr) \
102 fprintf(stderr, "In %s: %s failed\n", FUNC, #expr); \
108 #define return_val_if_fail(expr, retval) \
113 fprintf(stderr, "In %s: %s failed\n", FUNC, #expr); \
121 #define return_if_fail(expr) \
129 #define return_val_if_fail(expr, retval) \
139 typedef struct image_common image_common_t;
140 typedef struct source_image source_image_t;
141 typedef struct solid_fill solid_fill_t;
142 typedef struct gradient gradient_t;
143 typedef struct linear_gradient linear_gradient_t;
144 typedef struct horizontal_gradient horizontal_gradient_t;
145 typedef struct vertical_gradient vertical_gradient_t;
146 typedef struct conical_gradient conical_gradient_t;
147 typedef struct radial_gradient radial_gradient_t;
148 typedef struct bits_image bits_image_t;
149 typedef struct circle circle_t;
150 typedef struct point point_t;
152 /* FIXME - the types and structures below should be give proper names
155 typedef void (*fetchProc32)(bits_image_t *pict, int x, int y, int width,
157 typedef uint32_t (*fetchPixelProc32)(bits_image_t *pict, int offset, int line);
158 typedef void (*storeProc32)(pixman_image_t *, uint32_t *bits,
159 const uint32_t *values, int x, int width,
160 const pixman_indexed_t *);
162 typedef void (*fetchProc64)(bits_image_t *pict, int x, int y, int width,
164 typedef uint64_t (*fetchPixelProc64)(bits_image_t *pict, int offset, int line);
165 typedef void (*storeProc64)(pixman_image_t *, uint32_t *bits,
166 const uint64_t *values, int x, int width,
167 const pixman_indexed_t *);
169 typedef void (* fetch_pixels_32_t) (bits_image_t *image, uint32_t *buffer, int n_pixels);
170 typedef void (* fetch_pixels_64_t) (bits_image_t *image, uint64_t *buffer, int n_pixels);
172 fetchProc32 pixman_fetchProcForPicture32 (bits_image_t *);
173 fetch_pixels_32_t pixman_fetchPixelProcForPicture32 (bits_image_t *);
174 storeProc32 pixman_storeProcForPicture32 (bits_image_t *);
175 fetchProc32 pixman_fetchProcForPicture32_accessors (bits_image_t *);
176 fetch_pixels_32_t pixman_fetchPixelProcForPicture32_accessors (bits_image_t *);
177 storeProc32 pixman_storeProcForPicture32_accessors (bits_image_t *);
179 fetchProc64 pixman_fetchProcForPicture64 (bits_image_t *);
180 fetch_pixels_64_t pixman_fetchPixelProcForPicture64 (bits_image_t *);
181 storeProc64 pixman_storeProcForPicture64 (bits_image_t *);
182 fetchProc64 pixman_fetchProcForPicture64_accessors (bits_image_t *);
183 fetch_pixels_64_t pixman_fetchPixelProcForPicture64_accessors (bits_image_t *);
184 storeProc64 pixman_storeProcForPicture64_accessors (bits_image_t *);
186 void pixman_expand(uint64_t *dst, const uint32_t *src, pixman_format_code_t, int width);
187 void pixman_contract(uint32_t *dst, const uint64_t *src, int width);
189 void _pixman_image_get_scanline_64_generic (pixman_image_t * pict, int x, int y, int width,
190 uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
205 SOURCE_IMAGE_CLASS_UNKNOWN,
206 SOURCE_IMAGE_CLASS_HORIZONTAL,
207 SOURCE_IMAGE_CLASS_VERTICAL,
208 } source_pict_class_t;
210 typedef void (*scanStoreProc)(bits_image_t *img, int x, int y, int width, uint32_t *buffer);
211 typedef void (*scanFetchProc)(pixman_image_t *, int, int, int, uint32_t *,
212 uint32_t *, uint32_t);
214 source_pict_class_t _pixman_image_classify (pixman_image_t *image,
221 _pixman_image_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
222 uint32_t *buffer, uint32_t *mask, uint32_t mask_bits);
224 /* Even thought the type of buffer is uint32_t *, the function actually expects
225 * a uint64_t *buffer.
228 _pixman_image_get_scanline_64 (pixman_image_t *image, int x, int y, int width,
229 uint32_t *buffer, uint32_t *unused, uint32_t unused2);
232 _pixman_image_store_scanline_32 (bits_image_t *image, int x, int y, int width,
235 _pixman_image_fetch_pixels (bits_image_t *image, uint32_t *buffer, int n_pixels);
237 /* Even thought the type of buffer is uint32_t *, the function actually expects
238 * a uint64_t *buffer.
241 _pixman_image_store_scanline_64 (bits_image_t *image, int x, int y, int width,
245 _pixman_image_allocate (void);
248 _pixman_init_gradient (gradient_t *gradient,
249 const pixman_gradient_stop_t *stops,
252 _pixman_image_reset_clip_region (pixman_image_t *image);
259 typedef source_pict_class_t (* classify_func_t) (pixman_image_t *image,
264 typedef void (* property_changed_func_t) (pixman_image_t *image);
270 pixman_region32_t clip_region;
271 pixman_bool_t have_clip_region; /* FALSE if there is no clip */
272 pixman_bool_t client_clip; /* Whether the source clip was set by a client */
273 pixman_bool_t clip_sources; /* Whether the clip applies when
274 * the image is used as a source
276 pixman_transform_t *transform;
277 pixman_repeat_t repeat;
278 pixman_filter_t filter;
279 pixman_fixed_t *filter_params;
281 bits_image_t *alpha_map;
282 point_t alpha_origin;
283 pixman_bool_t component_alpha;
284 pixman_read_memory_func_t read_func;
285 pixman_write_memory_func_t write_func;
286 classify_func_t classify;
287 property_changed_func_t property_changed;
288 scanFetchProc get_scanline_32;
289 scanFetchProc get_scanline_64;
291 pixman_image_destroy_func_t destroy_func;
297 image_common_t common;
298 source_pict_class_t class;
303 source_image_t common;
304 uint32_t color; /* FIXME: shouldn't this be a pixman_color_t? */
309 source_image_t common;
311 pixman_gradient_stop_t * stops;
313 uint32_t * color_table;
314 int color_table_size;
317 struct linear_gradient
320 pixman_point_fixed_t p1;
321 pixman_point_fixed_t p2;
328 pixman_fixed_t radius;
331 struct radial_gradient
343 struct conical_gradient
346 pixman_point_fixed_t center;
347 pixman_fixed_t angle;
352 image_common_t common;
353 pixman_format_code_t format;
354 const pixman_indexed_t *indexed;
359 int rowstride; /* in number of uint32_t's */
361 /* Fetch raw pixels, with no regard for transformations, alpha map etc. */
362 fetch_pixels_32_t fetch_pixels_raw_32;
363 fetch_pixels_64_t fetch_pixels_raw_64;
365 /* Fetch raw scanlines, with no regard for transformations, alpha maps etc. */
366 fetchProc32 fetch_scanline_raw_32;
367 fetchProc64 fetch_scanline_raw_64;
369 /* Store scanlines with no regard for alpha maps */
370 storeProc32 store_scanline_raw_32;
371 storeProc64 store_scanline_raw_64;
373 /* Store a scanline, taking alpha maps into account */
374 scanStoreProc store_scanline_32;
375 scanStoreProc store_scanline_64;
377 /* Used for indirect access to the bits */
378 pixman_read_memory_func_t read_func;
379 pixman_write_memory_func_t write_func;
381 void * orig_data; /* Stores pointer to original
382 * data, when the image is
390 image_common_t common;
392 source_image_t source;
394 linear_gradient_t linear;
395 conical_gradient_t conical;
396 radial_gradient_t radial;
412 pixman_gradient_stop_t *stops;
420 _pixman_gradient_walker_init (GradientWalker *walker,
421 gradient_t *gradient,
422 unsigned int spread);
425 _pixman_gradient_walker_reset (GradientWalker *walker,
426 pixman_fixed_32_32_t pos);
429 _pixman_gradient_walker_pixel (GradientWalker *walker,
430 pixman_fixed_32_32_t x);
434 #define LOG2_BITMAP_PAD 5
435 #define FB_STIP_SHIFT LOG2_BITMAP_PAD
436 #define FB_STIP_UNIT (1 << FB_STIP_SHIFT)
437 #define FB_STIP_MASK (FB_STIP_UNIT - 1)
438 #define FB_STIP_ALLONES ((uint32_t) -1)
440 #if BITMAP_BIT_ORDER == LSBFirst
441 #define FbScrLeft(x,n) ((x) >> (n))
442 #define FbScrRight(x,n) ((x) << (n))
443 #define FbLeftStipBits(x,n) ((x) & ((((uint32_t) 1) << (n)) - 1))
445 #define FbScrLeft(x,n) ((x) << (n))
446 #define FbScrRight(x,n) ((x) >> (n))
447 #define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n)))
450 #define FbStipLeft(x,n) FbScrLeft(x,n)
451 #define FbStipRight(x,n) FbScrRight(x,n)
452 #define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \
453 FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK))
455 #define FbLeftMask(x) ( ((x) & FB_MASK) ? \
456 FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0)
457 #define FbRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \
458 FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0)
460 #define FbMaskBits(x,w,l,n,r) { \
462 r = FbRightMask((x)+n); \
465 n -= FB_UNIT - ((x) & FB_MASK); \
475 #if IMAGE_BYTE_ORDER == MSBFirst
476 #define Fetch24(img, a) ((unsigned long) (a) & 1 ? \
477 ((READ(img, a) << 16) | READ(img, (uint16_t *) ((a)+1))) : \
478 ((READ(img, (uint16_t *) (a)) << 8) | READ(img, (a)+2)))
479 #define Store24(img,a,v) ((unsigned long) (a) & 1 ? \
480 (WRITE(img, a, (uint8_t) ((v) >> 16)), \
481 WRITE(img, (uint16_t *) ((a)+1), (uint16_t) (v))) : \
482 (WRITE(img, (uint16_t *) (a), (uint16_t) ((v) >> 8)), \
483 WRITE(img, (a)+2, (uint8_t) (v))))
485 #define Fetch24(img,a) ((unsigned long) (a) & 1 ? \
486 (READ(img, a) | (READ(img, (uint16_t *) ((a)+1)) << 8)) : \
487 (READ(img, (uint16_t *) (a)) | (READ(img, (a)+2) << 16)))
488 #define Store24(img,a,v) ((unsigned long) (a) & 1 ? \
489 (WRITE(img, a, (uint8_t) (v)), \
490 WRITE(img, (uint16_t *) ((a)+1), (uint16_t) ((v) >> 8))) : \
491 (WRITE(img, (uint16_t *) (a), (uint16_t) (v)), \
492 WRITE(img, (a)+2, (uint8_t) ((v) >> 16))))
495 #define CvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \
496 (((s) >> 8) & 0xff) * 301 + \
497 (((s) ) & 0xff) * 58) >> 2)
498 #define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \
499 (((s) >> 6) & 0x03e0) | \
500 (((s) >> 9) & 0x7c00))
501 #define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15])
502 #define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24))
504 #define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
507 #define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) )
508 #define FbIntDiv(a,b) (((uint16_t) (a) * 255) / (b))
510 #define FbGet8(v,i) ((uint16_t) (uint8_t) ((v) >> i))
513 #define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \
514 (((s) >> 5) & 0x07e0) | \
515 (((s) >> 8) & 0xf800))
516 #define cvt0565to0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
517 ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
518 ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
521 * There are two ways of handling alpha -- either as a single unified value or
522 * a separate value for each component, hence each macro must have two
523 * versions. The unified alpha version has a 'U' at the end of the name,
524 * the component version has a 'C'. Similarly, functions which deal with
525 * this difference will have two versions using the same convention.
528 #define FbOverU(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),(a),(t)) + FbGet8(x,i), \
529 (uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
531 #define FbOverC(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),FbGet8(a,i),(t)) + FbGet8(x,i), \
532 (uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
534 #define FbInU(x,i,a,t) ((uint32_t) FbIntMult(FbGet8(x,i),(a),(t)) << (i))
536 #define FbInC(x,i,a,t) ((uint32_t) FbIntMult(FbGet8(x,i),FbGet8(a,i),(t)) << (i))
538 #define FbAdd(x,y,i,t) ((t) = FbGet8(x,i) + FbGet8(y,i), \
539 (uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
541 #define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8)
542 #define div_65535(x) (((x) + 0x8000 + (((x) + 0x8000) >> 16)) >> 16)
544 #define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
546 /* Divides two fixed-point numbers and returns an integer */
547 #define DIV(a,b) ((((a) < 0) == ((b) < 0)) ? (a) / (b) : \
548 ((a) - (b) + 1 - (((b) < 0) << 1)) / (b))
550 #define CLIP(a,b,c) ((a) < (b) ? (b) : ((a) > (c) ? (c) : (a)))
553 # define MIN(a,b) ((a < b)? a : b)
557 # define MAX(a,b) ((a > b)? a : b)
561 /* FIXME: the MOD macro above is equivalent, but faster I think */
562 #define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
565 /* FIXME: the (void)__read_func hides lots of warnings (which is what they
566 * are supposed to do), but some of them are real. For example the one
567 * where Fetch4 doesn't have a READ
570 #ifdef PIXMAN_FB_ACCESSORS
572 #define ACCESS(sym) sym##_accessors
574 #define READ(img, ptr) \
575 ((img)->common.read_func ((ptr), sizeof(*(ptr))))
576 #define WRITE(img, ptr,val) \
577 ((img)->common.write_func ((ptr), (val), sizeof (*(ptr))))
579 #define MEMCPY_WRAPPED(img, dst, src, size) \
582 uint8_t *_dst = (uint8_t*)(dst), *_src = (uint8_t*)(src); \
583 for(_i = 0; _i < size; _i++) { \
584 WRITE((img), _dst +_i, READ((img), _src + _i)); \
588 #define MEMSET_WRAPPED(img, dst, val, size) \
591 uint8_t *_dst = (uint8_t*)(dst); \
592 for(_i = 0; _i < (size_t) size; _i++) { \
593 WRITE((img), _dst +_i, (val)); \
599 #define ACCESS(sym) sym
601 #define READ(img, ptr) (*(ptr))
602 #define WRITE(img, ptr, val) (*(ptr) = (val))
603 #define MEMCPY_WRAPPED(img, dst, src, size) \
604 memcpy(dst, src, size)
605 #define MEMSET_WRAPPED(img, dst, val, size) \
606 memset(dst, val, size)
610 #define fbComposeGetSolid(img, res, fmt) \
613 pixman_format_code_t format__; \
614 if (img->type == SOLID) \
616 format__ = PIXMAN_a8r8g8b8; \
617 (res) = img->solid.color; \
621 uint32_t *bits__ = (img)->bits.bits; \
622 format__ = (img)->bits.format; \
624 switch (PIXMAN_FORMAT_BPP((img)->bits.format)) \
627 (res) = READ(img, (uint32_t *)bits__); \
630 (res) = Fetch24(img, (uint8_t *) bits__); \
633 (res) = READ(img, (uint16_t *) bits__); \
634 (res) = cvt0565to0888(res); \
637 (res) = READ(img, (uint8_t *) bits__); \
638 (res) = (res) << 24; \
641 (res) = READ(img, (uint32_t *) bits__); \
642 (res) = FbLeftStipBits((res),1) ? 0xff000000 : 0x00000000; \
647 /* manage missing src alpha */ \
648 if (!PIXMAN_FORMAT_A((img)->bits.format)) \
649 (res) |= 0xff000000; \
652 /* If necessary, convert RGB <--> BGR. */ \
653 if (PIXMAN_FORMAT_TYPE (format__) != PIXMAN_FORMAT_TYPE(fmt)) \
655 (res) = ((((res) & 0xff000000) >> 0) | \
656 (((res) & 0x00ff0000) >> 16) | \
657 (((res) & 0x0000ff00) >> 0) | \
658 (((res) & 0x000000ff) << 16)); \
663 #define fbComposeGetStart(pict,x,y,type,out_stride,line,mul) do { \
664 uint32_t *__bits__; \
668 __bits__ = pict->bits.bits; \
669 __stride__ = pict->bits.rowstride; \
670 __bpp__ = PIXMAN_FORMAT_BPP(pict->bits.format); \
671 (out_stride) = __stride__ * (int) sizeof (uint32_t) / (int) sizeof (type); \
672 (line) = ((type *) __bits__) + \
673 (out_stride) * (y) + (mul) * (x); \
677 #define PIXMAN_FORMAT_16BPC(f) (PIXMAN_FORMAT_A(f) > 8 || \
678 PIXMAN_FORMAT_R(f) > 8 || \
679 PIXMAN_FORMAT_G(f) > 8 || \
680 PIXMAN_FORMAT_B(f) > 8)
685 #define MAX_ALPHA(n) ((1 << (n)) - 1)
686 #define N_Y_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) - 1)
687 #define N_X_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) + 1)
689 #define STEP_Y_SMALL(n) (pixman_fixed_1 / N_Y_FRAC(n))
690 #define STEP_Y_BIG(n) (pixman_fixed_1 - (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
692 #define Y_FRAC_FIRST(n) (STEP_Y_SMALL(n) / 2)
693 #define Y_FRAC_LAST(n) (Y_FRAC_FIRST(n) + (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
695 #define STEP_X_SMALL(n) (pixman_fixed_1 / N_X_FRAC(n))
696 #define STEP_X_BIG(n) (pixman_fixed_1 - (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
698 #define X_FRAC_FIRST(n) (STEP_X_SMALL(n) / 2)
699 #define X_FRAC_LAST(n) (X_FRAC_FIRST(n) + (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
701 #define RenderSamplesX(x,n) ((n) == 1 ? 0 : (pixman_fixed_frac (x) + X_FRAC_FIRST(n)) / STEP_X_SMALL(n))
704 * Step across a small sample grid gap
706 #define RenderEdgeStepSmall(edge) { \
707 edge->x += edge->stepx_small; \
708 edge->e += edge->dx_small; \
711 edge->e -= edge->dy; \
712 edge->x += edge->signdx; \
717 * Step across a large sample grid gap
719 #define RenderEdgeStepBig(edge) { \
720 edge->x += edge->stepx_big; \
721 edge->e += edge->dx_big; \
724 edge->e -= edge->dy; \
725 edge->x += edge->signdx; \
730 pixman_rasterize_edges_accessors (pixman_image_t *image,
737 pixman_image_is_opaque(pixman_image_t *image);
740 pixman_image_can_get_solid (pixman_image_t *image);
743 pixman_compute_composite_region32 (pixman_region32_t * pRegion,
744 pixman_image_t * pSrc,
745 pixman_image_t * pMask,
746 pixman_image_t * pDst,
757 #if defined(__GNUC__) && __GNUC__ >= 4
758 #define PIXMAN_EXPORT __attribute__ ((visibility("default")))
759 /* Sun Studio 8 visibility */
760 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
761 #define PIXMAN_EXPORT __global
763 #define PIXMAN_EXPORT
767 pixman_bool_t pixman_region32_copy_from_region16 (pixman_region32_t *dst,
768 pixman_region16_t *src);
769 pixman_bool_t pixman_region16_copy_from_region32 (pixman_region16_t *dst,
770 pixman_region32_t *src);
771 void pixman_region_internal_set_static_pointers (pixman_box16_t *empty_box,
772 pixman_region16_data_t *empty_data,
773 pixman_region16_data_t *broken_data);
778 static inline uint64_t
779 oil_profile_stamp_rdtsc (void)
782 __asm__ __volatile__("rdtsc\n" : "=A" (ts));
785 #define OIL_STAMP oil_profile_stamp_rdtsc
787 typedef struct PixmanTimer PixmanTimer;
798 extern int timer_defined;
799 void pixman_timer_register (PixmanTimer *timer);
801 #define TIMER_BEGIN(tname) \
803 static PixmanTimer timer##tname; \
804 uint64_t begin##tname; \
806 if (!timer##tname.initialized) \
808 timer##tname.initialized = 1; \
809 timer##tname.name = #tname; \
810 pixman_timer_register (&timer##tname); \
813 timer##tname.n_times++; \
814 begin##tname = OIL_STAMP();
816 #define TIMER_END(tname) \
817 timer##tname.total += OIL_STAMP() - begin##tname; \
820 #endif /* PIXMAN_TIMERS */
822 typedef struct pixman_implementation_t pixman_implementation_t;
824 typedef void (* pixman_combine_32_func_t) (pixman_implementation_t * imp,
827 const uint32_t * src,
828 const uint32_t * mask,
831 typedef void (* pixman_combine_64_func_t) (pixman_implementation_t * imp,
834 const uint64_t * src,
835 const uint64_t * mask,
838 typedef void (* pixman_composite_func_t) (pixman_implementation_t * imp,
840 pixman_image_t * src,
841 pixman_image_t * mask,
842 pixman_image_t * dest,
851 typedef pixman_bool_t (* pixman_blt_func_t) (pixman_implementation_t * imp,
864 typedef pixman_bool_t (* pixman_fill_func_t) (pixman_implementation_t *imp,
875 _pixman_walk_composite_region (pixman_implementation_t *imp,
877 pixman_image_t * pSrc,
878 pixman_image_t * pMask,
879 pixman_image_t * pDst,
888 pixman_composite_func_t compositeRect);
890 void _pixman_setup_combiner_functions_32 (pixman_implementation_t *imp);
891 void _pixman_setup_combiner_functions_64 (pixman_implementation_t *imp);
893 /* These "formats" both have depth 0, so they
894 * will never clash with any real ones
896 #define PIXMAN_null PIXMAN_FORMAT(0,0,0,0,0,0)
897 #define PIXMAN_solid PIXMAN_FORMAT(0,1,0,0,0,0)
899 #define NEED_COMPONENT_ALPHA (1 << 0)
900 #define NEED_PIXBUF (1 << 1)
901 #define NEED_SOLID_MASK (1 << 2)
906 pixman_format_code_t src_format;
907 pixman_format_code_t mask_format;
908 pixman_format_code_t dest_format;
909 pixman_composite_func_t func;
913 struct pixman_implementation_t
915 pixman_implementation_t * toplevel;
916 pixman_implementation_t * delegate;
918 pixman_composite_func_t composite;
919 pixman_blt_func_t blt;
920 pixman_fill_func_t fill;
922 pixman_combine_32_func_t combine_32[PIXMAN_OP_LAST];
923 pixman_combine_32_func_t combine_32_ca[PIXMAN_OP_LAST];
924 pixman_combine_64_func_t combine_64[PIXMAN_OP_LAST];
925 pixman_combine_64_func_t combine_64_ca[PIXMAN_OP_LAST];
928 pixman_implementation_t *
929 _pixman_implementation_create (pixman_implementation_t *delegate);
932 _pixman_implementation_combine_32 (pixman_implementation_t * imp,
935 const uint32_t * src,
936 const uint32_t * mask,
939 _pixman_implementation_combine_64 (pixman_implementation_t * imp,
942 const uint64_t * src,
943 const uint64_t * mask,
946 _pixman_implementation_combine_32_ca (pixman_implementation_t * imp,
949 const uint32_t * src,
950 const uint32_t * mask,
953 _pixman_implementation_combine_64_ca (pixman_implementation_t * imp,
956 const uint64_t * src,
957 const uint64_t * mask,
960 _pixman_implementation_composite (pixman_implementation_t * imp,
962 pixman_image_t * src,
963 pixman_image_t * mask,
964 pixman_image_t * dest,
975 _pixman_implementation_blt (pixman_implementation_t * imp,
989 _pixman_implementation_fill (pixman_implementation_t * imp,
999 /* Specific implementations */
1000 pixman_implementation_t *
1001 _pixman_implementation_create_general (void);
1002 pixman_implementation_t *
1003 _pixman_implementation_create_fast_path (void);
1005 pixman_implementation_t *
1006 _pixman_implementation_create_mmx (void);
1009 pixman_implementation_t *
1010 _pixman_implementation_create_sse2 (void);
1013 pixman_implementation_t *
1014 _pixman_implementation_create_arm_simd (void);
1017 pixman_implementation_t *
1018 _pixman_implementation_create_arm_neon (void);
1021 pixman_implementation_t *
1022 _pixman_implementation_create_vmx (void);
1026 _pixman_run_fast_path (const FastPathInfo *paths,
1027 pixman_implementation_t *imp,
1029 pixman_image_t *src,
1030 pixman_image_t *mask,
1031 pixman_image_t *dest,
1041 pixman_implementation_t *
1042 _pixman_choose_implementation (void);
1044 #endif /* PIXMAN_PRIVATE_H */