Use MAKE_ACCESSORS() to generate accessors for the a1 format.
[profile/ivi/pixman.git] / pixman / pixman-private.h
index ea9545f..90d9011 100644 (file)
@@ -233,39 +233,22 @@ void
 _pixman_bits_image_setup_accessors (bits_image_t *image);
 
 void
-_pixman_bits_image_src_iter_init (pixman_image_t *image,
-                                 pixman_iter_t *iter,
-                                 int x, int y, int width, int height,
-                                 uint8_t *buffer, iter_flags_t flags);
+_pixman_bits_image_src_iter_init (pixman_image_t *image, pixman_iter_t *iter);
+
 void
-_pixman_bits_image_dest_iter_init (pixman_image_t *image,
-                                  pixman_iter_t *iter,
-                                  int x, int y, int width, int height,
-                                  uint8_t *buffer, iter_flags_t flags);
+_pixman_bits_image_dest_iter_init (pixman_image_t *image, pixman_iter_t *iter);
 
 void
-_pixman_solid_fill_iter_init (pixman_image_t *image,
-                             pixman_iter_t  *iter,
-                             int x, int y, int width, int height,
-                             uint8_t *buffer, iter_flags_t flags);
+_pixman_solid_fill_iter_init (pixman_image_t *image, pixman_iter_t  *iter);
 
 void
-_pixman_linear_gradient_iter_init (pixman_image_t *image,
-                                  pixman_iter_t  *iter,
-                                  int x, int y, int width, int height,
-                                  uint8_t *buffer, iter_flags_t flags);
+_pixman_linear_gradient_iter_init (pixman_image_t *image, pixman_iter_t  *iter);
 
 void
-_pixman_radial_gradient_iter_init (pixman_image_t *image,
-                                  pixman_iter_t *iter,
-                                  int x, int y, int width, int height,
-                                  uint8_t *buffer, iter_flags_t flags);
+_pixman_radial_gradient_iter_init (pixman_image_t *image, pixman_iter_t *iter);
 
 void
-_pixman_conical_gradient_iter_init (pixman_image_t *image,
-                                   pixman_iter_t *iter,
-                                   int x, int y, int width, int height,
-                                   uint8_t *buffer, iter_flags_t flags);
+_pixman_conical_gradient_iter_init (pixman_image_t *image, pixman_iter_t *iter);
 
 pixman_image_t *
 _pixman_image_allocate (void);
@@ -363,6 +346,36 @@ pixman_rasterize_edges_accessors (pixman_image_t *image,
  */
 typedef struct pixman_implementation_t pixman_implementation_t;
 
+typedef struct
+{
+    pixman_op_t              op;
+    pixman_image_t *         src_image;
+    pixman_image_t *         mask_image;
+    pixman_image_t *         dest_image;
+    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_composite_info_t;
+
+#define PIXMAN_COMPOSITE_ARGS(info)                                    \
+    MAYBE_UNUSED pixman_op_t        op = info->op;                     \
+    MAYBE_UNUSED pixman_image_t *   src_image = info->src_image;       \
+    MAYBE_UNUSED pixman_image_t *   mask_image = info->mask_image;     \
+    MAYBE_UNUSED pixman_image_t *   dest_image = info->dest_image;     \
+    MAYBE_UNUSED int32_t            src_x = info->src_x;               \
+    MAYBE_UNUSED int32_t            src_y = info->src_y;               \
+    MAYBE_UNUSED int32_t            mask_x = info->mask_x;             \
+    MAYBE_UNUSED int32_t            mask_y = info->mask_y;             \
+    MAYBE_UNUSED int32_t            dest_x = info->dest_x;             \
+    MAYBE_UNUSED int32_t            dest_y = info->dest_y;             \
+    MAYBE_UNUSED int32_t            width = info->width;               \
+    MAYBE_UNUSED int32_t            height = info->height
+
 typedef void (*pixman_combine_32_func_t) (pixman_implementation_t *imp,
                                          pixman_op_t              op,
                                          uint32_t *               dest,
@@ -378,18 +391,7 @@ typedef void (*pixman_combine_64_func_t) (pixman_implementation_t *imp,
                                          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);
+                                        pixman_composite_info_t *info);
 typedef pixman_bool_t (*pixman_blt_func_t) (pixman_implementation_t *imp,
                                            uint32_t *               src_bits,
                                            uint32_t *               dst_bits,
@@ -399,8 +401,8 @@ typedef pixman_bool_t (*pixman_blt_func_t) (pixman_implementation_t *imp,
                                            int                      dst_bpp,
                                            int                      src_x,
                                            int                      src_y,
-                                           int                      dst_x,
-                                           int                      dst_y,
+                                           int                      dest_x,
+                                           int                      dest_y,
                                            int                      width,
                                            int                      height);
 typedef pixman_bool_t (*pixman_fill_func_t) (pixman_implementation_t *imp,
@@ -413,14 +415,7 @@ typedef pixman_bool_t (*pixman_fill_func_t) (pixman_implementation_t *imp,
                                             int                      height,
                                             uint32_t                 xor);
 typedef void (*pixman_iter_init_func_t) (pixman_implementation_t *imp,
-                                         pixman_iter_t           *iter,
-                                         pixman_image_t          *image,
-                                         int                      x,
-                                         int                      y,
-                                         int                      width,
-                                         int                      height,
-                                         uint8_t                 *buffer,
-                                         iter_flags_t             flags);
+                                         pixman_iter_t           *iter);
 
 void _pixman_setup_combiner_functions_32 (pixman_implementation_t *imp);
 void _pixman_setup_combiner_functions_64 (pixman_implementation_t *imp);
@@ -502,8 +497,8 @@ _pixman_implementation_blt (pixman_implementation_t *imp,
                             int                      dst_bpp,
                             int                      src_x,
                             int                      src_y,
-                            int                      dst_x,
-                            int                      dst_y,
+                            int                      dest_x,
+                            int                      dest_y,
                             int                      width,
                             int                      height);
 
@@ -547,6 +542,9 @@ _pixman_implementation_create_general (void);
 pixman_implementation_t *
 _pixman_implementation_create_fast_path (pixman_implementation_t *fallback);
 
+pixman_implementation_t *
+_pixman_implementation_create_noop (pixman_implementation_t *fallback);
+
 #ifdef USE_MMX
 pixman_implementation_t *
 _pixman_implementation_create_mmx (pixman_implementation_t *fallback);
@@ -693,10 +691,13 @@ void *
 pixman_malloc_abc (unsigned int a, unsigned int b, unsigned int c);
 
 pixman_bool_t
-pixman_multiply_overflows_int (unsigned int a, unsigned int b);
+_pixman_multiply_overflows_size (size_t a, size_t b);
 
 pixman_bool_t
-pixman_addition_overflows_int (unsigned int a, unsigned int b);
+_pixman_multiply_overflows_int (unsigned int a, unsigned int b);
+
+pixman_bool_t
+_pixman_addition_overflows_int (unsigned int a, unsigned int b);
 
 /* Compositing utilities */
 void
@@ -765,6 +766,7 @@ pixman_region16_copy_from_region32 (pixman_region16_t *dst,
 
 /* Trivial versions that are useful in macros */
 #define CONVERT_8888_TO_8888(s) (s)
+#define CONVERT_x888_TO_8888(s) ((s) | 0xff000000)
 #define CONVERT_0565_TO_0565(s) (s)
 
 #define PIXMAN_FORMAT_IS_WIDE(f)                                       \
@@ -781,6 +783,49 @@ pixman_region16_copy_from_region32 (pixman_region16_t *dst,
 #   define SCREEN_SHIFT_RIGHT(x,n)     ((x) << (n))
 #endif
 
+static force_inline uint32_t
+unorm_to_unorm (uint32_t val, int from_bits, int to_bits)
+{
+    uint32_t result;
+
+    if (from_bits == 0)
+       return 0;
+
+    /* Delete any extra bits */
+    val &= ((1 << from_bits) - 1);
+
+    if (from_bits >= to_bits)
+       return val >> (from_bits - to_bits);
+
+    /* Start out with the high bit of val in the high bit of result. */
+    result = val << (to_bits - from_bits);
+
+    /* Copy the bits in result, doubling the number of bits each time, until
+     * we fill all to_bits. Unrolled manually because from_bits and to_bits
+     * are usually known statically, so the compiler can turn all of this
+     * into a few shifts.
+     */
+#define REPLICATE()                                                    \
+    do                                                                 \
+    {                                                                  \
+       if (from_bits < to_bits)                                        \
+       {                                                               \
+           result |= result >> from_bits;                              \
+                                                                       \
+           from_bits *= 2;                                             \
+       }                                                               \
+    }                                                                  \
+    while (0)
+
+    REPLICATE();
+    REPLICATE();
+    REPLICATE();
+    REPLICATE();
+    REPLICATE();
+
+    return result;
+}
+
 /*
  * Various debugging code
  */