From 22f322fe246155d40465d4e14d65051a204f27f6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Mon, 13 Jul 2009 01:35:15 -0400 Subject: [PATCH] Reindent and reformat pixman-private.h --- pixman/pixman-compiler.h | 12 +- pixman/pixman-private.h | 823 +++++++++++++++++++++++++---------------------- 2 files changed, 442 insertions(+), 393 deletions(-) diff --git a/pixman/pixman-compiler.h b/pixman/pixman-compiler.h index 466199d..9647dbb 100644 --- a/pixman/pixman-compiler.h +++ b/pixman/pixman-compiler.h @@ -54,18 +54,18 @@ # define inline __inline__ # define force_inline __inline__ __attribute__ ((__always_inline__)) #else -# ifndef force_inline -# define force_inline inline -# endif +# ifndef force_inline +# define force_inline inline +# endif #endif /* GCC visibility */ #if defined(__GNUC__) && __GNUC__ >= 4 -#define PIXMAN_EXPORT __attribute__ ((visibility("default"))) +# define PIXMAN_EXPORT __attribute__ ((visibility("default"))) /* Sun Studio 8 visibility */ #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) -#define PIXMAN_EXPORT __global +# define PIXMAN_EXPORT __global #else -#define PIXMAN_EXPORT +# define PIXMAN_EXPORT #endif diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 081d35c..07259a0 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -26,16 +26,23 @@ typedef struct radial_gradient radial_gradient_t; typedef struct bits_image bits_image_t; typedef struct circle circle_t; -typedef void (*fetch_scanline_t) (pixman_image_t *pict, - int x, int y, int width, - uint32_t *buffer, - const uint32_t *mask, - uint32_t mask_bits); -typedef void (*fetch_pixels_t) (bits_image_t *image, - uint32_t *buffer, int n_pixels); -typedef void (*store_scanline_t) (bits_image_t *image, - int x, int y, int width, - const uint32_t *values); +typedef void (*fetch_scanline_t) (pixman_image_t *pict, + int x, + int y, + int width, + uint32_t *buffer, + const uint32_t *mask, + uint32_t mask_bits); + +typedef void (*fetch_pixels_t) (bits_image_t * image, + uint32_t * buffer, + int n_pixels); + +typedef void (*store_scanline_t) (bits_image_t * image, + int x, + int y, + int width, + const uint32_t *values); typedef enum { @@ -53,72 +60,72 @@ typedef enum SOURCE_IMAGE_CLASS_VERTICAL, } source_pict_class_t; -typedef source_pict_class_t (* classify_func_t) (pixman_image_t *image, - int x, - int y, - int width, - int height); -typedef void (* property_changed_func_t) (pixman_image_t *image); +typedef source_pict_class_t (*classify_func_t) (pixman_image_t *image, + int x, + int y, + int width, + int height); +typedef void (*property_changed_func_t) (pixman_image_t *image); struct image_common { - image_type_t type; - int32_t ref_count; - pixman_region32_t clip_region; - pixman_bool_t have_clip_region; /* FALSE if there is no clip */ - pixman_bool_t client_clip; /* Whether the source clip was + image_type_t type; + int32_t ref_count; + pixman_region32_t clip_region; + pixman_bool_t have_clip_region; /* FALSE if there is no clip */ + pixman_bool_t client_clip; /* Whether the source clip was set by a client */ - pixman_bool_t clip_sources; /* Whether the clip applies when + pixman_bool_t clip_sources; /* Whether the clip applies when * the image is used as a source */ - pixman_bool_t need_workaround; - pixman_transform_t *transform; - pixman_repeat_t repeat; - pixman_filter_t filter; - pixman_fixed_t *filter_params; - int n_filter_params; - bits_image_t *alpha_map; - int alpha_origin_x; - int alpha_origin_y; - pixman_bool_t component_alpha; - pixman_read_memory_func_t read_func; - pixman_write_memory_func_t write_func; - classify_func_t classify; - property_changed_func_t property_changed; - fetch_scanline_t get_scanline_32; - fetch_scanline_t get_scanline_64; + pixman_bool_t need_workaround; + pixman_transform_t * transform; + pixman_repeat_t repeat; + pixman_filter_t filter; + pixman_fixed_t * filter_params; + int n_filter_params; + bits_image_t * alpha_map; + int alpha_origin_x; + int alpha_origin_y; + pixman_bool_t component_alpha; + pixman_read_memory_func_t read_func; + pixman_write_memory_func_t write_func; + classify_func_t classify; + property_changed_func_t property_changed; + fetch_scanline_t get_scanline_32; + fetch_scanline_t get_scanline_64; pixman_image_destroy_func_t destroy_func; - void * destroy_data; + void * destroy_data; }; struct source_image { - image_common_t common; + image_common_t common; source_pict_class_t class; }; struct solid_fill { - source_image_t common; - uint32_t color; /* FIXME: shouldn't this be a pixman_color_t? */ + source_image_t common; + uint32_t color; /* FIXME: shouldn't this be a pixman_color_t? */ }; struct gradient { - source_image_t common; - int n_stops; - pixman_gradient_stop_t * stops; - int stop_range; - uint32_t * color_table; - int color_table_size; + source_image_t common; + int n_stops; + pixman_gradient_stop_t *stops; + int stop_range; + uint32_t * color_table; + int color_table_size; }; struct linear_gradient { - gradient_t common; - pixman_point_fixed_t p1; - pixman_point_fixed_t p2; + gradient_t common; + pixman_point_fixed_t p1; + pixman_point_fixed_t p2; }; struct circle @@ -130,142 +137,162 @@ struct circle struct radial_gradient { - gradient_t common; - - circle_t c1; - circle_t c2; - double cdx; - double cdy; - double dr; - double A; + gradient_t common; + + circle_t c1; + circle_t c2; + double cdx; + double cdy; + double dr; + double A; }; struct conical_gradient { - gradient_t common; - pixman_point_fixed_t center; - pixman_fixed_t angle; + gradient_t common; + pixman_point_fixed_t center; + pixman_fixed_t angle; }; struct bits_image { - image_common_t common; - pixman_format_code_t format; - const pixman_indexed_t *indexed; - int width; - int height; - uint32_t * bits; - uint32_t * free_me; - int rowstride; /* in number of uint32_t's */ + image_common_t common; + pixman_format_code_t format; + const pixman_indexed_t * indexed; + int width; + int height; + uint32_t * bits; + uint32_t * free_me; + int rowstride; /* in number of uint32_t's */ /* Fetch raw pixels, with no regard for transformations, alpha map etc. */ - fetch_pixels_t fetch_pixels_raw_32; - fetch_pixels_t fetch_pixels_raw_64; + fetch_pixels_t fetch_pixels_raw_32; + fetch_pixels_t fetch_pixels_raw_64; /* Fetch raw scanlines, with no regard for transformations, alpha maps etc. */ - fetch_scanline_t fetch_scanline_raw_32; - fetch_scanline_t fetch_scanline_raw_64; + fetch_scanline_t fetch_scanline_raw_32; + fetch_scanline_t fetch_scanline_raw_64; /* Store scanlines with no regard for alpha maps */ - store_scanline_t store_scanline_raw_32; - store_scanline_t store_scanline_raw_64; + store_scanline_t store_scanline_raw_32; + store_scanline_t store_scanline_raw_64; /* Store a scanline, taking alpha maps into account */ - store_scanline_t store_scanline_32; - store_scanline_t store_scanline_64; + store_scanline_t store_scanline_32; + store_scanline_t store_scanline_64; /* Used for indirect access to the bits */ - pixman_read_memory_func_t read_func; - pixman_write_memory_func_t write_func; + pixman_read_memory_func_t read_func; + pixman_write_memory_func_t write_func; }; union pixman_image { - image_type_t type; - image_common_t common; - bits_image_t bits; - source_image_t source; - gradient_t gradient; - linear_gradient_t linear; - conical_gradient_t conical; - radial_gradient_t radial; - solid_fill_t solid; + image_type_t type; + image_common_t common; + bits_image_t bits; + source_image_t source; + gradient_t gradient; + linear_gradient_t linear; + conical_gradient_t conical; + radial_gradient_t radial; + solid_fill_t solid; }; void -_pixman_bits_image_setup_raw_accessors (bits_image_t *image); +_pixman_bits_image_setup_raw_accessors (bits_image_t *image); void _pixman_image_get_scanline_generic_64 (pixman_image_t *pict, - int x, - int y, - int width, - uint32_t *buffer, - const uint32_t *mask, - uint32_t mask_bits); + int x, + int y, + int width, + uint32_t * buffer, + const uint32_t *mask, + uint32_t mask_bits); source_pict_class_t _pixman_image_classify (pixman_image_t *image, - int x, - int y, - int width, - int height); + int x, + int y, + int width, + int height); void -_pixman_image_get_scanline_32 (pixman_image_t *image, int x, int y, int width, uint32_t *buffer, - const uint32_t *mask, uint32_t mask_bits); +_pixman_image_get_scanline_32 (pixman_image_t *image, + int x, + int y, + int width, + uint32_t * buffer, + const uint32_t *mask, + uint32_t mask_bits); /* Even thought the type of buffer is uint32_t *, the function actually expects * a uint64_t *buffer. */ void -_pixman_image_get_scanline_64 (pixman_image_t *image, int x, int y, int width, uint32_t *buffer, - const uint32_t *unused, uint32_t unused2); +_pixman_image_get_scanline_64 (pixman_image_t *image, + int x, + int y, + int width, + uint32_t * buffer, + const uint32_t *unused, + uint32_t unused2); void -_pixman_image_store_scanline_32 (bits_image_t *image, int x, int y, int width, - const uint32_t *buffer); +_pixman_image_store_scanline_32 (bits_image_t * image, + int x, + int y, + int width, + const uint32_t *buffer); void -_pixman_image_fetch_pixels (bits_image_t *image, uint32_t *buffer, - int n_pixels); +_pixman_image_fetch_pixels (bits_image_t *image, + uint32_t * buffer, + int n_pixels); -/* Even thought the type of buffer is uint32_t *, the function actually expects - * a uint64_t *buffer. +/* Even though the type of buffer is uint32_t *, the function + * actually expects a uint64_t *buffer. */ void -_pixman_image_store_scanline_64 (bits_image_t *image, int x, int y, int width, - const uint32_t *buffer); +_pixman_image_store_scanline_64 (bits_image_t * image, + int x, + int y, + int width, + const uint32_t *buffer); pixman_image_t * _pixman_image_allocate (void); pixman_bool_t -_pixman_init_gradient (gradient_t *gradient, - const pixman_gradient_stop_t *stops, - int n_stops); +_pixman_init_gradient (gradient_t * gradient, + const pixman_gradient_stop_t *stops, + int n_stops); void _pixman_image_reset_clip_region (pixman_image_t *image); pixman_bool_t -_pixman_image_is_opaque(pixman_image_t *image); +_pixman_image_is_opaque (pixman_image_t *image); pixman_bool_t _pixman_image_is_solid (pixman_image_t *image); uint32_t -_pixman_image_get_solid (pixman_image_t *image, - pixman_format_code_t format); +_pixman_image_get_solid (pixman_image_t * image, + pixman_format_code_t format); -#define PIXMAN_IMAGE_GET_LINE(pict,x,y,type,out_stride,line,mul) do { \ - uint32_t *__bits__; \ - int __stride__; \ - \ - __bits__ = pict->bits.bits; \ - __stride__ = pict->bits.rowstride; \ - (out_stride) = __stride__ * (int) sizeof (uint32_t) / (int) sizeof (type); \ - (line) = ((type *) __bits__) + \ - (out_stride) * (y) + (mul) * (x); \ +#define PIXMAN_IMAGE_GET_LINE(pict, x, y, type, out_stride, line, mul) \ + do \ + { \ + uint32_t *__bits__; \ + int __stride__; \ + \ + __bits__ = pict->bits.bits; \ + __stride__ = pict->bits.rowstride; \ + (out_stride) = \ + __stride__ * (int) sizeof (uint32_t) / (int) sizeof (type); \ + (line) = \ + ((type *) __bits__) + (out_stride) * (y) + (mul) * (x); \ } while (0) /* @@ -273,62 +300,64 @@ _pixman_image_get_solid (pixman_image_t *image, */ typedef struct { - uint32_t left_ag; - uint32_t left_rb; - uint32_t right_ag; - uint32_t right_rb; - int32_t left_x; - int32_t right_x; - int32_t stepper; - - pixman_gradient_stop_t *stops; - int num_stops; - unsigned int spread; - - int need_reset; + uint32_t left_ag; + uint32_t left_rb; + uint32_t right_ag; + uint32_t right_rb; + int32_t left_x; + int32_t right_x; + int32_t stepper; + + pixman_gradient_stop_t *stops; + int num_stops; + unsigned int spread; + + int need_reset; } pixman_gradient_walker_t; void -_pixman_gradient_walker_init (pixman_gradient_walker_t *walker, - gradient_t *gradient, - unsigned int spread); +_pixman_gradient_walker_init (pixman_gradient_walker_t *walker, + gradient_t * gradient, + unsigned int spread); void -_pixman_gradient_walker_reset (pixman_gradient_walker_t *walker, - pixman_fixed_32_32_t pos); +_pixman_gradient_walker_reset (pixman_gradient_walker_t *walker, + pixman_fixed_32_32_t pos); uint32_t -_pixman_gradient_walker_pixel (pixman_gradient_walker_t *walker, - pixman_fixed_32_32_t x); +_pixman_gradient_walker_pixel (pixman_gradient_walker_t *walker, + pixman_fixed_32_32_t x); /* * Edges */ -#define MAX_ALPHA(n) ((1 << (n)) - 1) -#define N_Y_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) - 1) -#define N_X_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) + 1) +#define MAX_ALPHA(n) ((1 << (n)) - 1) +#define N_Y_FRAC(n) ((n) == 1 ? 1 : (1 << ((n) / 2)) - 1) +#define N_X_FRAC(n) ((n) == 1 ? 1 : (1 << ((n) / 2)) + 1) -#define STEP_Y_SMALL(n) (pixman_fixed_1 / N_Y_FRAC(n)) -#define STEP_Y_BIG(n) (pixman_fixed_1 - (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n)) +#define STEP_Y_SMALL(n) (pixman_fixed_1 / N_Y_FRAC (n)) +#define STEP_Y_BIG(n) (pixman_fixed_1 - (N_Y_FRAC (n) - 1) * STEP_Y_SMALL (n)) -#define Y_FRAC_FIRST(n) (STEP_Y_SMALL(n) / 2) -#define Y_FRAC_LAST(n) (Y_FRAC_FIRST(n) + (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n)) +#define Y_FRAC_FIRST(n) (STEP_Y_SMALL (n) / 2) +#define Y_FRAC_LAST(n) (Y_FRAC_FIRST (n) + (N_Y_FRAC (n) - 1) * STEP_Y_SMALL (n)) -#define STEP_X_SMALL(n) (pixman_fixed_1 / N_X_FRAC(n)) -#define STEP_X_BIG(n) (pixman_fixed_1 - (N_X_FRAC(n) - 1) * STEP_X_SMALL(n)) +#define STEP_X_SMALL(n) (pixman_fixed_1 / N_X_FRAC (n)) +#define STEP_X_BIG(n) (pixman_fixed_1 - (N_X_FRAC (n) - 1) * STEP_X_SMALL (n)) -#define X_FRAC_FIRST(n) (STEP_X_SMALL(n) / 2) -#define X_FRAC_LAST(n) (X_FRAC_FIRST(n) + (N_X_FRAC(n) - 1) * STEP_X_SMALL(n)) +#define X_FRAC_FIRST(n) (STEP_X_SMALL (n) / 2) +#define X_FRAC_LAST(n) (X_FRAC_FIRST (n) + (N_X_FRAC (n) - 1) * STEP_X_SMALL (n)) -#define RENDER_SAMPLES_X(x,n) ((n) == 1 ? 0 : (pixman_fixed_frac (x) + X_FRAC_FIRST(n)) / STEP_X_SMALL(n)) +#define RENDER_SAMPLES_X(x, n) \ + ((n) == 1? 0 : (pixman_fixed_frac (x) + \ + X_FRAC_FIRST (n)) / STEP_X_SMALL (n)) void pixman_rasterize_edges_accessors (pixman_image_t *image, - pixman_edge_t *l, - pixman_edge_t *r, - pixman_fixed_t t, - pixman_fixed_t b); + pixman_edge_t * l, + pixman_edge_t * r, + pixman_fixed_t t, + pixman_fixed_t b); /* * Implementations @@ -336,166 +365,173 @@ pixman_rasterize_edges_accessors (pixman_image_t *image, typedef struct pixman_implementation_t pixman_implementation_t; -typedef void (* pixman_combine_32_func_t) (pixman_implementation_t * imp, - pixman_op_t op, - uint32_t * dest, - const uint32_t * src, - const uint32_t * mask, - int width); - -typedef void (* pixman_combine_64_func_t) (pixman_implementation_t * imp, - pixman_op_t op, - uint64_t * dest, - const uint64_t * src, - const uint64_t * mask, - int width); - -typedef void (* pixman_composite_func_t) (pixman_implementation_t * imp, - pixman_op_t op, - pixman_image_t * src, - pixman_image_t * mask, - pixman_image_t * dest, - int32_t src_x, - int32_t src_y, - int32_t mask_x, - int32_t mask_y, - int32_t dest_x, - int32_t dest_y, - int32_t width, - int32_t height); -typedef pixman_bool_t (* pixman_blt_func_t) (pixman_implementation_t * imp, - uint32_t * src_bits, - uint32_t * dst_bits, - int src_stride, - int dst_stride, - int src_bpp, - int dst_bpp, - int src_x, - int src_y, - int dst_x, - int dst_y, - int width, - int height); -typedef pixman_bool_t (* pixman_fill_func_t) (pixman_implementation_t *imp, - uint32_t *bits, - int stride, - int bpp, - int x, - int y, - int width, - int height, - uint32_t xor); +typedef void (*pixman_combine_32_func_t) (pixman_implementation_t *imp, + pixman_op_t op, + uint32_t * dest, + const uint32_t * src, + const uint32_t * mask, + int width); + +typedef void (*pixman_combine_64_func_t) (pixman_implementation_t *imp, + pixman_op_t op, + uint64_t * dest, + const uint64_t * src, + const uint64_t * mask, + int width); + +typedef void (*pixman_composite_func_t) (pixman_implementation_t *imp, + pixman_op_t op, + pixman_image_t * src, + pixman_image_t * mask, + pixman_image_t * dest, + int32_t src_x, + int32_t src_y, + int32_t mask_x, + int32_t mask_y, + int32_t dest_x, + int32_t dest_y, + int32_t width, + int32_t height); +typedef pixman_bool_t (*pixman_blt_func_t) (pixman_implementation_t *imp, + uint32_t * src_bits, + uint32_t * dst_bits, + int src_stride, + int dst_stride, + int src_bpp, + int dst_bpp, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height); +typedef pixman_bool_t (*pixman_fill_func_t) (pixman_implementation_t *imp, + uint32_t * bits, + int stride, + int bpp, + int x, + int y, + int width, + int height, + uint32_t xor); void _pixman_setup_combiner_functions_32 (pixman_implementation_t *imp); void _pixman_setup_combiner_functions_64 (pixman_implementation_t *imp); struct pixman_implementation_t { - pixman_implementation_t * toplevel; - pixman_implementation_t * delegate; - - pixman_composite_func_t composite; - pixman_blt_func_t blt; - pixman_fill_func_t fill; - - pixman_combine_32_func_t combine_32[PIXMAN_OP_LAST]; - pixman_combine_32_func_t combine_32_ca[PIXMAN_OP_LAST]; - pixman_combine_64_func_t combine_64[PIXMAN_OP_LAST]; - pixman_combine_64_func_t combine_64_ca[PIXMAN_OP_LAST]; + pixman_implementation_t *toplevel; + pixman_implementation_t *delegate; + + pixman_composite_func_t composite; + pixman_blt_func_t blt; + pixman_fill_func_t fill; + + pixman_combine_32_func_t combine_32[PIXMAN_OP_LAST]; + pixman_combine_32_func_t combine_32_ca[PIXMAN_OP_LAST]; + pixman_combine_64_func_t combine_64[PIXMAN_OP_LAST]; + pixman_combine_64_func_t combine_64_ca[PIXMAN_OP_LAST]; }; pixman_implementation_t * _pixman_implementation_create (pixman_implementation_t *delegate); void -_pixman_implementation_combine_32 (pixman_implementation_t * imp, - pixman_op_t op, - uint32_t * dest, - const uint32_t * src, - const uint32_t * mask, - int width); +_pixman_implementation_combine_32 (pixman_implementation_t *imp, + pixman_op_t op, + uint32_t * dest, + const uint32_t * src, + const uint32_t * mask, + int width); void -_pixman_implementation_combine_64 (pixman_implementation_t * imp, - pixman_op_t op, - uint64_t * dest, - const uint64_t * src, - const uint64_t * mask, - int width); +_pixman_implementation_combine_64 (pixman_implementation_t *imp, + pixman_op_t op, + uint64_t * dest, + const uint64_t * src, + const uint64_t * mask, + int width); void -_pixman_implementation_combine_32_ca (pixman_implementation_t * imp, - pixman_op_t op, - uint32_t * dest, - const uint32_t * src, - const uint32_t * mask, - int width); +_pixman_implementation_combine_32_ca (pixman_implementation_t *imp, + pixman_op_t op, + uint32_t * dest, + const uint32_t * src, + const uint32_t * mask, + int width); void -_pixman_implementation_combine_64_ca (pixman_implementation_t * imp, - pixman_op_t op, - uint64_t * dest, - const uint64_t * src, - const uint64_t * mask, - int width); +_pixman_implementation_combine_64_ca (pixman_implementation_t *imp, + pixman_op_t op, + uint64_t * dest, + const uint64_t * src, + const uint64_t * mask, + int width); void -_pixman_implementation_composite (pixman_implementation_t * imp, - pixman_op_t op, - pixman_image_t * src, - pixman_image_t * mask, - pixman_image_t * dest, - int32_t src_x, - int32_t src_y, - int32_t mask_x, - int32_t mask_y, - int32_t dest_x, - int32_t dest_y, - int32_t width, - int32_t height); +_pixman_implementation_composite (pixman_implementation_t *imp, + pixman_op_t op, + pixman_image_t * src, + pixman_image_t * mask, + pixman_image_t * dest, + int32_t src_x, + int32_t src_y, + int32_t mask_x, + int32_t mask_y, + int32_t dest_x, + int32_t dest_y, + int32_t width, + int32_t height); pixman_bool_t -_pixman_implementation_blt (pixman_implementation_t * imp, - uint32_t * src_bits, - uint32_t * dst_bits, - int src_stride, - int dst_stride, - int src_bpp, - int dst_bpp, - int src_x, - int src_y, - int dst_x, - int dst_y, - int width, - int height); +_pixman_implementation_blt (pixman_implementation_t *imp, + uint32_t * src_bits, + uint32_t * dst_bits, + int src_stride, + int dst_stride, + int src_bpp, + int dst_bpp, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height); + pixman_bool_t -_pixman_implementation_fill (pixman_implementation_t * imp, - uint32_t *bits, - int stride, - int bpp, - int x, - int y, - int width, - int height, - uint32_t xor); - +_pixman_implementation_fill (pixman_implementation_t *imp, + uint32_t * bits, + int stride, + int bpp, + int x, + int y, + int width, + int height, + uint32_t xor); + /* Specific implementations */ pixman_implementation_t * _pixman_implementation_create_general (void); + pixman_implementation_t * _pixman_implementation_create_fast_path (void); + #ifdef USE_MMX pixman_implementation_t * _pixman_implementation_create_mmx (void); #endif + #ifdef USE_SSE2 pixman_implementation_t * _pixman_implementation_create_sse2 (void); #endif + #ifdef USE_ARM_SIMD pixman_implementation_t * _pixman_implementation_create_arm_simd (void); #endif + #ifdef USE_ARM_NEON pixman_implementation_t * _pixman_implementation_create_arm_neon (void); #endif + #ifdef USE_VMX pixman_implementation_t * _pixman_implementation_create_vmx (void); @@ -513,21 +549,21 @@ _pixman_choose_implementation (void); /* These "formats" both have depth 0, so they * will never clash with any real ones */ -#define PIXMAN_null PIXMAN_FORMAT(0,0,0,0,0,0) -#define PIXMAN_solid PIXMAN_FORMAT(0,1,0,0,0,0) +#define PIXMAN_null PIXMAN_FORMAT (0, 0, 0, 0, 0, 0) +#define PIXMAN_solid PIXMAN_FORMAT (0, 1, 0, 0, 0, 0) -#define NEED_COMPONENT_ALPHA (1 << 0) -#define NEED_PIXBUF (1 << 1) -#define NEED_SOLID_MASK (1 << 2) +#define NEED_COMPONENT_ALPHA (1 << 0) +#define NEED_PIXBUF (1 << 1) +#define NEED_SOLID_MASK (1 << 2) typedef struct { - pixman_op_t op; - pixman_format_code_t src_format; - pixman_format_code_t mask_format; - pixman_format_code_t dest_format; - pixman_composite_func_t func; - uint32_t flags; + pixman_op_t op; + pixman_format_code_t src_format; + pixman_format_code_t mask_format; + pixman_format_code_t dest_format; + pixman_composite_func_t func; + uint32_t flags; } pixman_fast_path_t; /* Memory allocation helpers */ @@ -546,51 +582,56 @@ pixman_addition_overflows_int (unsigned int a, unsigned int b); /* Compositing utilities */ pixman_bool_t _pixman_run_fast_path (const pixman_fast_path_t *paths, - pixman_implementation_t *imp, - pixman_op_t op, - pixman_image_t *src, - pixman_image_t *mask, - pixman_image_t *dest, - int32_t src_x, - int32_t src_y, - int32_t mask_x, - int32_t mask_y, - int32_t dest_x, - int32_t dest_y, - int32_t width, - int32_t height); - + pixman_implementation_t * imp, + pixman_op_t op, + pixman_image_t * src, + pixman_image_t * mask, + pixman_image_t * dest, + int32_t src_x, + int32_t src_y, + int32_t mask_x, + int32_t mask_y, + int32_t dest_x, + int32_t dest_y, + int32_t width, + int32_t height); + void _pixman_walk_composite_region (pixman_implementation_t *imp, - pixman_op_t op, - pixman_image_t * src_image, - pixman_image_t * mask_image, - pixman_image_t * dst_image, - int16_t src_x, - int16_t src_y, - int16_t mask_x, - int16_t mask_y, - int16_t dest_x, - int16_t dest_y, - uint16_t width, - uint16_t height, - pixman_composite_func_t composite_rect); + pixman_op_t op, + pixman_image_t * src_image, + pixman_image_t * mask_image, + pixman_image_t * dst_image, + int16_t src_x, + int16_t src_y, + int16_t mask_x, + int16_t mask_y, + int16_t dest_x, + int16_t dest_y, + uint16_t width, + uint16_t height, + pixman_composite_func_t composite_rect); void -pixman_expand (uint64_t *dst, const uint32_t *src, pixman_format_code_t, int width); +pixman_expand (uint64_t * dst, + const uint32_t * src, + pixman_format_code_t format, + int width); void -pixman_contract (uint32_t *dst, const uint64_t *src, int width); +pixman_contract (uint32_t * dst, + const uint64_t *src, + int width); /* Region Helpers */ pixman_bool_t pixman_region32_copy_from_region16 (pixman_region32_t *dst, - pixman_region16_t *src); + pixman_region16_t *src); pixman_bool_t pixman_region16_copy_from_region32 (pixman_region16_t *dst, - pixman_region32_t *src); + pixman_region32_t *src); /* Misc macros */ @@ -604,35 +645,40 @@ pixman_region16_copy_from_region32 (pixman_region16_t *dst, #endif #ifndef MIN -# define MIN(a,b) ((a < b)? a : b) +# define MIN(a, b) ((a < b) ? a : b) #endif #ifndef MAX -# define MAX(a,b) ((a > b)? a : b) +# define MAX(a, b) ((a > b) ? a : b) #endif /* Integer division that rounds towards -infinity */ -#define DIV(a,b) ((((a) < 0) == ((b) < 0)) ? (a) / (b) : \ - ((a) - (b) + 1 - (((b) < 0) << 1)) / (b)) +#define DIV(a, b) \ + ((((a) < 0) == ((b) < 0)) ? (a) / (b) : \ + ((a) - (b) + 1 - (((b) < 0) << 1)) / (b)) /* Modulus that produces the remainder wrt. DIV */ -#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b)) +#define MOD(a, b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b)) -#define CLIP(v,low,high) ((v) < (low) ? (low) : ((v) > (high) ? (high) : (v))) +#define CLIP(v, low, high) ((v) < (low) ? (low) : ((v) > (high) ? (high) : (v))) /* Conversion between 8888 and 0565 */ -#define CONVERT_8888_TO_0565(s) ((((s) >> 3) & 0x001f) | \ - (((s) >> 5) & 0x07e0) | \ - (((s) >> 8) & 0xf800)) -#define CONVERT_0565_TO_0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \ - ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \ - ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000))) +#define CONVERT_8888_TO_0565(s) \ + ((((s) >> 3) & 0x001f) | \ + (((s) >> 5) & 0x07e0) | \ + (((s) >> 8) & 0xf800)) + +#define CONVERT_0565_TO_0888(s) \ + (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \ + ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \ + ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000))) -#define PIXMAN_FORMAT_IS_WIDE(f) (PIXMAN_FORMAT_A(f) > 8 || \ - PIXMAN_FORMAT_R(f) > 8 || \ - PIXMAN_FORMAT_G(f) > 8 || \ - PIXMAN_FORMAT_B(f) > 8) +#define PIXMAN_FORMAT_IS_WIDE(f) \ + (PIXMAN_FORMAT_A (f) > 8 || \ + PIXMAN_FORMAT_R (f) > 8 || \ + PIXMAN_FORMAT_G (f) > 8 || \ + PIXMAN_FORMAT_B (f) > 8) /* * Various debugging code @@ -643,44 +689,44 @@ pixman_region16_copy_from_region32 (pixman_region16_t *dst, #if DEBUG -#define return_if_fail(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf(stderr, "In %s: %s failed\n", FUNC, #expr); \ - return; \ - } \ - } \ +#define return_if_fail(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "In %s: %s failed\n", FUNC, # expr); \ + return; \ + } \ + } \ while (0) -#define return_val_if_fail(expr, retval) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf(stderr, "In %s: %s failed\n", FUNC, #expr); \ - return (retval); \ - } \ - } \ +#define return_val_if_fail(expr, retval) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "In %s: %s failed\n", FUNC, # expr); \ + return (retval); \ + } \ + } \ while (0) #else -#define return_if_fail(expr) \ - do \ - { \ +#define return_if_fail(expr) \ + do \ + { \ if (!(expr)) \ return; \ - } \ + } \ while (0) -#define return_val_if_fail(expr, retval) \ - do \ - { \ +#define return_val_if_fail(expr, retval) \ + do \ + { \ if (!(expr)) \ return (retval); \ - } \ + } \ while (0) #endif @@ -695,42 +741,45 @@ static inline uint64_t oil_profile_stamp_rdtsc (void) { uint64_t ts; - __asm__ __volatile__("rdtsc\n" : "=A" (ts)); + + __asm__ __volatile__ ("rdtsc\n" : "=A" (ts)); return ts; } + #define OIL_STAMP oil_profile_stamp_rdtsc typedef struct pixman_timer_t pixman_timer_t; struct pixman_timer_t { - int initialized; - const char *name; - uint64_t n_times; - uint64_t total; + int initialized; + const char * name; + uint64_t n_times; + uint64_t total; pixman_timer_t *next; }; extern int timer_defined; + void pixman_timer_register (pixman_timer_t *timer); -#define TIMER_BEGIN(tname) \ - { \ - static pixman_timer_t timer##tname; \ - uint64_t begin##tname; \ - \ - if (!timer##tname.initialized) \ - { \ - timer##tname.initialized = 1; \ - timer##tname.name = #tname; \ - pixman_timer_register (&timer##tname); \ - } \ +#define TIMER_BEGIN(tname) \ + { \ + static pixman_timer_t timer ## tname; \ + uint64_t begin ## tname; \ + \ + if (!timer ## tname.initialized) \ + { \ + timer ## tname.initialized = 1; \ + timer ## tname.name = # tname; \ + pixman_timer_register (&timer ## tname); \ + } \ \ - timer##tname.n_times++; \ - begin##tname = OIL_STAMP(); + timer ## tname.n_times++; \ + begin ## tname = OIL_STAMP (); -#define TIMER_END(tname) \ - timer##tname.total += OIL_STAMP() - begin##tname; \ +#define TIMER_END(tname) \ + timer ## tname.total += OIL_STAMP () - begin ## tname; \ } #endif /* PIXMAN_TIMERS */ -- 2.7.4