pixman: Branch 'master' - 33 commits

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Sun Jun 21 19:37:42 PDT 2009


 pixman/Makefile.am               |   24 
 pixman/combine.h.inc             |  213 ------
 pixman/combine.inc               | 1339 --------------------------------------
 pixman/combine.pl                |   81 --
 pixman/make-combine.pl           |   81 ++
 pixman/pixman-access.c           |  606 ++++++++---------
 pixman/pixman-arm-neon.c         |   14 
 pixman/pixman-arm-neon.h         |    2 
 pixman/pixman-arm-simd.c         |    8 
 pixman/pixman-arm-simd.h         |    2 
 pixman/pixman-bits-image.c       |   45 -
 pixman/pixman-combine.c.template | 1343 +++++++++++++++++++++++++++++++++++++++
 pixman/pixman-combine.h.template |  208 ++++++
 pixman/pixman-compiler.h         |   71 ++
 pixman/pixman-compute-region.c   |  258 -------
 pixman/pixman-edge-imp.h         |   56 +
 pixman/pixman-edge.c             |   23 
 pixman/pixman-fast-path.c        |   18 
 pixman/pixman-image.c            |  193 -----
 pixman/pixman-mmx.c              |   24 
 pixman/pixman-pict.c             |  175 -----
 pixman/pixman-private.h          |  620 +++++-------------
 pixman/pixman-region16.c         |   30 
 pixman/pixman-region32.c         |   39 -
 pixman/pixman-sse2.c             |   37 -
 pixman/pixman-trap.c             |  181 +++++
 pixman/pixman-utils.c            |  585 +++++++---------
 pixman/pixman-vmx.c              |    8 
 pixman/pixman.c                  |  455 +++++++++++++
 29 files changed, 3261 insertions(+), 3478 deletions(-)

New commits:
commit 950bcd7d4a6226d969b0b69513f6806a2d40e08e
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 22:33:31 2009 -0400

    Some formatting changes

diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 6eefaa7..4d0c385 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -74,34 +74,27 @@ typedef struct radial_gradient radial_gradient_t;
 typedef struct bits_image bits_image_t;
 typedef struct circle circle_t;
 
-/* FIXME - the types and structures below should be give proper names
- */
-
-typedef void (*fetchProc32)(bits_image_t *pict, int x, int y, int width,
-                                     uint32_t *buffer);
-typedef uint32_t (*fetchPixelProc32)(bits_image_t *pict, int offset, int line);
-typedef void (*storeProc32)(pixman_image_t *, uint32_t *bits,
-			    const uint32_t *values, int x, int width);
-
-typedef void (*fetchProc64)(bits_image_t *pict, int x, int y, int width,
-                                     uint64_t *buffer);
-typedef uint64_t (*fetchPixelProc64)(bits_image_t *pict, int offset, int line);
-typedef void (*storeProc64)(pixman_image_t *, uint32_t *bits,
-			    const uint64_t *values, int x, int width);
-
-typedef void (* fetch_pixels_32_t) (bits_image_t *image, uint32_t *buffer, int n_pixels);
-typedef void (* fetch_pixels_64_t) (bits_image_t *image, uint64_t *buffer, int n_pixels);
+typedef void     (*fetchProc32)        (bits_image_t *pict, int x, int y, int width,
+					uint32_t *buffer);
+typedef uint32_t (*fetchPixelProc32)   (bits_image_t *pict, int offset, int line);
+typedef void     (*storeProc32)        (pixman_image_t *, uint32_t *bits,
+					const uint32_t *values, int x, int width);
+typedef void     (*fetchProc64)        (bits_image_t *pict, int x, int y, int width,
+					uint64_t *buffer);
+typedef uint64_t (*fetchPixelProc64)   (bits_image_t *pict, int offset, int line);
+typedef void     (*storeProc64)        (pixman_image_t *, uint32_t *bits,
+					const uint64_t *values, int x, int width);
+typedef void     (*fetch_pixels_32_t) (bits_image_t *image, uint32_t *buffer, int n_pixels);
+typedef void     (*fetch_pixels_64_t) (bits_image_t *image, uint64_t *buffer, int n_pixels);
+typedef void     (*scanStoreProc)     (bits_image_t *img, int x, int y, int width, uint32_t *buffer);
+typedef void     (*scanFetchProc)     (pixman_image_t *, int, int, int, uint32_t *,
+				       uint32_t *, uint32_t);
 
 void _pixman_bits_image_setup_raw_accessors (bits_image_t *image);
 
-void pixman_expand(uint64_t *dst, const uint32_t *src, pixman_format_code_t, int width);
-void pixman_contract(uint32_t *dst, const uint64_t *src, int width);
-
 void _pixman_image_get_scanline_64_generic (pixman_image_t * pict, int x, int y, int width,
 					    uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
 
-/* end */
-
 typedef enum
 {
     BITS,
@@ -118,10 +111,6 @@ typedef enum
     SOURCE_IMAGE_CLASS_VERTICAL,
 } source_pict_class_t;
 
-typedef void (*scanStoreProc)(bits_image_t *img, int x, int y, int width, uint32_t *buffer);
-typedef void (*scanFetchProc)(pixman_image_t *, int, int, int, uint32_t *,
-			      uint32_t *, uint32_t);
-
 source_pict_class_t
 _pixman_image_classify (pixman_image_t *image,
 			int             x,
@@ -157,9 +146,9 @@ pixman_image_t *
 _pixman_image_allocate (void);
 
 pixman_bool_t
-_pixman_init_gradient (gradient_t     *gradient,
+_pixman_init_gradient (gradient_t                   *gradient,
 		       const pixman_gradient_stop_t *stops,
-		       int	       n_stops);
+		       int	                     n_stops);
 void
 _pixman_image_reset_clip_region (pixman_image_t *image);
 
@@ -435,11 +424,9 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 #define fbComposeGetStart(pict,x,y,type,out_stride,line,mul) do {	\
 	uint32_t	*__bits__;					\
 	int		__stride__;					\
-	int		__bpp__;					\
 									\
 	__bits__ = pict->bits.bits;					\
 	__stride__ = pict->bits.rowstride;				\
-	__bpp__ = PIXMAN_FORMAT_BPP(pict->bits.format);			\
 	(out_stride) = __stride__ * (int) sizeof (uint32_t) / (int) sizeof (type);	\
 	(line) = ((type *) __bits__) +					\
 	    (out_stride) * (y) + (mul) * (x);				\
@@ -668,7 +655,6 @@ _pixman_choose_implementation (void);
 
 
 
-
 /*
  * Utilities
  */
@@ -739,6 +725,13 @@ _pixman_walk_composite_region (pixman_implementation_t *imp,
 			       uint16_t height,
 			       pixman_composite_func_t compositeRect);
 
+void
+pixman_expand (uint64_t *dst, const uint32_t *src, pixman_format_code_t, int width);
+
+void
+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,
commit 8b616c5725891f2f2d21b71796fb9af5644260e4
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 22:16:39 2009 -0400

    Delete struct point

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index e847cb9..b60b659 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -54,8 +54,8 @@ bits_image_store_scanline_32 (bits_image_t *image, int x, int y, int width, uint
 
     if (image->common.alpha_map)
     {
-	x -= image->common.alpha_origin.x;
-	y -= image->common.alpha_origin.y;
+	x -= image->common.alpha_origin_x;
+	y -= image->common.alpha_origin_y;
 
 	bits_image_store_scanline_32 (image->common.alpha_map, x, y, width, buffer);
     }
@@ -76,8 +76,8 @@ bits_image_store_scanline_64 (bits_image_t *image, int x, int y, int width, uint
 
     if (image->common.alpha_map)
     {
-	x -= image->common.alpha_origin.x;
-	y -= image->common.alpha_origin.y;
+	x -= image->common.alpha_origin_x;
+	y -= image->common.alpha_origin_y;
 
 	bits_image_store_scanline_64 (image->common.alpha_map, x, y, width, buffer);
     }
@@ -143,7 +143,7 @@ bits_image_fetch_alpha_pixels (bits_image_t *image, uint32_t *buffer, int n_pixe
 	    
 	    if (x != 0xffffffff)
 	    {
-		x -= image->common.alpha_origin.x;
+		x -= image->common.alpha_origin_x;
 		
 		if (x < 0 || x >= image->common.alpha_map->width)
 		    x = 0xffffffff;
@@ -151,7 +151,7 @@ bits_image_fetch_alpha_pixels (bits_image_t *image, uint32_t *buffer, int n_pixe
 	    
 	    if (y != 0xffffffff)
 	    {
-		y -= image->common.alpha_origin.y;
+		y -= image->common.alpha_origin_y;
 		
 		if (y < 0 || y >= image->common.alpha_map->height)
 		    y = 0xffffffff;
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index ec66de5..ad17f47 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -433,8 +433,8 @@ pixman_image_set_alpha_map (pixman_image_t *image,
 	    common->alpha_map = NULL;
     }
 
-    common->alpha_origin.x = x;
-    common->alpha_origin.y = y;
+    common->alpha_origin_x = x;
+    common->alpha_origin_y = y;
 
     image_property_changed (image);
 }
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 2553e00..6eefaa7 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -59,7 +59,9 @@
 #endif
 
 
-
+/*
+ * Images
+ */
 typedef struct image_common image_common_t;
 typedef struct source_image source_image_t;
 typedef struct solid_fill solid_fill_t;
@@ -71,7 +73,6 @@ typedef struct conical_gradient conical_gradient_t;
 typedef struct radial_gradient radial_gradient_t;
 typedef struct bits_image bits_image_t;
 typedef struct circle circle_t;
-typedef struct point point_t;
 
 /* FIXME - the types and structures below should be give proper names
  */
@@ -162,11 +163,6 @@ _pixman_init_gradient (gradient_t     *gradient,
 void
 _pixman_image_reset_clip_region (pixman_image_t *image);
 
-struct point
-{
-    int16_t x, y;
-};
-
 typedef source_pict_class_t (* classify_func_t) (pixman_image_t *image,
 						 int             x,
 						 int             y,
@@ -190,7 +186,8 @@ struct image_common
     pixman_fixed_t	       *filter_params;
     int				n_filter_params;
     bits_image_t	       *alpha_map;
-    point_t			alpha_origin;
+    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;
@@ -495,13 +492,6 @@ uint32_t
 pixman_image_get_solid (pixman_image_t *image,
 			pixman_format_code_t format);
 
-/* Region Helpers */
-pixman_bool_t pixman_region32_copy_from_region16 (pixman_region32_t *dst,
-						  pixman_region16_t *src);
-pixman_bool_t pixman_region16_copy_from_region32 (pixman_region16_t *dst,
-						  pixman_region32_t *src);
-
-
 /*
  * Implementations
  */
@@ -704,10 +694,17 @@ typedef struct
 } pixman_fast_path_t;
 
 /* Memory allocation helpers */
-void          *pixman_malloc_ab (unsigned int n, unsigned int b);
-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_bool_t  pixman_addition_overflows_int (unsigned int a, unsigned int b);
+void *
+pixman_malloc_ab (unsigned int n, unsigned int b);
+
+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_bool_t
+pixman_addition_overflows_int (unsigned int a, unsigned int b);
 
 /* Compositing utilities */
 pixman_bool_t
@@ -742,6 +739,16 @@ _pixman_walk_composite_region (pixman_implementation_t *imp,
 			       uint16_t height,
 			       pixman_composite_func_t compositeRect);
 
+/* Region Helpers */
+pixman_bool_t
+pixman_region32_copy_from_region16 (pixman_region32_t *dst,
+				    pixman_region16_t *src);
+
+pixman_bool_t
+pixman_region16_copy_from_region32 (pixman_region16_t *dst,
+				    pixman_region32_t *src);
+
+
 /*
  * Various useful macros
  */
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index fdd2426..ff3d322 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -159,8 +159,8 @@ pixman_compute_composite_region32 (pixman_region32_t *	pRegion,
     if (pDst->common.alpha_map && pDst->common.alpha_map->common.have_clip_region)
     {
 	if (!miClipPictureReg (pRegion, &pDst->common.alpha_map->common.clip_region,
-			       -pDst->common.alpha_origin.x,
-			       -pDst->common.alpha_origin.y))
+			       -pDst->common.alpha_origin_x,
+			       -pDst->common.alpha_origin_y))
 	{
 	    pixman_region32_fini (pRegion);
 	    return FALSE;
@@ -179,8 +179,8 @@ pixman_compute_composite_region32 (pixman_region32_t *	pRegion,
     if (pSrc->common.alpha_map && pSrc->common.alpha_map->common.have_clip_region)
     {
 	if (!miClipPictureSrc (pRegion, (pixman_image_t *)pSrc->common.alpha_map,
-			       xDst - (xSrc - pSrc->common.alpha_origin.x),
-			       yDst - (ySrc - pSrc->common.alpha_origin.y)))
+			       xDst - (xSrc - pSrc->common.alpha_origin_x),
+			       yDst - (ySrc - pSrc->common.alpha_origin_y)))
 	{
 	    pixman_region32_fini (pRegion);
 	    return FALSE;
@@ -197,8 +197,8 @@ pixman_compute_composite_region32 (pixman_region32_t *	pRegion,
 	if (pMask->common.alpha_map && pMask->common.alpha_map->common.have_clip_region)
 	{
 	    if (!miClipPictureSrc (pRegion, (pixman_image_t *)pMask->common.alpha_map,
-				   xDst - (xMask - pMask->common.alpha_origin.x),
-				   yDst - (yMask - pMask->common.alpha_origin.y)))
+				   xDst - (xMask - pMask->common.alpha_origin_x),
+				   yDst - (yMask - pMask->common.alpha_origin_y)))
 	    {
 		pixman_region32_fini (pRegion);
 		return FALSE;
commit 653fe825c92935318e0d2d552c3a0336ef82a1de
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 22:12:25 2009 -0400

    Move region helpers into pixman-utils.c

diff --git a/pixman/pixman-region16.c b/pixman/pixman-region16.c
index 2925b19..13f739a 100644
--- a/pixman/pixman-region16.c
+++ b/pixman/pixman-region16.c
@@ -42,36 +42,6 @@ typedef struct {
 
 #define PREFIX(x) pixman_region##x
 
-pixman_bool_t
-pixman_region16_copy_from_region32 (pixman_region16_t *dst,
-				    pixman_region32_t *src)
-{
-    int n_boxes, i;
-    pixman_box32_t *boxes32;
-    pixman_box16_t *boxes16;
-    pixman_bool_t retval;
-    
-    boxes32 = pixman_region32_rectangles (src, &n_boxes);
-
-    boxes16 = pixman_malloc_ab (n_boxes, sizeof (pixman_box16_t));
-
-    if (!boxes16)
-	return FALSE;
-    
-    for (i = 0; i < n_boxes; ++i)
-    {
-	boxes16[i].x1 = boxes32[i].x1;
-	boxes16[i].y1 = boxes32[i].y1;
-	boxes16[i].x2 = boxes32[i].x2;
-	boxes16[i].y2 = boxes32[i].y2;
-    }
-
-    pixman_region_fini (dst);
-    retval = pixman_region_init_rects (dst, boxes16, n_boxes);
-    free (boxes16);
-    return retval;
-}
-
 #include "pixman-region.c"
 
 /* This function exists only to make it possible to preserve the X ABI - it should
diff --git a/pixman/pixman-region32.c b/pixman/pixman-region32.c
index aac74f6..aeee86c 100644
--- a/pixman/pixman-region32.c
+++ b/pixman/pixman-region32.c
@@ -40,43 +40,4 @@ typedef struct {
 
 #define PREFIX(x) pixman_region32##x
 
-#define N_TMP_BOXES (16)
-
-pixman_bool_t
-pixman_region32_copy_from_region16 (pixman_region32_t *dst,
-				    pixman_region16_t *src)
-{
-    int n_boxes, i;
-    pixman_box16_t *boxes16;
-    pixman_box32_t *boxes32;
-    pixman_box32_t tmp_boxes[N_TMP_BOXES];
-    pixman_bool_t retval;
-    
-    boxes16 = pixman_region_rectangles (src, &n_boxes);
-
-    if (n_boxes > N_TMP_BOXES)
-	boxes32 = pixman_malloc_ab (n_boxes, sizeof (pixman_box32_t));
-    else
-	boxes32 = tmp_boxes;
-    
-    if (!boxes32)
-	return FALSE;
-    
-    for (i = 0; i < n_boxes; ++i)
-    {
-	boxes32[i].x1 = boxes16[i].x1;
-	boxes32[i].y1 = boxes16[i].y1;
-	boxes32[i].x2 = boxes16[i].x2;
-	boxes32[i].y2 = boxes16[i].y2;
-    }
-
-    pixman_region32_fini (dst);
-    retval = pixman_region32_init_rects (dst, boxes32, n_boxes);
-
-    if (boxes32 != tmp_boxes)
-	free (boxes32);
-
-    return retval;
-}
-
 #include "pixman-region.c"
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index af81525..fdd2426 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -696,3 +696,73 @@ _pixman_run_fast_path (const pixman_fast_path_t *paths,
     
     return result;
 }
+
+#define N_TMP_BOXES (16)
+
+pixman_bool_t
+pixman_region16_copy_from_region32 (pixman_region16_t *dst,
+				    pixman_region32_t *src)
+{
+    int n_boxes, i;
+    pixman_box32_t *boxes32;
+    pixman_box16_t *boxes16;
+    pixman_bool_t retval;
+    
+    boxes32 = pixman_region32_rectangles (src, &n_boxes);
+
+    boxes16 = pixman_malloc_ab (n_boxes, sizeof (pixman_box16_t));
+
+    if (!boxes16)
+	return FALSE;
+    
+    for (i = 0; i < n_boxes; ++i)
+    {
+	boxes16[i].x1 = boxes32[i].x1;
+	boxes16[i].y1 = boxes32[i].y1;
+	boxes16[i].x2 = boxes32[i].x2;
+	boxes16[i].y2 = boxes32[i].y2;
+    }
+
+    pixman_region_fini (dst);
+    retval = pixman_region_init_rects (dst, boxes16, n_boxes);
+    free (boxes16);
+    return retval;
+}
+
+pixman_bool_t
+pixman_region32_copy_from_region16 (pixman_region32_t *dst,
+				    pixman_region16_t *src)
+{
+    int n_boxes, i;
+    pixman_box16_t *boxes16;
+    pixman_box32_t *boxes32;
+    pixman_box32_t tmp_boxes[N_TMP_BOXES];
+    pixman_bool_t retval;
+    
+    boxes16 = pixman_region_rectangles (src, &n_boxes);
+
+    if (n_boxes > N_TMP_BOXES)
+	boxes32 = pixman_malloc_ab (n_boxes, sizeof (pixman_box32_t));
+    else
+	boxes32 = tmp_boxes;
+    
+    if (!boxes32)
+	return FALSE;
+    
+    for (i = 0; i < n_boxes; ++i)
+    {
+	boxes32[i].x1 = boxes16[i].x1;
+	boxes32[i].y1 = boxes16[i].y1;
+	boxes32[i].x2 = boxes16[i].x2;
+	boxes32[i].y2 = boxes16[i].y2;
+    }
+
+    pixman_region32_fini (dst);
+    retval = pixman_region32_init_rects (dst, boxes32, n_boxes);
+
+    if (boxes32 != tmp_boxes)
+	free (boxes32);
+
+    return retval;
+}
+
commit 00d852c96931f4bc27dfec124062e71eb49dc9bc
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 22:11:07 2009 -0400

    Move code around

diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 85cb7ee..2553e00 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -11,80 +11,9 @@
 
 #include "pixman-compiler.h"
 
-/*
- * Various useful macros
- */
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-/* Integer division that rounds towards -infinity */
-#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 CLIP(a,b,c) ((a) < (b) ? (b) : ((a) > (c) ? (c) : (a)))
-
-#ifndef MIN
-#  define MIN(a,b) ((a < b)? a : b)
-#endif
-
-#ifndef MAX
-#  define MAX(a,b) ((a > b)? a : b)
-#endif
-
 #undef DEBUG
 #define DEBUG 0
 
-/*
- * Utilities
- */
-
-/* Memory allocation helpers */
-void          *pixman_malloc_ab (unsigned int n, unsigned int b);
-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_bool_t  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);
-    
-void
-_pixman_walk_composite_region (pixman_implementation_t *imp,
-			       pixman_op_t op,
-			       pixman_image_t * pSrc,
-			       pixman_image_t * pMask,
-			       pixman_image_t * pDst,
-			       int16_t xSrc,
-			       int16_t ySrc,
-			       int16_t xMask,
-			       int16_t yMask,
-			       int16_t xDst,
-			       int16_t yDst,
-			       uint16_t width,
-			       uint16_t height,
-			       pixman_composite_func_t compositeRect);
-
 #if DEBUG
 
 #define return_if_fail(expr)						\
@@ -572,6 +501,7 @@ pixman_bool_t pixman_region32_copy_from_region16 (pixman_region32_t *dst,
 pixman_bool_t pixman_region16_copy_from_region32 (pixman_region16_t *dst,
 						  pixman_region32_t *src);
 
+
 /*
  * Implementations
  */
@@ -631,26 +561,6 @@ typedef pixman_bool_t (* pixman_fill_func_t) (pixman_implementation_t *imp,
 void _pixman_setup_combiner_functions_32 (pixman_implementation_t *imp);
 void _pixman_setup_combiner_functions_64 (pixman_implementation_t *imp);
 
-/* 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 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_fast_path_t;
-
 struct pixman_implementation_t
 {
     pixman_implementation_t *	toplevel;
@@ -768,6 +678,99 @@ _pixman_choose_implementation (void);
 
 
 
+
+/*
+ * Utilities
+ */
+
+/* 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 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_fast_path_t;
+
+/* Memory allocation helpers */
+void          *pixman_malloc_ab (unsigned int n, unsigned int b);
+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_bool_t  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);
+    
+void
+_pixman_walk_composite_region (pixman_implementation_t *imp,
+			       pixman_op_t op,
+			       pixman_image_t * pSrc,
+			       pixman_image_t * pMask,
+			       pixman_image_t * pDst,
+			       int16_t xSrc,
+			       int16_t ySrc,
+			       int16_t xMask,
+			       int16_t yMask,
+			       int16_t xDst,
+			       int16_t yDst,
+			       uint16_t width,
+			       uint16_t height,
+			       pixman_composite_func_t compositeRect);
+
+/*
+ * Various useful macros
+ */
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+/* Integer division that rounds towards -infinity */
+#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 CLIP(a,b,c) ((a) < (b) ? (b) : ((a) > (c) ? (c) : (a)))
+
+#ifndef MIN
+#  define MIN(a,b) ((a < b)? a : b)
+#endif
+
+#ifndef MAX
+#  define MAX(a,b) ((a > b)? a : b)
+#endif
+
+
 #ifdef PIXMAN_TIMERS
 /*
  * Timers
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index c313376..af81525 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -370,116 +370,6 @@ pixman_contract(uint32_t *dst, const uint64_t *src, int width)
     }
 }
 
-/**
- * pixman_version_string:
- *
- * Returns the version of the pixman library as a human-readable string
- * of the form "X.Y.Z".
- *
- * See also pixman_version() as well as the compile-time equivalents
- * %PIXMAN_VERSION_STRING and %PIXMAN_VERSION.
- *
- * Return value: a string containing the version.
- **/
-PIXMAN_EXPORT const char*
-pixman_version_string (void)
-{
-    return PIXMAN_VERSION_STRING;
-}
-
-/**
- * pixman_format_supported_source:
- * @format: A pixman_format_code_t format
- * 
- * Return value: whether the provided format code is a supported
- * format for a pixman surface used as a source in
- * rendering.
- *
- * Currently, all pixman_format_code_t values are supported.
- **/
-PIXMAN_EXPORT pixman_bool_t
-pixman_format_supported_source (pixman_format_code_t format)
-{
-    switch (format) {
-    /* 32 bpp formats */
-    case PIXMAN_a2b10g10r10:
-    case PIXMAN_x2b10g10r10:
-    case PIXMAN_a8r8g8b8:
-    case PIXMAN_x8r8g8b8:
-    case PIXMAN_a8b8g8r8:
-    case PIXMAN_x8b8g8r8:
-    case PIXMAN_b8g8r8a8:
-    case PIXMAN_b8g8r8x8:
-    case PIXMAN_r8g8b8:
-    case PIXMAN_b8g8r8:
-    case PIXMAN_r5g6b5:
-    case PIXMAN_b5g6r5:
-    /* 16 bpp formats */
-    case PIXMAN_a1r5g5b5:
-    case PIXMAN_x1r5g5b5:
-    case PIXMAN_a1b5g5r5:
-    case PIXMAN_x1b5g5r5:
-    case PIXMAN_a4r4g4b4:
-    case PIXMAN_x4r4g4b4:
-    case PIXMAN_a4b4g4r4:
-    case PIXMAN_x4b4g4r4:
-    /* 8bpp formats */
-    case PIXMAN_a8:
-    case PIXMAN_r3g3b2:
-    case PIXMAN_b2g3r3:
-    case PIXMAN_a2r2g2b2:
-    case PIXMAN_a2b2g2r2:
-    case PIXMAN_c8:
-    case PIXMAN_g8:
-    case PIXMAN_x4a4:
-    /* Collides with PIXMAN_c8
-    case PIXMAN_x4c4:
-    */
-    /* Collides with PIXMAN_g8
-    case PIXMAN_x4g4:
-    */
-    /* 4bpp formats */
-    case PIXMAN_a4:
-    case PIXMAN_r1g2b1:
-    case PIXMAN_b1g2r1:
-    case PIXMAN_a1r1g1b1:
-    case PIXMAN_a1b1g1r1:
-    case PIXMAN_c4:
-    case PIXMAN_g4:
-    /* 1bpp formats */
-    case PIXMAN_a1:
-    case PIXMAN_g1:
-    /* YUV formats */
-    case PIXMAN_yuy2:
-    case PIXMAN_yv12:
-	return TRUE;
-
-    default:
-	return FALSE;
-    }
-}
-
-/**
- * pixman_format_supported_destination:
- * @format: A pixman_format_code_t format
- * 
- * Return value: whether the provided format code is a supported
- * format for a pixman surface used as a destination in
- * rendering.
- *
- * Currently, all pixman_format_code_t values are supported
- * except for the YUV formats.
- **/
-PIXMAN_EXPORT pixman_bool_t
-pixman_format_supported_destination (pixman_format_code_t format)
-{
-    /* YUV formats cannot be written to at the moment */
-    if (format == PIXMAN_yuy2 || format == PIXMAN_yv12)
-	return FALSE;
-
-    return pixman_format_supported_source (format);
-}
-
 static void
 walk_region_internal (pixman_implementation_t *imp,
 		      pixman_op_t op,
diff --git a/pixman/pixman.c b/pixman/pixman.c
index 263cb89..ab9c3e1 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -344,3 +344,112 @@ pixman_version (void)
     return PIXMAN_VERSION;
 }
 
+/**
+ * pixman_version_string:
+ *
+ * Returns the version of the pixman library as a human-readable string
+ * of the form "X.Y.Z".
+ *
+ * See also pixman_version() as well as the compile-time equivalents
+ * %PIXMAN_VERSION_STRING and %PIXMAN_VERSION.
+ *
+ * Return value: a string containing the version.
+ **/
+PIXMAN_EXPORT const char*
+pixman_version_string (void)
+{
+    return PIXMAN_VERSION_STRING;
+}
+
+/**
+ * pixman_format_supported_source:
+ * @format: A pixman_format_code_t format
+ * 
+ * Return value: whether the provided format code is a supported
+ * format for a pixman surface used as a source in
+ * rendering.
+ *
+ * Currently, all pixman_format_code_t values are supported.
+ **/
+PIXMAN_EXPORT pixman_bool_t
+pixman_format_supported_source (pixman_format_code_t format)
+{
+    switch (format) {
+    /* 32 bpp formats */
+    case PIXMAN_a2b10g10r10:
+    case PIXMAN_x2b10g10r10:
+    case PIXMAN_a8r8g8b8:
+    case PIXMAN_x8r8g8b8:
+    case PIXMAN_a8b8g8r8:
+    case PIXMAN_x8b8g8r8:
+    case PIXMAN_b8g8r8a8:
+    case PIXMAN_b8g8r8x8:
+    case PIXMAN_r8g8b8:
+    case PIXMAN_b8g8r8:
+    case PIXMAN_r5g6b5:
+    case PIXMAN_b5g6r5:
+    /* 16 bpp formats */
+    case PIXMAN_a1r5g5b5:
+    case PIXMAN_x1r5g5b5:
+    case PIXMAN_a1b5g5r5:
+    case PIXMAN_x1b5g5r5:
+    case PIXMAN_a4r4g4b4:
+    case PIXMAN_x4r4g4b4:
+    case PIXMAN_a4b4g4r4:
+    case PIXMAN_x4b4g4r4:
+    /* 8bpp formats */
+    case PIXMAN_a8:
+    case PIXMAN_r3g3b2:
+    case PIXMAN_b2g3r3:
+    case PIXMAN_a2r2g2b2:
+    case PIXMAN_a2b2g2r2:
+    case PIXMAN_c8:
+    case PIXMAN_g8:
+    case PIXMAN_x4a4:
+    /* Collides with PIXMAN_c8
+    case PIXMAN_x4c4:
+    */
+    /* Collides with PIXMAN_g8
+    case PIXMAN_x4g4:
+    */
+    /* 4bpp formats */
+    case PIXMAN_a4:
+    case PIXMAN_r1g2b1:
+    case PIXMAN_b1g2r1:
+    case PIXMAN_a1r1g1b1:
+    case PIXMAN_a1b1g1r1:
+    case PIXMAN_c4:
+    case PIXMAN_g4:
+    /* 1bpp formats */
+    case PIXMAN_a1:
+    case PIXMAN_g1:
+    /* YUV formats */
+    case PIXMAN_yuy2:
+    case PIXMAN_yv12:
+	return TRUE;
+
+    default:
+	return FALSE;
+    }
+}
+
+/**
+ * pixman_format_supported_destination:
+ * @format: A pixman_format_code_t format
+ * 
+ * Return value: whether the provided format code is a supported
+ * format for a pixman surface used as a destination in
+ * rendering.
+ *
+ * Currently, all pixman_format_code_t values are supported
+ * except for the YUV formats.
+ **/
+PIXMAN_EXPORT pixman_bool_t
+pixman_format_supported_destination (pixman_format_code_t format)
+{
+    /* YUV formats cannot be written to at the moment */
+    if (format == PIXMAN_yuy2 || format == PIXMAN_yv12)
+	return FALSE;
+
+    return pixman_format_supported_source (format);
+}
commit a4ef790faac2c822df8336ee00c6fc5ea84aaa53
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 22:05:49 2009 -0400

    Move pixman_version() to pixman.c

diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index ac4ef0d..85cb7ee 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -52,6 +52,39 @@ 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_bool_t  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);
+    
+void
+_pixman_walk_composite_region (pixman_implementation_t *imp,
+			       pixman_op_t op,
+			       pixman_image_t * pSrc,
+			       pixman_image_t * pMask,
+			       pixman_image_t * pDst,
+			       int16_t xSrc,
+			       int16_t ySrc,
+			       int16_t xMask,
+			       int16_t yMask,
+			       int16_t xDst,
+			       int16_t yDst,
+			       uint16_t width,
+			       uint16_t height,
+			       pixman_composite_func_t compositeRect);
+
 #if DEBUG
 
 #define return_if_fail(expr)						\
@@ -539,52 +572,9 @@ pixman_bool_t pixman_region32_copy_from_region16 (pixman_region32_t *dst,
 pixman_bool_t pixman_region16_copy_from_region32 (pixman_region16_t *dst,
 						  pixman_region32_t *src);
 
-#ifdef PIXMAN_TIMERS
-
-/* Timing */
-static inline uint64_t
-oil_profile_stamp_rdtsc (void)
-{
-    uint64_t 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;
-    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);			\
-	}								\
-									\
-	timer##tname.n_times++;						\
-	begin##tname = OIL_STAMP();
-
-#define TIMER_END(tname)						\
-        timer##tname.total += OIL_STAMP() - begin##tname;		\
-    }
-
-#endif /* PIXMAN_TIMERS */
+/*
+ * Implementations
+ */
 
 typedef struct pixman_implementation_t pixman_implementation_t;
 
@@ -638,22 +628,6 @@ typedef pixman_bool_t (* pixman_fill_func_t) (pixman_implementation_t *imp,
 					      int height,
 					      uint32_t xor);
 
-void
-_pixman_walk_composite_region (pixman_implementation_t *imp,
-			       pixman_op_t op,
-			       pixman_image_t * pSrc,
-			       pixman_image_t * pMask,
-			       pixman_image_t * pDst,
-			       int16_t xSrc,
-			       int16_t ySrc,
-			       int16_t xMask,
-			       int16_t yMask,
-			       int16_t xDst,
-			       int16_t yDst,
-			       uint16_t width,
-			       uint16_t height,
-			       pixman_composite_func_t compositeRect);
-
 void _pixman_setup_combiner_functions_32 (pixman_implementation_t *imp);
 void _pixman_setup_combiner_functions_64 (pixman_implementation_t *imp);
 
@@ -789,23 +763,58 @@ pixman_implementation_t *
 _pixman_implementation_create_vmx (void);
 #endif
 
-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 *
 _pixman_choose_implementation (void);
 
+
+
+#ifdef PIXMAN_TIMERS
+/*
+ * Timers
+ */
+
+static inline uint64_t
+oil_profile_stamp_rdtsc (void)
+{
+    uint64_t 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;
+    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);			\
+	}								\
+									\
+	timer##tname.n_times++;						\
+	begin##tname = OIL_STAMP();
+
+#define TIMER_END(tname)						\
+        timer##tname.total += OIL_STAMP() - begin##tname;		\
+    }
+
+#endif /* PIXMAN_TIMERS */
+
 #endif /* PIXMAN_PRIVATE_H */
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index 7975d01..c313376 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -63,7 +63,9 @@ miClipPictureReg (pixman_region32_t *	pRegion,
 	}
     }
     else if (!pixman_region32_not_empty (pClip))
+    {
 	return FALSE;
+    }
     else
     {
 	if (dx || dy)
@@ -277,32 +279,6 @@ pixman_malloc_abc (unsigned int a,
 	return malloc (a * b * c);
 }
 
-
-/**
- * pixman_version:
- *
- * Returns the version of the pixman library encoded in a single
- * integer as per %PIXMAN_VERSION_ENCODE. The encoding ensures that
- * later versions compare greater than earlier versions.
- *
- * A run-time comparison to check that pixman's version is greater than
- * or equal to version X.Y.Z could be performed as follows:
- *
- * <informalexample><programlisting>
- * if (pixman_version() >= PIXMAN_VERSION_ENCODE(X,Y,Z)) {...}
- * </programlisting></informalexample>
- *
- * See also pixman_version_string() as well as the compile-time
- * equivalents %PIXMAN_VERSION and %PIXMAN_VERSION_STRING.
- *
- * Return value: the encoded version.
- **/
-PIXMAN_EXPORT int
-pixman_version (void)
-{
-    return PIXMAN_VERSION;
-}
-
 /*
  * Helper routine to expand a color component from 0 < n <= 8 bits to 16 bits by
  * replication.
diff --git a/pixman/pixman.c b/pixman/pixman.c
index 6f08583..263cb89 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -318,3 +318,29 @@ pixman_image_fill_rectangles (pixman_op_t		    op,
 
     return TRUE;
 }
+
+/**
+ * pixman_version:
+ *
+ * Returns the version of the pixman library encoded in a single
+ * integer as per %PIXMAN_VERSION_ENCODE. The encoding ensures that
+ * later versions compare greater than earlier versions.
+ *
+ * A run-time comparison to check that pixman's version is greater than
+ * or equal to version X.Y.Z could be performed as follows:
+ *
+ * <informalexample><programlisting>
+ * if (pixman_version() >= PIXMAN_VERSION_ENCODE(X,Y,Z)) {...}
+ * </programlisting></informalexample>
+ *
+ * See also pixman_version_string() as well as the compile-time
+ * equivalents %PIXMAN_VERSION and %PIXMAN_VERSION_STRING.
+ *
+ * Return value: the encoded version.
+ **/
+PIXMAN_EXPORT int
+pixman_version (void)
+{
+    return PIXMAN_VERSION;
+}
+
commit f1049c61d6b6b977f56533644bbfa7e2a95ca3a1
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 22:01:58 2009 -0400

    Move pixman_compute_composite_region() into pixman-utils.c

diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index 4593757..42ebe39 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -31,7 +31,6 @@ libpixman_1_la_SOURCES =			\
 	pixman-edge-accessors.c			\
 	pixman-edge-imp.h			\
 	pixman-trap.c				\
-	pixman-compute-region.c			\
 	pixman-timer.c				\
 	pixman-matrix.c
 
diff --git a/pixman/pixman-compute-region.c b/pixman/pixman-compute-region.c
deleted file mode 100644
index 72fd9e8..0000000
--- a/pixman/pixman-compute-region.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- *
- * Copyright © 1999 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "pixman-private.h"
-
-#define BOUND(v)	(int16_t) ((v) < INT16_MIN ? INT16_MIN : (v) > INT16_MAX ? INT16_MAX : (v))
-
-static inline pixman_bool_t
-miClipPictureReg (pixman_region32_t *	pRegion,
-		  pixman_region32_t *	pClip,
-		  int		dx,
-		  int		dy)
-{
-    if (pixman_region32_n_rects(pRegion) == 1 &&
-	pixman_region32_n_rects(pClip) == 1)
-    {
-	pixman_box32_t *  pRbox = pixman_region32_rectangles(pRegion, NULL);
-	pixman_box32_t *  pCbox = pixman_region32_rectangles(pClip, NULL);
-	int	v;
-	
-	if (pRbox->x1 < (v = pCbox->x1 + dx))
-	    pRbox->x1 = BOUND(v);
-	if (pRbox->x2 > (v = pCbox->x2 + dx))
-	    pRbox->x2 = BOUND(v);
-	if (pRbox->y1 < (v = pCbox->y1 + dy))
-	    pRbox->y1 = BOUND(v);
-	if (pRbox->y2 > (v = pCbox->y2 + dy))
-	    pRbox->y2 = BOUND(v);
-	if (pRbox->x1 >= pRbox->x2 ||
-	    pRbox->y1 >= pRbox->y2)
-	{
-	    pixman_region32_init (pRegion);
-	}
-    }
-    else if (!pixman_region32_not_empty (pClip))
-	return FALSE;
-    else
-    {
-	if (dx || dy)
-	    pixman_region32_translate (pRegion, -dx, -dy);
-	if (!pixman_region32_intersect (pRegion, pRegion, pClip))
-	    return FALSE;
-	if (dx || dy)
-	    pixman_region32_translate(pRegion, dx, dy);
-    }
-    return pixman_region32_not_empty(pRegion);
-}
-
-
-static inline pixman_bool_t
-miClipPictureSrc (pixman_region32_t *	pRegion,
-		  pixman_image_t *	pPicture,
-		  int		dx,
-		  int		dy)
-{
-    /* Source clips are ignored, unless they are explicitly turned on
-     * and the clip in question was set by an X client
-     */
-    if (!pPicture->common.clip_sources || !pPicture->common.client_clip)
-	return TRUE;
-
-    return miClipPictureReg (pRegion,
-			     &pPicture->common.clip_region,
-			     dx, dy);
-}
-
-/*
- * returns FALSE if the final region is empty.  Indistinguishable from
- * an allocation failure, but rendering ignores those anyways.
- */
-
-static void
-print_region (pixman_region32_t *region, const char *header)
-{
-    int n_boxes;
-    pixman_box32_t *boxes = pixman_region32_rectangles (region, &n_boxes);
-    int i;
-
-    printf ("%s\n", header);
-    for (i = 0; i < n_boxes; ++i)
-    {
-	pixman_box32_t *box = &(boxes[i]);
-
-	printf ("   %d %d %d %d\n", box->x1, box->y1, box->x2, box->y2);
-    }
-}
-
-pixman_bool_t
-pixman_compute_composite_region32 (pixman_region32_t *	pRegion,
-				   pixman_image_t *	pSrc,
-				   pixman_image_t *	pMask,
-				   pixman_image_t *	pDst,
-				   int16_t		xSrc,
-				   int16_t		ySrc,
-				   int16_t		xMask,
-				   int16_t		yMask,
-				   int16_t		xDst,
-				   int16_t		yDst,
-				   uint16_t		width,
-				   uint16_t		height)
-{
-    int		v;
-    
-    pRegion->extents.x1 = xDst;
-    v = xDst + width;
-    pRegion->extents.x2 = BOUND(v);
-    pRegion->extents.y1 = yDst;
-    v = yDst + height;
-    pRegion->extents.y2 = BOUND(v);
-
-    pRegion->extents.x1 = MAX (pRegion->extents.x1, 0);
-    pRegion->extents.y1 = MAX (pRegion->extents.y1, 0);
-    
-    /* Some X servers rely on an old bug, where pixman would just believe the
-     * set clip_region and not clip against the destination geometry. So, 
-     * since only X servers set "source clip", we only clip against destination
-     * geometry when that is set.
-     */
-    if (!pDst->common.clip_sources)
-    {
-	pRegion->extents.x2 = MIN (pRegion->extents.x2, pDst->bits.width);
-	pRegion->extents.y2 = MIN (pRegion->extents.y2, pDst->bits.height);
-    }
-    
-    pRegion->data = 0;
-    
-    /* Check for empty operation */
-    if (pRegion->extents.x1 >= pRegion->extents.x2 ||
-	pRegion->extents.y1 >= pRegion->extents.y2)
-    {
-	pixman_region32_init (pRegion);
-	return FALSE;
-    }
-    
-    if (pDst->common.have_clip_region)
-    {
-	if (!miClipPictureReg (pRegion, &pDst->common.clip_region, 0, 0))
-	{
-	    pixman_region32_fini (pRegion);
-	    return FALSE;
-	}
-    }
-    
-    if (pDst->common.alpha_map && pDst->common.alpha_map->common.have_clip_region)
-    {
-	if (!miClipPictureReg (pRegion, &pDst->common.alpha_map->common.clip_region,
-			       -pDst->common.alpha_origin.x,
-			       -pDst->common.alpha_origin.y))
-	{
-	    pixman_region32_fini (pRegion);
-	    return FALSE;
-	}
-    }
-    
-    /* clip against src */
-    if (pSrc->common.have_clip_region)
-    {
-	if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc))
-	{
-	    pixman_region32_fini (pRegion);
-	    return FALSE;
-	}
-    }
-    if (pSrc->common.alpha_map && pSrc->common.alpha_map->common.have_clip_region)
-    {
-	if (!miClipPictureSrc (pRegion, (pixman_image_t *)pSrc->common.alpha_map,
-			       xDst - (xSrc - pSrc->common.alpha_origin.x),
-			       yDst - (ySrc - pSrc->common.alpha_origin.y)))
-	{
-	    pixman_region32_fini (pRegion);
-	    return FALSE;
-	}
-    }
-    /* clip against mask */
-    if (pMask && pMask->common.have_clip_region)
-    {
-	if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask))
-	{
-	    pixman_region32_fini (pRegion);
-	    return FALSE;
-	}	
-	if (pMask->common.alpha_map && pMask->common.alpha_map->common.have_clip_region)
-	{
-	    if (!miClipPictureSrc (pRegion, (pixman_image_t *)pMask->common.alpha_map,
-				   xDst - (xMask - pMask->common.alpha_origin.x),
-				   yDst - (yMask - pMask->common.alpha_origin.y)))
-	    {
-		pixman_region32_fini (pRegion);
-		return FALSE;
-	    }
-	}
-    }
-
-#if 0
-    print_region (pRegion, "composite region");
-#endif
-    
-    return TRUE;
-}
-
-PIXMAN_EXPORT pixman_bool_t
-pixman_compute_composite_region (pixman_region16_t *	pRegion,
-				 pixman_image_t *	pSrc,
-				 pixman_image_t *	pMask,
-				 pixman_image_t *	pDst,
-				 int16_t		xSrc,
-				 int16_t		ySrc,
-				 int16_t		xMask,
-				 int16_t		yMask,
-				 int16_t		xDst,
-				 int16_t		yDst,
-				 uint16_t	width,
-				 uint16_t	height)
-{
-    pixman_region32_t r32;
-    pixman_bool_t retval;
-
-    pixman_region32_init (&r32);
-    
-    retval = pixman_compute_composite_region32 (&r32, pSrc, pMask, pDst,
-						xSrc, ySrc, xMask, yMask, xDst, yDst,
-						width, height);
-
-    if (retval)
-    {
-	if (!pixman_region16_copy_from_region32 (pRegion, &r32))
-	    retval = FALSE;
-    }
-    
-    pixman_region32_fini (&r32);
-    return retval;
-}
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index ab9a208..ac4ef0d 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -217,11 +217,11 @@ 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 set by a client */
-    pixman_bool_t		clip_sources;		/* Whether the clip applies when
-							 * the image is used as a source
-							 */
+    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
+						     * the image is used as a source
+						     */
     pixman_transform_t	       *transform;
     pixman_repeat_t		repeat;
     pixman_filter_t		filter;
@@ -533,20 +533,6 @@ uint32_t
 pixman_image_get_solid (pixman_image_t *image,
 			pixman_format_code_t format);
 
-pixman_bool_t
-pixman_compute_composite_region32 (pixman_region32_t *	pRegion,
-				   pixman_image_t *	pSrc,
-				   pixman_image_t *	pMask,
-				   pixman_image_t *	pDst,
-				   int16_t		xSrc,
-				   int16_t		ySrc,
-				   int16_t		xMask,
-				   int16_t		yMask,
-				   int16_t		xDst,
-				   int16_t		yDst,
-				   uint16_t		width,
-				   uint16_t		height);
-
 /* Region Helpers */
 pixman_bool_t pixman_region32_copy_from_region16 (pixman_region32_t *dst,
 						  pixman_region16_t *src);
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index 232c059..7975d01 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -1,5 +1,6 @@
 /*
  * Copyright © 2000 SuSE, Inc.
+ * Copyright © 1999 Keith Packard
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -24,11 +25,221 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-
+#include <stdio.h>
 #include <stdlib.h>
 
 #include "pixman-private.h"
 
+/*
+ * Computing composite region
+ */
+#define BOUND(v)	(int16_t) ((v) < INT16_MIN ? INT16_MIN : (v) > INT16_MAX ? INT16_MAX : (v))
+
+static inline pixman_bool_t
+miClipPictureReg (pixman_region32_t *	pRegion,
+		  pixman_region32_t *	pClip,
+		  int		dx,
+		  int		dy)
+{
+    if (pixman_region32_n_rects(pRegion) == 1 &&
+	pixman_region32_n_rects(pClip) == 1)
+    {
+	pixman_box32_t *  pRbox = pixman_region32_rectangles(pRegion, NULL);
+	pixman_box32_t *  pCbox = pixman_region32_rectangles(pClip, NULL);
+	int	v;
+	
+	if (pRbox->x1 < (v = pCbox->x1 + dx))
+	    pRbox->x1 = BOUND(v);
+	if (pRbox->x2 > (v = pCbox->x2 + dx))
+	    pRbox->x2 = BOUND(v);
+	if (pRbox->y1 < (v = pCbox->y1 + dy))
+	    pRbox->y1 = BOUND(v);
+	if (pRbox->y2 > (v = pCbox->y2 + dy))
+	    pRbox->y2 = BOUND(v);
+	if (pRbox->x1 >= pRbox->x2 ||
+	    pRbox->y1 >= pRbox->y2)
+	{
+	    pixman_region32_init (pRegion);
+	}
+    }
+    else if (!pixman_region32_not_empty (pClip))
+	return FALSE;
+    else
+    {
+	if (dx || dy)
+	    pixman_region32_translate (pRegion, -dx, -dy);
+	if (!pixman_region32_intersect (pRegion, pRegion, pClip))
+	    return FALSE;
+	if (dx || dy)
+	    pixman_region32_translate(pRegion, dx, dy);
+    }
+    return pixman_region32_not_empty(pRegion);
+}
+
+
+static inline pixman_bool_t
+miClipPictureSrc (pixman_region32_t *	pRegion,
+		  pixman_image_t *	pPicture,
+		  int		dx,
+		  int		dy)
+{
+    /* Source clips are ignored, unless they are explicitly turned on
+     * and the clip in question was set by an X client
+     */
+    if (!pPicture->common.clip_sources || !pPicture->common.client_clip)
+	return TRUE;
+
+    return miClipPictureReg (pRegion,
+			     &pPicture->common.clip_region,
+			     dx, dy);
+}
+
+/*
+ * returns FALSE if the final region is empty.  Indistinguishable from
+ * an allocation failure, but rendering ignores those anyways.
+ */
+static pixman_bool_t
+pixman_compute_composite_region32 (pixman_region32_t *	pRegion,
+				   pixman_image_t *	pSrc,
+				   pixman_image_t *	pMask,
+				   pixman_image_t *	pDst,
+				   int16_t		xSrc,
+				   int16_t		ySrc,
+				   int16_t		xMask,
+				   int16_t		yMask,
+				   int16_t		xDst,
+				   int16_t		yDst,
+				   uint16_t		width,
+				   uint16_t		height)
+{
+    int		v;
+    
+    pRegion->extents.x1 = xDst;
+    v = xDst + width;
+    pRegion->extents.x2 = BOUND(v);
+    pRegion->extents.y1 = yDst;
+    v = yDst + height;
+    pRegion->extents.y2 = BOUND(v);
+
+    pRegion->extents.x1 = MAX (pRegion->extents.x1, 0);
+    pRegion->extents.y1 = MAX (pRegion->extents.y1, 0);
+    
+    /* Some X servers rely on an old bug, where pixman would just believe the
+     * set clip_region and not clip against the destination geometry. So, 
+     * since only X servers set "source clip", we only clip against destination
+     * geometry when that is set.
+     */
+    if (!pDst->common.clip_sources)
+    {
+	pRegion->extents.x2 = MIN (pRegion->extents.x2, pDst->bits.width);
+	pRegion->extents.y2 = MIN (pRegion->extents.y2, pDst->bits.height);
+    }
+    
+    pRegion->data = 0;
+    
+    /* Check for empty operation */
+    if (pRegion->extents.x1 >= pRegion->extents.x2 ||
+	pRegion->extents.y1 >= pRegion->extents.y2)
+    {
+	pixman_region32_init (pRegion);
+	return FALSE;
+    }
+    
+    if (pDst->common.have_clip_region)
+    {
+	if (!miClipPictureReg (pRegion, &pDst->common.clip_region, 0, 0))
+	{
+	    pixman_region32_fini (pRegion);
+	    return FALSE;
+	}
+    }
+    
+    if (pDst->common.alpha_map && pDst->common.alpha_map->common.have_clip_region)
+    {
+	if (!miClipPictureReg (pRegion, &pDst->common.alpha_map->common.clip_region,
+			       -pDst->common.alpha_origin.x,
+			       -pDst->common.alpha_origin.y))
+	{
+	    pixman_region32_fini (pRegion);
+	    return FALSE;
+	}
+    }
+    
+    /* clip against src */
+    if (pSrc->common.have_clip_region)
+    {
+	if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc))
+	{
+	    pixman_region32_fini (pRegion);
+	    return FALSE;
+	}
+    }
+    if (pSrc->common.alpha_map && pSrc->common.alpha_map->common.have_clip_region)
+    {
+	if (!miClipPictureSrc (pRegion, (pixman_image_t *)pSrc->common.alpha_map,
+			       xDst - (xSrc - pSrc->common.alpha_origin.x),
+			       yDst - (ySrc - pSrc->common.alpha_origin.y)))
+	{
+	    pixman_region32_fini (pRegion);
+	    return FALSE;
+	}
+    }
+    /* clip against mask */
+    if (pMask && pMask->common.have_clip_region)
+    {
+	if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask))
+	{
+	    pixman_region32_fini (pRegion);
+	    return FALSE;
+	}	
+	if (pMask->common.alpha_map && pMask->common.alpha_map->common.have_clip_region)
+	{
+	    if (!miClipPictureSrc (pRegion, (pixman_image_t *)pMask->common.alpha_map,
+				   xDst - (xMask - pMask->common.alpha_origin.x),
+				   yDst - (yMask - pMask->common.alpha_origin.y)))
+	    {
+		pixman_region32_fini (pRegion);
+		return FALSE;
+	    }
+	}
+    }
+
+    return TRUE;
+}
+
+PIXMAN_EXPORT pixman_bool_t
+pixman_compute_composite_region (pixman_region16_t *	pRegion,
+				 pixman_image_t *	pSrc,
+				 pixman_image_t *	pMask,
+				 pixman_image_t *	pDst,
+				 int16_t		xSrc,
+				 int16_t		ySrc,
+				 int16_t		xMask,
+				 int16_t		yMask,
+				 int16_t		xDst,
+				 int16_t		yDst,
+				 uint16_t	width,
+				 uint16_t	height)
+{
+    pixman_region32_t r32;
+    pixman_bool_t retval;
+
+    pixman_region32_init (&r32);
+    
+    retval = pixman_compute_composite_region32 (&r32, pSrc, pMask, pDst,
+						xSrc, ySrc, xMask, yMask, xDst, yDst,
+						width, height);
+
+    if (retval)
+    {
+	if (!pixman_region16_copy_from_region32 (pRegion, &r32))
+	    retval = FALSE;
+    }
+    
+    pixman_region32_fini (&r32);
+    return retval;
+}
+
 pixman_bool_t
 pixman_multiply_overflows_int (unsigned int a,
 		               unsigned int b)
commit 7690af20fcf7f341a5162b77a66660cd05a155b9
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 21:42:14 2009 -0400

    Eliminate pointless Red/Green/Blue macros

diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 9359846..a20aec4 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -45,11 +45,6 @@
 
 #define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
 
-
-#define Red(x) (((x) >> 16) & 0xff)
-#define Green(x) (((x) >> 8) & 0xff)
-#define Blue(x) ((x) & 0xff)
-
 /*
  * YV12 setup and access macros
  */
@@ -1920,13 +1915,13 @@ fbStore_b8g8r8 (pixman_image_t *image,
     for (i = 0; i < width; ++i) {
 	uint32_t val = values[i];
 #ifdef WORDS_BIGENDIAN
-	WRITE(image, pixel++, Blue(val));
-	WRITE(image, pixel++, Green(val));
-	WRITE(image, pixel++, Red(val));
+	WRITE(image, pixel++, (val & 0x000000ff) >>  0);
+	WRITE(image, pixel++, (val & 0x0000ff00) >>  8);
+	WRITE(image, pixel++, (val & 0x00ff0000) >> 16);
 #else
-	WRITE(image, pixel++, Red(val));
-	WRITE(image, pixel++, Green(val));
-	WRITE(image, pixel++, Blue(val));
+	WRITE(image, pixel++, (val & 0x00ff0000) >> 16);
+	WRITE(image, pixel++, (val & 0x0000ff00) >>  8);
+	WRITE(image, pixel++, (val & 0x000000ff) >>  0);
 #endif
     }
 }
commit f6faf538eebed4722c085c2eef7b3ae524e3e00c
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Thu Jun 4 07:39:13 2009 -0400

    Get rid of indexed argument to store functions

diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 9506ae7..9359846 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -1808,7 +1808,7 @@ fbFetchPixel_yv12 (bits_image_t *pict, uint32_t *buffer, int n_pixels)
 static void
 fbStore_a2b10g10r10 (pixman_image_t *image,
 		     uint32_t *bits, const uint64_t *values,
-		     int x, int width, const pixman_indexed_t * indexed)
+		     int x, int width)
 {
     int i;
     uint32_t *pixel = bits + x;
@@ -1823,7 +1823,7 @@ fbStore_a2b10g10r10 (pixman_image_t *image,
 
 static void
 fbStore_x2b10g10r10 (pixman_image_t *image,
-		     uint32_t *bits, const uint64_t *values, int x, int width, const pixman_indexed_t * indexed)
+		     uint32_t *bits, const uint64_t *values, int x, int width)
 {
     int i;
     uint32_t *pixel = bits + x;
@@ -1837,14 +1837,14 @@ fbStore_x2b10g10r10 (pixman_image_t *image,
 
 static void
 fbStore_a8r8g8b8 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     MEMCPY_WRAPPED(image, ((uint32_t *)bits) + x, values, width*sizeof(uint32_t));
 }
 
 static void
 fbStore_x8r8g8b8 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint32_t *pixel = (uint32_t *)bits + x;
@@ -1854,7 +1854,7 @@ fbStore_x8r8g8b8 (pixman_image_t *image,
 
 static void
 fbStore_a8b8g8r8 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint32_t *pixel = (uint32_t *)bits + x;
@@ -1864,7 +1864,7 @@ fbStore_a8b8g8r8 (pixman_image_t *image,
 
 static void
 fbStore_x8b8g8r8 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint32_t *pixel = (uint32_t *)bits + x;
@@ -1874,7 +1874,7 @@ fbStore_x8b8g8r8 (pixman_image_t *image,
 
 static void
 fbStore_b8g8r8a8 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint32_t *pixel = (uint32_t *)bits + x;
@@ -1888,7 +1888,7 @@ fbStore_b8g8r8a8 (pixman_image_t *image,
 
 static void
 fbStore_b8g8r8x8 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint32_t *pixel = (uint32_t *)bits + x;
@@ -1901,8 +1901,7 @@ fbStore_b8g8r8x8 (pixman_image_t *image,
 
 static void
 fbStore_r8g8b8 (pixman_image_t *image,
-		uint32_t *bits, const uint32_t *values, int x, int width,
-		const pixman_indexed_t * indexed)
+		uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint8_t *pixel = ((uint8_t *) bits) + 3*x;
@@ -1914,7 +1913,7 @@ fbStore_r8g8b8 (pixman_image_t *image,
 
 static void
 fbStore_b8g8r8 (pixman_image_t *image,
-		uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint8_t *pixel = ((uint8_t *) bits) + 3*x;
@@ -1934,7 +1933,7 @@ fbStore_b8g8r8 (pixman_image_t *image,
 
 static void
 fbStore_r5g6b5 (pixman_image_t *image,
-		uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint16_t *pixel = ((uint16_t *) bits) + x;
@@ -1948,7 +1947,7 @@ fbStore_r5g6b5 (pixman_image_t *image,
 
 static void
 fbStore_b5g6r5 (pixman_image_t *image,
-		uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint16_t  *pixel = ((uint16_t *) bits) + x;
@@ -1962,7 +1961,7 @@ fbStore_b5g6r5 (pixman_image_t *image,
 
 static void
 fbStore_a1r5g5b5 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint16_t  *pixel = ((uint16_t *) bits) + x;
@@ -1977,7 +1976,7 @@ fbStore_a1r5g5b5 (pixman_image_t *image,
 
 static void
 fbStore_x1r5g5b5 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint16_t  *pixel = ((uint16_t *) bits) + x;
@@ -1991,7 +1990,7 @@ fbStore_x1r5g5b5 (pixman_image_t *image,
 
 static void
 fbStore_a1b5g5r5 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint16_t  *pixel = ((uint16_t *) bits) + x;
@@ -2006,7 +2005,7 @@ fbStore_a1b5g5r5 (pixman_image_t *image,
 
 static void
 fbStore_x1b5g5r5 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint16_t  *pixel = ((uint16_t *) bits) + x;
@@ -2020,7 +2019,7 @@ fbStore_x1b5g5r5 (pixman_image_t *image,
 
 static void
 fbStore_a4r4g4b4 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint16_t  *pixel = ((uint16_t *) bits) + x;
@@ -2035,7 +2034,7 @@ fbStore_a4r4g4b4 (pixman_image_t *image,
 
 static void
 fbStore_x4r4g4b4 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint16_t  *pixel = ((uint16_t *) bits) + x;
@@ -2049,7 +2048,7 @@ fbStore_x4r4g4b4 (pixman_image_t *image,
 
 static void
 fbStore_a4b4g4r4 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint16_t  *pixel = ((uint16_t *) bits) + x;
@@ -2064,7 +2063,7 @@ fbStore_a4b4g4r4 (pixman_image_t *image,
 
 static void
 fbStore_x4b4g4r4 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint16_t  *pixel = ((uint16_t *) bits) + x;
@@ -2078,7 +2077,7 @@ fbStore_x4b4g4r4 (pixman_image_t *image,
 
 static void
 fbStore_a8 (pixman_image_t *image,
-	    uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+	    uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint8_t   *pixel = ((uint8_t *) bits) + x;
@@ -2089,7 +2088,7 @@ fbStore_a8 (pixman_image_t *image,
 
 static void
 fbStore_r3g3b2 (pixman_image_t *image,
-		uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint8_t   *pixel = ((uint8_t *) bits) + x;
@@ -2104,7 +2103,7 @@ fbStore_r3g3b2 (pixman_image_t *image,
 
 static void
 fbStore_b2g3r3 (pixman_image_t *image,
-		uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint8_t   *pixel = ((uint8_t *) bits) + x;
@@ -2119,7 +2118,7 @@ fbStore_b2g3r3 (pixman_image_t *image,
 
 static void
 fbStore_a2r2g2b2 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint8_t   *pixel = ((uint8_t *) bits) + x;
@@ -2134,7 +2133,7 @@ fbStore_a2r2g2b2 (pixman_image_t *image,
 
 static void
 fbStore_a2b2g2r2 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint8_t   *pixel = ((uint8_t *) bits) + x;
@@ -2149,8 +2148,9 @@ fbStore_a2b2g2r2 (pixman_image_t *image,
 
 static void
 fbStore_c8 (pixman_image_t *image,
-	    uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+	    uint32_t *bits, const uint32_t *values, int x, int width)
 {
+    const pixman_indexed_t *indexed = image->bits.indexed;
     int i;
     uint8_t   *pixel = ((uint8_t *) bits) + x;
     for (i = 0; i < width; ++i) {
@@ -2160,7 +2160,7 @@ fbStore_c8 (pixman_image_t *image,
 
 static void
 fbStore_x4a4 (pixman_image_t *image,
-	      uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+	      uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     uint8_t   *pixel = ((uint8_t *) bits) + x;
@@ -2182,7 +2182,7 @@ fbStore_x4a4 (pixman_image_t *image,
 
 static void
 fbStore_a4 (pixman_image_t *image,
-	    uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+	    uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     for (i = 0; i < width; ++i) {
@@ -2192,7 +2192,7 @@ fbStore_a4 (pixman_image_t *image,
 
 static void
 fbStore_r1g2b1 (pixman_image_t *image,
-		uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     for (i = 0; i < width; ++i) {
@@ -2208,7 +2208,7 @@ fbStore_r1g2b1 (pixman_image_t *image,
 
 static void
 fbStore_b1g2r1 (pixman_image_t *image,
-		uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     for (i = 0; i < width; ++i) {
@@ -2224,7 +2224,7 @@ fbStore_b1g2r1 (pixman_image_t *image,
 
 static void
 fbStore_a1r1g1b1 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     for (i = 0; i < width; ++i) {
@@ -2240,7 +2240,7 @@ fbStore_a1r1g1b1 (pixman_image_t *image,
 
 static void
 fbStore_a1b1g1r1 (pixman_image_t *image,
-		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+		  uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     for (i = 0; i < width; ++i) {
@@ -2256,8 +2256,9 @@ fbStore_a1b1g1r1 (pixman_image_t *image,
 
 static void
 fbStore_c4 (pixman_image_t *image,
-	    uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+	    uint32_t *bits, const uint32_t *values, int x, int width)
 {
+    const pixman_indexed_t *indexed = image->bits.indexed;
     int i;
     for (i = 0; i < width; ++i) {
 	uint32_t  pixel;
@@ -2269,7 +2270,7 @@ fbStore_c4 (pixman_image_t *image,
 
 static void
 fbStore_a1 (pixman_image_t *image,
-	    uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+	    uint32_t *bits, const uint32_t *values, int x, int width)
 {
     int i;
     for (i = 0; i < width; ++i)
@@ -2288,8 +2289,9 @@ fbStore_a1 (pixman_image_t *image,
 
 static void
 fbStore_g1 (pixman_image_t *image,
-	    uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+	    uint32_t *bits, const uint32_t *values, int x, int width)
 {
+    const pixman_indexed_t *indexed = image->bits.indexed;
     int i;
     for (i = 0; i < width; ++i)
     {
@@ -2311,7 +2313,7 @@ fbStore_g1 (pixman_image_t *image,
  */
 static void
 fbStore64_generic (pixman_image_t *image,
-		   uint32_t *bits, const uint64_t *values, int x, int width, const pixman_indexed_t * indexed)
+		   uint32_t *bits, const uint64_t *values, int x, int width)
 {
     uint32_t *argb8Pixels;
 
@@ -2326,7 +2328,7 @@ fbStore64_generic (pixman_image_t *image,
      */
     pixman_contract(argb8Pixels, values, width);
     
-    image->bits.store_scanline_raw_32 (image, bits, argb8Pixels, x, width, indexed);
+    image->bits.store_scanline_raw_32 (image, bits, argb8Pixels, x, width);
 
     free(argb8Pixels);
 }
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index 0e99f91..e847cb9 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -45,13 +45,12 @@ bits_image_store_scanline_32 (bits_image_t *image, int x, int y, int width, uint
 {
     uint32_t *bits;
     int32_t stride;
-    const pixman_indexed_t *indexed = image->indexed;
 
     bits = image->bits;
     stride = image->rowstride;
     bits += y*stride;
 
-    image->store_scanline_raw_32 ((pixman_image_t *)image, bits, buffer, x, width, indexed);
+    image->store_scanline_raw_32 ((pixman_image_t *)image, bits, buffer, x, width);
 
     if (image->common.alpha_map)
     {
@@ -67,14 +66,13 @@ bits_image_store_scanline_64 (bits_image_t *image, int x, int y, int width, uint
 {
     uint32_t *bits;
     int32_t stride;
-    const pixman_indexed_t *indexed = image->indexed;
 
     bits = image->bits;
     stride = image->rowstride;
     bits += y*stride;
 
     image->store_scanline_raw_64 ((pixman_image_t *)image, bits,
-				  (uint64_t *)buffer, x, width, indexed);
+				  (uint64_t *)buffer, x, width);
 
     if (image->common.alpha_map)
     {
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 78959a7..ab9a208 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -118,15 +118,13 @@ typedef void (*fetchProc32)(bits_image_t *pict, int x, int y, int width,
                                      uint32_t *buffer);
 typedef uint32_t (*fetchPixelProc32)(bits_image_t *pict, int offset, int line);
 typedef void (*storeProc32)(pixman_image_t *, uint32_t *bits,
-                                     const uint32_t *values, int x, int width,
-                                     const pixman_indexed_t *);
+			    const uint32_t *values, int x, int width);
 
 typedef void (*fetchProc64)(bits_image_t *pict, int x, int y, int width,
                                      uint64_t *buffer);
 typedef uint64_t (*fetchPixelProc64)(bits_image_t *pict, int offset, int line);
 typedef void (*storeProc64)(pixman_image_t *, uint32_t *bits,
-                                     const uint64_t *values, int x, int width,
-                                     const pixman_indexed_t *);
+			    const uint64_t *values, int x, int width);
 
 typedef void (* fetch_pixels_32_t) (bits_image_t *image, uint32_t *buffer, int n_pixels);
 typedef void (* fetch_pixels_64_t) (bits_image_t *image, uint64_t *buffer, int n_pixels);
commit fdb25d97477635dafb0f8c328de65727a2d73a48
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 21:36:43 2009 -0400

    Move macros around in pixman-private.h

diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 6f24c5e..78959a7 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -11,7 +11,9 @@
 
 #include "pixman-compiler.h"
 
-
+/*
+ * Various useful macros
+ */
 #ifndef FALSE
 #define FALSE 0
 #endif
@@ -20,14 +22,35 @@
 #define TRUE 1
 #endif
 
+/* Integer division that rounds towards -infinity */
+#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 CLIP(a,b,c) ((a) < (b) ? (b) : ((a) > (c) ? (c) : (a)))
+
+#ifndef MIN
+#  define MIN(a,b) ((a < b)? a : b)
+#endif
+
+#ifndef MAX
+#  define MAX(a,b) ((a > b)? a : b)
+#endif
+
 #undef DEBUG
 #define DEBUG 0
 
+/*
+ * Utilities
+ */
+
 /* Memory allocation helpers */
-void *pixman_malloc_ab (unsigned int n, unsigned int b);
-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_bool_t pixman_addition_overflows_int (unsigned int a, unsigned int b);
+void          *pixman_malloc_ab (unsigned int n, unsigned int b);
+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_bool_t  pixman_addition_overflows_int (unsigned int a, unsigned int b);
 
 #if DEBUG
 
@@ -73,6 +96,8 @@ pixman_bool_t pixman_addition_overflows_int (unsigned int a, unsigned int b);
 
 #endif
 
+
+
 typedef struct image_common image_common_t;
 typedef struct source_image source_image_t;
 typedef struct solid_fill solid_fill_t;
@@ -410,22 +435,6 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 #define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8)
 #define div_65535(x) (((x) + 0x8000 + (((x) + 0x8000) >> 16)) >> 16)
 
-#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
-
-/* Divides two fixed-point numbers and returns an integer */
-#define DIV(a,b) ((((a) < 0) == ((b) < 0)) ? (a) / (b) :		\
-		  ((a) - (b) + 1 - (((b) < 0) << 1)) / (b))
-
-#define CLIP(a,b,c) ((a) < (b) ? (b) : ((a) > (c) ? (c) : (a)))
-
-#ifndef MIN
-#  define MIN(a,b) ((a < b)? a : b)
-#endif
-
-#ifndef MAX
-#  define MAX(a,b) ((a > b)? a : b)
-#endif
-
 #ifdef PIXMAN_FB_ACCESSORS
 
 #define ACCESS(sym) sym##_accessors
commit 76bf3073d45e184973cfc992d8f366a4a5ed0127
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 21:32:23 2009 -0400

    Move some macros into pixman-access.c

diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index b5ce6a2..9506ae7 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -34,6 +34,18 @@
 
 #include "pixman-private.h"
 
+#define CvtR8G8B8toY15(s)       (((((s) >> 16) & 0xff) * 153 + \
+                                  (((s) >>  8) & 0xff) * 301 +		\
+                                  (((s)      ) & 0xff) * 58) >> 2)
+#define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) |  \
+			    (((s) >> 6) & 0x03e0) |  \
+			    (((s) >> 9) & 0x7c00))
+#define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15])
+#define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24))
+
+#define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
+
+
 #define Red(x) (((x) >> 16) & 0xff)
 #define Green(x) (((x) >> 8) & 0xff)
 #define Blue(x) ((x) & 0xff)
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 07921b9..6f24c5e 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -373,18 +373,6 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
      WRITE(img, (a)+2, (uint8_t) ((v) >> 16))))
 #endif
 
-#define CvtR8G8B8toY15(s)       (((((s) >> 16) & 0xff) * 153 + \
-                                  (((s) >>  8) & 0xff) * 301 +		\
-                                  (((s)      ) & 0xff) * 58) >> 2)
-#define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) |  \
-			    (((s) >> 6) & 0x03e0) |  \
-			    (((s) >> 9) & 0x7c00))
-#define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15])
-#define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24))
-
-#define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
-
-
 #define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) )
 #define FbIntDiv(a,b)	 (((uint16_t) (a) * 255) / (b))
 
commit e2b5b05b3818f6a4ecf24dd0030e22784af22e22
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 21:28:38 2009 -0400

    Delete obsolete comment

diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index d0aba91..07921b9 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -438,11 +438,6 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 #  define MAX(a,b) ((a > b)? a : b)
 #endif
 
-/* FIXME: the (void)__read_func hides lots of warnings (which is what they
- * are supposed to do), but some of them are real. For example the one
- * where Fetch4 doesn't have a READ
- */
-
 #ifdef PIXMAN_FB_ACCESSORS
 
 #define ACCESS(sym) sym##_accessors
commit 271a0d34a07ee04d8de0cb435ab9242aeb0a4c5c
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 21:28:24 2009 -0400

    Move edge stepper macros into pixman-edge.c

diff --git a/pixman/pixman-edge.c b/pixman/pixman-edge.c
index b9246af..de86ed3 100644
--- a/pixman/pixman-edge.c
+++ b/pixman/pixman-edge.c
@@ -28,6 +28,29 @@
 
 #include "pixman-private.h"
 
+#define RenderEdgeStepSmall(edge) { \
+    edge->x += edge->stepx_small;   \
+    edge->e += edge->dx_small;	    \
+    if (edge->e > 0)		    \
+    {				    \
+	edge->e -= edge->dy;	    \
+	edge->x += edge->signdx;    \
+    }				    \
+}
+
+/*
+ * Step across a large sample grid gap
+ */
+#define RenderEdgeStepBig(edge) {   \
+    edge->x += edge->stepx_big;	    \
+    edge->e += edge->dx_big;	    \
+    if (edge->e > 0)		    \
+    {				    \
+	edge->e -= edge->dy;	    \
+	edge->x += edge->signdx;    \
+    }				    \
+}
+
 #ifdef PIXMAN_FB_ACCESSORS
 #define PIXMAN_RASTERIZE_EDGES pixman_rasterize_edges_accessors
 #else
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 7128957..d0aba91 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -526,29 +526,6 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 /*
  * Step across a small sample grid gap
  */
-#define RenderEdgeStepSmall(edge) { \
-    edge->x += edge->stepx_small;   \
-    edge->e += edge->dx_small;	    \
-    if (edge->e > 0)		    \
-    {				    \
-	edge->e -= edge->dy;	    \
-	edge->x += edge->signdx;    \
-    }				    \
-}
-
-/*
- * Step across a large sample grid gap
- */
-#define RenderEdgeStepBig(edge) {   \
-    edge->x += edge->stepx_big;	    \
-    edge->e += edge->dx_big;	    \
-    if (edge->e > 0)		    \
-    {				    \
-	edge->e -= edge->dy;	    \
-	edge->x += edge->signdx;    \
-    }				    \
-}
-
 void
 pixman_rasterize_edges_accessors (pixman_image_t *image,
 				  pixman_edge_t	*l,
commit 92eca118ad9cdeb61a00a591916f4e34aaaab916
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 19:45:29 2009 -0400

    Delete FB_MASK and FB_ALLONES macros

diff --git a/pixman/pixman-edge-imp.h b/pixman/pixman-edge-imp.h
index 477ab6b..79826f2 100644
--- a/pixman/pixman-edge-imp.h
+++ b/pixman/pixman-edge-imp.h
@@ -126,7 +126,7 @@ rasterizeEdges (pixman_image_t  *image,
 		    a++;
 		}
 		while (nmiddle--)
-		    WRITE(image, a++, FB_ALLONES);
+		    WRITE(image, a++, 0xffffffff);
 		if (endmask)
 		    WRITE(image, a, READ(image, a) | endmask);
 	    }
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index c4dbbd9..7128957 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -23,9 +23,6 @@
 #undef DEBUG
 #define DEBUG 0
 
-#define FB_MASK     (0x1f)
-#define FB_ALLONES  ((uint32_t) -1)
-
 /* Memory allocation helpers */
 void *pixman_malloc_ab (unsigned int n, unsigned int b);
 void *pixman_malloc_abc (unsigned int a, unsigned int b, unsigned int c);
commit 9541538a97b1101a886a26653a8b416701b2e065
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 19:38:57 2009 -0400

    Implement fbStore_a2g2b2r2

diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index ab615f8..b5ce6a2 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -2121,6 +2121,21 @@ fbStore_a2r2g2b2 (pixman_image_t *image,
 }
 
 static void
+fbStore_a2b2g2r2 (pixman_image_t *image,
+		  uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
+{
+    int i;
+    uint8_t   *pixel = ((uint8_t *) bits) + x;
+    for (i = 0; i < width; ++i) {
+	Splita(values[i]);
+	*(pixel++) =  ((a     ) & 0xc0) |
+	    ((b >> 2) & 0x30) |
+	    ((g >> 4) & 0x0c) |
+	    ((r >> 6)       );
+    }
+}
+
+static void
 fbStore_c8 (pixman_image_t *image,
 	    uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
 {
@@ -2268,7 +2283,6 @@ fbStore_g1 (pixman_image_t *image,
     {
 	uint32_t  *pixel = ((uint32_t *) bits) + ((i+x) >> 5);
 	uint32_t  mask, v;
-
 #ifdef WORDS_BIGENDIAN
 	mask = 1 << (0x1f - ((i+x) & 0x1f));
 #else
@@ -2392,10 +2406,7 @@ static const format_info_t accessors[] =
     FORMAT_INFO (r3g3b2),
     FORMAT_INFO (b2g3r3),
     FORMAT_INFO (a2r2g2b2),
-#if 0
-    /* FIXME */
     FORMAT_INFO (a2b2g2r2),
-#endif
     
     FORMAT_INFO (c8),
 
commit 433d94e60b8404df39582b6149e60a5faa965160
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 19:35:20 2009 -0400

    Replace switch functions in pixman-access.c with a table of accessors.
    
    Also delete unused orig_data pointer.

diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 8fa1c9d..ab615f8 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -716,87 +716,6 @@ fbFetch_yv12 (bits_image_t *pict, int x, int line, int width, uint32_t *buffer)
     }
 }
 
-fetchProc32 ACCESS(pixman_fetchProcForPicture32) (bits_image_t * pict)
-{
-    switch(pict->format) {
-    case PIXMAN_a8r8g8b8: return fbFetch_a8r8g8b8;
-    case PIXMAN_x8r8g8b8: return fbFetch_x8r8g8b8;
-    case PIXMAN_a8b8g8r8: return fbFetch_a8b8g8r8;
-    case PIXMAN_x8b8g8r8: return fbFetch_x8b8g8r8;
-    case PIXMAN_b8g8r8a8: return fbFetch_b8g8r8a8;
-    case PIXMAN_b8g8r8x8: return fbFetch_b8g8r8x8;
-    /* These two require wide compositing */
-    case PIXMAN_a2b10g10r10: return NULL;
-    case PIXMAN_x2b10g10r10: return NULL;
-
-        /* 24bpp formats */
-    case PIXMAN_r8g8b8: return fbFetch_r8g8b8;
-    case PIXMAN_b8g8r8: return fbFetch_b8g8r8;
-
-        /* 16bpp formats */
-    case PIXMAN_r5g6b5: return fbFetch_r5g6b5;
-    case PIXMAN_b5g6r5: return fbFetch_b5g6r5;
-
-    case PIXMAN_a1r5g5b5: return fbFetch_a1r5g5b5;
-    case PIXMAN_x1r5g5b5: return fbFetch_x1r5g5b5;
-    case PIXMAN_a1b5g5r5: return fbFetch_a1b5g5r5;
-    case PIXMAN_x1b5g5r5: return fbFetch_x1b5g5r5;
-    case PIXMAN_a4r4g4b4: return fbFetch_a4r4g4b4;
-    case PIXMAN_x4r4g4b4: return fbFetch_x4r4g4b4;
-    case PIXMAN_a4b4g4r4: return fbFetch_a4b4g4r4;
-    case PIXMAN_x4b4g4r4: return fbFetch_x4b4g4r4;
-
-        /* 8bpp formats */
-    case PIXMAN_a8: return  fbFetch_a8;
-    case PIXMAN_r3g3b2: return fbFetch_r3g3b2;
-    case PIXMAN_b2g3r3: return fbFetch_b2g3r3;
-    case PIXMAN_a2r2g2b2: return fbFetch_a2r2g2b2;
-    case PIXMAN_a2b2g2r2: return fbFetch_a2b2g2r2;
-    case PIXMAN_c8: return  fbFetch_c8;
-    case PIXMAN_g8: return  fbFetch_c8;
-    case PIXMAN_x4a4: return fbFetch_x4a4;
-
-        /* 4bpp formats */
-    case PIXMAN_a4: return  fbFetch_a4;
-    case PIXMAN_r1g2b1: return fbFetch_r1g2b1;
-    case PIXMAN_b1g2r1: return fbFetch_b1g2r1;
-    case PIXMAN_a1r1g1b1: return fbFetch_a1r1g1b1;
-    case PIXMAN_a1b1g1r1: return fbFetch_a1b1g1r1;
-    case PIXMAN_c4: return  fbFetch_c4;
-    case PIXMAN_g4: return  fbFetch_c4;
-
-        /* 1bpp formats */
-    case PIXMAN_a1: return  fbFetch_a1;
-    case PIXMAN_g1: return  fbFetch_g1;
-
-        /* YUV formats */
-    case PIXMAN_yuy2: return fbFetch_yuy2;
-    case PIXMAN_yv12: return fbFetch_yv12;
-    }
-
-    return NULL;
-}
-
-static void
-fbFetch64_generic (bits_image_t *pict, int x, int y, int width, uint64_t *buffer)
-{
-    fetchProc32 fetch32 = ACCESS(pixman_fetchProcForPicture32) (pict);
-
-    // Fetch the pixels into the first half of buffer and then expand them in
-    // place.
-    fetch32(pict, x, y, width, (uint32_t*)buffer);
-    pixman_expand(buffer, (uint32_t*)buffer, pict->format, width);
-}
-
-fetchProc64 ACCESS(pixman_fetchProcForPicture64) (bits_image_t * pict)
-{
-    switch(pict->format) {
-    case PIXMAN_a2b10g10r10: return fbFetch_a2b10g10r10;
-    case PIXMAN_x2b10g10r10: return fbFetch_x2b10g10r10;
-    default: return fbFetch64_generic;
-    }
-}
-
 /**************************** Pixel wise fetching *****************************/
 
 static void
@@ -1869,107 +1788,6 @@ fbFetchPixel_yv12 (bits_image_t *pict, uint32_t *buffer, int n_pixels)
     }
 }
 
-/*
- * XXX: The transformed fetch path only works at 32-bpp so far.  When all paths
- * have wide versions, this can be removed.
- *
- * WARNING: This function loses precision!
- */
-static void
-fbFetchPixel32_generic_lossy (bits_image_t *pict, uint32_t *buffer, int n_pixels)
-{
-    fetch_pixels_64_t fetch_pixels_64 = ACCESS(pixman_fetchPixelProcForPicture64) (pict);
-
-    /* Since buffer contains n_pixels coordinate pairs, it also has enough room for
-     * n_pixels 64 bit pixels
-     */
-    fetch_pixels_64 (pict, (uint64_t *)buffer, n_pixels);
-
-    pixman_contract (buffer, (uint64_t *)buffer, n_pixels);
-}
-
-fetch_pixels_32_t
-ACCESS(pixman_fetchPixelProcForPicture32) (bits_image_t * pict)
-{
-    switch(pict->format) {
-    case PIXMAN_a8r8g8b8: return fbFetchPixel_a8r8g8b8;
-    case PIXMAN_x8r8g8b8: return fbFetchPixel_x8r8g8b8;
-    case PIXMAN_a8b8g8r8: return fbFetchPixel_a8b8g8r8;
-    case PIXMAN_x8b8g8r8: return fbFetchPixel_x8b8g8r8;
-    case PIXMAN_b8g8r8a8: return fbFetchPixel_b8g8r8a8;
-    case PIXMAN_b8g8r8x8: return fbFetchPixel_b8g8r8x8;
-    /* These two require wide compositing */
-    case PIXMAN_a2b10g10r10: return fbFetchPixel32_generic_lossy;
-    case PIXMAN_x2b10g10r10: return fbFetchPixel32_generic_lossy;
-
-        /* 24bpp formats */
-    case PIXMAN_r8g8b8: return fbFetchPixel_r8g8b8;
-    case PIXMAN_b8g8r8: return fbFetchPixel_b8g8r8;
-
-        /* 16bpp formats */
-    case PIXMAN_r5g6b5: return fbFetchPixel_r5g6b5;
-    case PIXMAN_b5g6r5: return fbFetchPixel_b5g6r5;
-
-    case PIXMAN_a1r5g5b5: return fbFetchPixel_a1r5g5b5;
-    case PIXMAN_x1r5g5b5: return fbFetchPixel_x1r5g5b5;
-    case PIXMAN_a1b5g5r5: return fbFetchPixel_a1b5g5r5;
-    case PIXMAN_x1b5g5r5: return fbFetchPixel_x1b5g5r5;
-    case PIXMAN_a4r4g4b4: return fbFetchPixel_a4r4g4b4;
-    case PIXMAN_x4r4g4b4: return fbFetchPixel_x4r4g4b4;
-    case PIXMAN_a4b4g4r4: return fbFetchPixel_a4b4g4r4;
-    case PIXMAN_x4b4g4r4: return fbFetchPixel_x4b4g4r4;
-
-        /* 8bpp formats */
-    case PIXMAN_a8: return  fbFetchPixel_a8;
-    case PIXMAN_r3g3b2: return fbFetchPixel_r3g3b2;
-    case PIXMAN_b2g3r3: return fbFetchPixel_b2g3r3;
-    case PIXMAN_a2r2g2b2: return fbFetchPixel_a2r2g2b2;
-    case PIXMAN_a2b2g2r2: return fbFetchPixel_a2b2g2r2;
-    case PIXMAN_c8: return  fbFetchPixel_c8;
-    case PIXMAN_g8: return  fbFetchPixel_c8;
-    case PIXMAN_x4a4: return fbFetchPixel_x4a4;
-
-        /* 4bpp formats */
-    case PIXMAN_a4: return  fbFetchPixel_a4;
-    case PIXMAN_r1g2b1: return fbFetchPixel_r1g2b1;
-    case PIXMAN_b1g2r1: return fbFetchPixel_b1g2r1;
-    case PIXMAN_a1r1g1b1: return fbFetchPixel_a1r1g1b1;
-    case PIXMAN_a1b1g1r1: return fbFetchPixel_a1b1g1r1;
-    case PIXMAN_c4: return  fbFetchPixel_c4;
-    case PIXMAN_g4: return  fbFetchPixel_c4;
-
-        /* 1bpp formats */
-    case PIXMAN_a1: return  fbFetchPixel_a1;
-    case PIXMAN_g1: return  fbFetchPixel_g1;
-
-        /* YUV formats */
-    case PIXMAN_yuy2: return fbFetchPixel_yuy2;
-    case PIXMAN_yv12: return fbFetchPixel_yv12;
-    }
-
-    return NULL;
-}
-
-static void
-fbFetchPixel64_generic (bits_image_t *pict, uint64_t *buffer, int n_pixels)
-{
-    fetch_pixels_32_t fetch_pixels_32 = ACCESS(pixman_fetchPixelProcForPicture32) (pict);
-
-    fetch_pixels_32 (pict, (uint32_t *)buffer, n_pixels);
-
-    pixman_expand (buffer, (uint32_t *)buffer, pict->format, n_pixels);
-}
-
-fetch_pixels_64_t
-ACCESS(pixman_fetchPixelProcForPicture64) (bits_image_t * pict)
-{
-    switch(pict->format) {
-    case PIXMAN_a2b10g10r10: return fbFetchPixel_a2b10g10r10;
-    case PIXMAN_x2b10g10r10: return fbFetchPixel_x2b10g10r10;
-    default: return fbFetchPixel64_generic;
-    }
-}
-
 /*********************************** Store ************************************/
 
 #define Splita(v)	uint32_t	a = ((v) >> 24), r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff
@@ -2461,60 +2279,6 @@ fbStore_g1 (pixman_image_t *image,
     }
 }
 
-
-storeProc32 ACCESS(pixman_storeProcForPicture32) (bits_image_t * pict)
-{
-    switch(pict->format) {
-    case PIXMAN_a8r8g8b8: return fbStore_a8r8g8b8;
-    case PIXMAN_x8r8g8b8: return fbStore_x8r8g8b8;
-    case PIXMAN_a8b8g8r8: return fbStore_a8b8g8r8;
-    case PIXMAN_x8b8g8r8: return fbStore_x8b8g8r8;
-    case PIXMAN_b8g8r8a8: return fbStore_b8g8r8a8;
-    case PIXMAN_b8g8r8x8: return fbStore_b8g8r8x8;
-
-        /* 24bpp formats */
-    case PIXMAN_r8g8b8: return fbStore_r8g8b8;
-    case PIXMAN_b8g8r8: return fbStore_b8g8r8;
-
-        /* 16bpp formats */
-    case PIXMAN_r5g6b5: return fbStore_r5g6b5;
-    case PIXMAN_b5g6r5: return fbStore_b5g6r5;
-
-    case PIXMAN_a1r5g5b5: return fbStore_a1r5g5b5;
-    case PIXMAN_x1r5g5b5: return fbStore_x1r5g5b5;
-    case PIXMAN_a1b5g5r5: return fbStore_a1b5g5r5;
-    case PIXMAN_x1b5g5r5: return fbStore_x1b5g5r5;
-    case PIXMAN_a4r4g4b4: return fbStore_a4r4g4b4;
-    case PIXMAN_x4r4g4b4: return fbStore_x4r4g4b4;
-    case PIXMAN_a4b4g4r4: return fbStore_a4b4g4r4;
-    case PIXMAN_x4b4g4r4: return fbStore_x4b4g4r4;
-
-        /* 8bpp formats */
-    case PIXMAN_a8: return  fbStore_a8;
-    case PIXMAN_r3g3b2: return fbStore_r3g3b2;
-    case PIXMAN_b2g3r3: return fbStore_b2g3r3;
-    case PIXMAN_a2r2g2b2: return fbStore_a2r2g2b2;
-    case PIXMAN_c8: return  fbStore_c8;
-    case PIXMAN_g8: return  fbStore_c8;
-    case PIXMAN_x4a4: return fbStore_x4a4;
-
-        /* 4bpp formats */
-    case PIXMAN_a4: return  fbStore_a4;
-    case PIXMAN_r1g2b1: return fbStore_r1g2b1;
-    case PIXMAN_b1g2r1: return fbStore_b1g2r1;
-    case PIXMAN_a1r1g1b1: return fbStore_a1r1g1b1;
-    case PIXMAN_a1b1g1r1: return fbStore_a1b1g1r1;
-    case PIXMAN_c4: return  fbStore_c4;
-    case PIXMAN_g4: return  fbStore_c4;
-
-        /* 1bpp formats */
-    case PIXMAN_a1: return  fbStore_a1;
-    case PIXMAN_g1: return  fbStore_g1;
-    default:
-        return NULL;
-    }
-}
-
 /*
  * Contracts a 64bpp image to 32bpp and then stores it using a regular 32-bit
  * store proc.
@@ -2523,29 +2287,218 @@ static void
 fbStore64_generic (pixman_image_t *image,
 		   uint32_t *bits, const uint64_t *values, int x, int width, const pixman_indexed_t * indexed)
 {
-    bits_image_t *pict = (bits_image_t*)image;
-    storeProc32 store32 = ACCESS(pixman_storeProcForPicture32) (pict);
     uint32_t *argb8Pixels;
 
     assert(image->common.type == BITS);
-    assert(store32);
 
     argb8Pixels = pixman_malloc_ab (width, sizeof(uint32_t));
-    if (!argb8Pixels) return;
+    if (!argb8Pixels)
+	return;
 
-    // Contract the scanline.  We could do this in place if values weren't
-    // const.
+    /* Contract the scanline.  We could do this in place if values weren't
+     * const.
+     */
     pixman_contract(argb8Pixels, values, width);
-    store32(image, bits, argb8Pixels, x, width, indexed);
+    
+    image->bits.store_scanline_raw_32 (image, bits, argb8Pixels, x, width, indexed);
 
     free(argb8Pixels);
 }
 
-storeProc64 ACCESS(pixman_storeProcForPicture64) (bits_image_t * pict)
+static void
+fbFetch64_generic (bits_image_t *pict, int x, int y, int width, uint64_t *buffer)
 {
-    switch(pict->format) {
-    case PIXMAN_a2b10g10r10: return fbStore_a2b10g10r10;
-    case PIXMAN_x2b10g10r10: return fbStore_x2b10g10r10;
-    default: return fbStore64_generic;
+    /* Fetch the pixels into the first half of buffer and then expand them in
+     * place.
+     */
+    pict->fetch_scanline_raw_32 (pict, x, y, width, (uint32_t*)buffer);
+    
+    pixman_expand (buffer, (uint32_t*)buffer, pict->format, width);
+}
+
+static void
+fbFetchPixel64_generic (bits_image_t *pict, uint64_t *buffer, int n_pixels)
+{
+    pict->fetch_pixels_raw_32 (pict, (uint32_t *)buffer, n_pixels);
+    
+    pixman_expand (buffer, (uint32_t *)buffer, pict->format, n_pixels);
+}
+
+/*
+ * XXX: The transformed fetch path only works at 32-bpp so far.  When all paths
+ * have wide versions, this can be removed.
+ *
+ * WARNING: This function loses precision!
+ */
+static void
+fbFetchPixel32_generic_lossy (bits_image_t *pict, uint32_t *buffer, int n_pixels)
+{
+    /* Since buffer contains n_pixels coordinate pairs, it also has enough room for
+     * n_pixels 64 bit pixels
+     */
+    pict->fetch_pixels_raw_64 (pict, (uint64_t *)buffer, n_pixels);
+    
+    pixman_contract (buffer, (uint64_t *)buffer, n_pixels);
+}
+
+typedef struct
+{
+    pixman_format_code_t		format;
+    fetchProc32				fetch_scanline_raw_32;
+    fetchProc64				fetch_scanline_raw_64;
+    fetch_pixels_32_t			fetch_pixels_raw_32;
+    fetch_pixels_64_t			fetch_pixels_raw_64;
+    storeProc32				store_scanline_raw_32;
+    storeProc64				store_scanline_raw_64;
+} format_info_t;
+
+#define FORMAT_INFO(format)						\
+    {									\
+	PIXMAN_##format,						\
+	    fbFetch_##format, fbFetch64_generic,			\
+	    fbFetchPixel_##format, fbFetchPixel64_generic,		\
+	    fbStore_##format, fbStore64_generic				\
     }
+
+static const format_info_t accessors[] =
+{
+/* 32 bpp formats */
+    FORMAT_INFO (a8r8g8b8),
+    FORMAT_INFO (x8r8g8b8),
+    FORMAT_INFO (a8b8g8r8),
+    FORMAT_INFO (x8b8g8r8),
+    FORMAT_INFO (b8g8r8a8),
+    FORMAT_INFO (b8g8r8x8),
+
+/* 24bpp formats */
+    FORMAT_INFO (r8g8b8),
+    FORMAT_INFO (b8g8r8),
+    
+/* 16bpp formats */
+    FORMAT_INFO (r5g6b5),
+    FORMAT_INFO (b5g6r5),
+    
+    FORMAT_INFO (a1r5g5b5),
+    FORMAT_INFO (x1r5g5b5),
+    FORMAT_INFO (a1b5g5r5),
+    FORMAT_INFO (x1b5g5r5),
+    FORMAT_INFO (a4r4g4b4),
+    FORMAT_INFO (x4r4g4b4),
+    FORMAT_INFO (a4b4g4r4),
+    FORMAT_INFO (x4b4g4r4),
+    
+/* 8bpp formats */
+    FORMAT_INFO (a8),
+    FORMAT_INFO (r3g3b2),
+    FORMAT_INFO (b2g3r3),
+    FORMAT_INFO (a2r2g2b2),
+#if 0
+    /* FIXME */
+    FORMAT_INFO (a2b2g2r2),
+#endif
+    
+    FORMAT_INFO (c8),
+
+#define fbFetch_g8 fbFetch_c8
+#define fbFetchPixel_g8 fbFetchPixel_c8
+#define fbStore_g8 fbStore_c8
+    FORMAT_INFO (g8),
+#define fbFetch_x4c4 fbFetch_c8
+#define fbFetchPixel_x4c4 fbFetchPixel_c8
+#define fbStore_x4c4 fbStore_c8
+    FORMAT_INFO (x4c4),
+#define fbFetch_x4g4 fbFetch_c8
+#define fbFetchPixel_x4g4 fbFetchPixel_c8
+#define fbStore_x4g4 fbStore_c8
+    FORMAT_INFO (x4g4),
+    
+    FORMAT_INFO (x4a4),
+    
+/* 4bpp formats */
+    FORMAT_INFO (a4),
+    FORMAT_INFO (r1g2b1),
+    FORMAT_INFO (b1g2r1),
+    FORMAT_INFO (a1r1g1b1),
+    FORMAT_INFO (a1b1g1r1),
+    
+    FORMAT_INFO (c4),
+#define fbFetch_g4 fbFetch_c4
+#define fbFetchPixel_g4 fbFetchPixel_c4
+#define fbStore_g4 fbStore_c4
+    FORMAT_INFO (g4),
+    
+/* 1bpp formats */
+    FORMAT_INFO (a1),
+    FORMAT_INFO (g1),
+
+/* Wide formats */
+    
+    { PIXMAN_a2b10g10r10,
+      NULL, fbFetch_a2b10g10r10,
+      fbFetchPixel32_generic_lossy, fbFetchPixel_a2b10g10r10,
+      NULL, fbStore_a2b10g10r10 },
+
+    { PIXMAN_x2b10g10r10,
+      NULL, fbFetch_x2b10g10r10,
+      fbFetchPixel32_generic_lossy, fbFetchPixel_x2b10g10r10,
+      NULL, fbStore_x2b10g10r10 },
+
+/* YUV formats */
+    { PIXMAN_yuy2,
+      fbFetch_yuy2, fbFetch64_generic,
+      fbFetchPixel_yuy2, fbFetchPixel64_generic,
+      NULL, NULL },
+
+    { PIXMAN_yv12,
+      fbFetch_yv12, fbFetch64_generic,
+      fbFetchPixel_yv12, fbFetchPixel64_generic,
+      NULL, NULL },
+    
+    { PIXMAN_null },
+};
+
+static void
+setup_accessors (bits_image_t *image)
+{
+    const format_info_t *info = accessors;
+
+    while (info->format != PIXMAN_null)
+    {
+	if (info->format == image->format)
+	{
+	    image->fetch_scanline_raw_32 = info->fetch_scanline_raw_32;
+	    image->fetch_scanline_raw_64 = info->fetch_scanline_raw_64;
+	    image->fetch_pixels_raw_32 = info->fetch_pixels_raw_32;
+	    image->fetch_pixels_raw_64 = info->fetch_pixels_raw_64;
+	    image->store_scanline_raw_32 = info->store_scanline_raw_32;
+	    image->store_scanline_raw_64 = info->store_scanline_raw_64;
+
+	    return;
+	}
+
+	info++;
+    }
+}
+
+#ifndef PIXMAN_FB_ACCESSORS
+void
+_pixman_bits_image_setup_raw_accessors_accessors (bits_image_t *image);
+
+void
+_pixman_bits_image_setup_raw_accessors (bits_image_t *image)
+{
+    if (image->common.read_func || image->common.write_func)
+	_pixman_bits_image_setup_raw_accessors_accessors (image);
+    else
+	setup_accessors (image);
 }
+
+#else
+
+void
+_pixman_bits_image_setup_raw_accessors_accessors (bits_image_t *image)
+{
+    setup_accessors (image);
+}
+
+#endif
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index 699402f..0e99f91 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -736,6 +736,8 @@ bits_image_property_changed (pixman_image_t *image)
 {
     bits_image_t *bits = (bits_image_t *)image;
     
+    _pixman_bits_image_setup_raw_accessors (bits);
+
     if (bits->common.alpha_map)
     {
 	image->common.get_scanline_64 =
@@ -765,22 +767,9 @@ bits_image_property_changed (pixman_image_t *image)
 	image->common.get_scanline_32 =
 	    (scanFetchProc)bits_image_fetch_transformed;
     }
-    
-    bits->fetch_scanline_raw_32 =
-	READ_ACCESS(pixman_fetchProcForPicture32)(bits);
-    bits->fetch_scanline_raw_64 =
-	READ_ACCESS(pixman_fetchProcForPicture64)(bits);
-    
-    bits->fetch_pixels_raw_32 = READ_ACCESS(pixman_fetchPixelProcForPicture32)(bits);
-    bits->fetch_pixels_raw_64 = READ_ACCESS(pixman_fetchPixelProcForPicture64)(bits);
 
     bits->store_scanline_64 = bits_image_store_scanline_64;
     bits->store_scanline_32 = bits_image_store_scanline_32;
-
-    bits->store_scanline_raw_32 =
-	WRITE_ACCESS(pixman_storeProcForPicture32)(bits);
-    bits->store_scanline_raw_64 =
-	WRITE_ACCESS(pixman_storeProcForPicture64)(bits);
 }
 
 static uint32_t *
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 3348961..c4dbbd9 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -109,19 +109,7 @@ typedef void (*storeProc64)(pixman_image_t *, uint32_t *bits,
 typedef void (* fetch_pixels_32_t) (bits_image_t *image, uint32_t *buffer, int n_pixels);
 typedef void (* fetch_pixels_64_t) (bits_image_t *image, uint64_t *buffer, int n_pixels);
 
-fetchProc32 pixman_fetchProcForPicture32 (bits_image_t *);
-fetch_pixels_32_t pixman_fetchPixelProcForPicture32 (bits_image_t *);
-storeProc32 pixman_storeProcForPicture32 (bits_image_t *);
-fetchProc32 pixman_fetchProcForPicture32_accessors (bits_image_t *);
-fetch_pixels_32_t pixman_fetchPixelProcForPicture32_accessors (bits_image_t *);
-storeProc32 pixman_storeProcForPicture32_accessors (bits_image_t *);
-
-fetchProc64 pixman_fetchProcForPicture64 (bits_image_t *);
-fetch_pixels_64_t pixman_fetchPixelProcForPicture64 (bits_image_t *);
-storeProc64 pixman_storeProcForPicture64 (bits_image_t *);
-fetchProc64 pixman_fetchProcForPicture64_accessors (bits_image_t *);
-fetch_pixels_64_t pixman_fetchPixelProcForPicture64_accessors (bits_image_t *);
-storeProc64 pixman_storeProcForPicture64_accessors (bits_image_t *);
+void _pixman_bits_image_setup_raw_accessors (bits_image_t *image);
 
 void pixman_expand(uint64_t *dst, const uint32_t *src, pixman_format_code_t, int width);
 void pixman_contract(uint32_t *dst, const uint64_t *src, int width);
@@ -151,11 +139,12 @@ typedef void (*scanStoreProc)(bits_image_t *img, int x, int y, int width, uint32
 typedef void (*scanFetchProc)(pixman_image_t *, int, int, int, uint32_t *,
 			      uint32_t *, uint32_t);
 
-source_pict_class_t _pixman_image_classify (pixman_image_t *image,
-					    int             x,
-					    int             y,
-					    int             width,
-					    int             height);
+source_pict_class_t
+_pixman_image_classify (pixman_image_t *image,
+			int             x,
+			int             y,
+			int             width,
+			int             height);
 
 void
 _pixman_image_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
@@ -317,11 +306,6 @@ struct bits_image
     /* Used for indirect access to the bits */
     pixman_read_memory_func_t	read_func;
     pixman_write_memory_func_t	write_func;
-    
-    void *			orig_data;	/* Stores pointer to original
-						 * data, when the image is
-						 * being accessed.
-						 */
 };
 
 union pixman_image
commit d78e30b26be15683062a1a3b76fbbe7d3b5abe0f
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 19:06:25 2009 -0400

    Rename pixman_image_can_get_solid() to pixman_image_is_solid

diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index a7fd21d..ec66de5 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -508,7 +508,7 @@ pixman_image_get_depth (pixman_image_t *image)
 }
 
 pixman_bool_t
-pixman_image_can_get_solid (pixman_image_t *image)
+pixman_image_is_solid (pixman_image_t *image)
 {
     if (image->type == SOLID)
 	return TRUE;
@@ -520,25 +520,10 @@ pixman_image_can_get_solid (pixman_image_t *image)
 	return FALSE;
     }
 
-    if (image->common.repeat != PIXMAN_REPEAT_NORMAL)
+    if (image->common.repeat == PIXMAN_REPEAT_NONE)
 	return FALSE;
 
-    switch (image->bits.format)
-    {
-    case PIXMAN_a8r8g8b8:
-    case PIXMAN_x8r8g8b8:
-    case PIXMAN_a8b8g8r8:
-    case PIXMAN_x8b8g8r8:
-    case PIXMAN_b8g8r8a8:
-    case PIXMAN_b8g8r8x8:
-    case PIXMAN_r8g8b8:
-    case PIXMAN_b8g8r8:
-    case PIXMAN_r5g6b5:
-    case PIXMAN_b5g6r5:
-	return TRUE;
-    default:
-	return FALSE;
-    }
+    return TRUE;
 }
 
 uint32_t
@@ -596,7 +581,7 @@ pixman_image_is_opaque (pixman_image_t *image)
 	break;
 	
     case SOLID:
-         if (Alpha (image->solid.color) != 0xff)
+	if (Alpha (image->solid.color) != 0xff)
             return FALSE;
         break;
     }
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 2f545c2..3348961 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -579,7 +579,7 @@ pixman_bool_t
 pixman_image_is_opaque(pixman_image_t *image);
 
 pixman_bool_t
-pixman_image_can_get_solid (pixman_image_t *image);
+pixman_image_is_solid (pixman_image_t *image);
 
 uint32_t
 pixman_image_get_solid (pixman_image_t *image,
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index 41eaaef..232c059 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -447,7 +447,7 @@ get_fast_path (const pixman_fast_path_t *fast_paths,
 	if (info->op != op)
 	    continue;
 
-	if ((info->src_format == PIXMAN_solid && pixman_image_can_get_solid (pSrc)) ||
+	if ((info->src_format == PIXMAN_solid && pixman_image_is_solid (pSrc)) ||
 	    (pSrc->type == BITS && info->src_format == pSrc->bits.format))
 	{
 	    valid_src = TRUE;
@@ -526,7 +526,7 @@ _pixman_run_fast_path (const pixman_fast_path_t *paths,
     pixman_bool_t mask_repeat = mask && mask->common.repeat == PIXMAN_REPEAT_NORMAL;
     pixman_bool_t result;
 
-    if ((src->type == BITS || pixman_image_can_get_solid (src)) &&
+    if ((src->type == BITS || pixman_image_is_solid (src)) &&
 	(!mask || mask->type == BITS)
 	&& !src->common.transform && !(mask && mask->common.transform)
 	&& !(mask && mask->common.alpha_map) && !src->common.alpha_map && !dest->common.alpha_map
commit 6e20c2574354d1cb071a1201ff166cb5e92c00d2
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 18:58:53 2009 -0400

    Turn fbComposeGetSolid() macro into a pixman_image_get_solid() function.

diff --git a/pixman/pixman-arm-neon.c b/pixman/pixman-arm-neon.c
index 966704a..c33a2ef 100644
--- a/pixman/pixman-arm-neon.c
+++ b/pixman/pixman-arm-neon.c
@@ -461,7 +461,7 @@ fbCompositeSrc_8888x8x8888neon (
     fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1);
     fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1);
 
-    fbComposeGetSolid (pMask, mask, pDst->bits.format);
+    pixman_image_get_solid (pMask, mask, pDst->bits.format);
     mask_alpha = vdup_n_u8((mask) >> 24);
 
     if (width>=8)
@@ -658,7 +658,7 @@ fbCompositeSolidMask_nx8x8888neon (
     uint8x8_t    mask_selector=vreinterpret_u8_u64(vcreate_u64(0x0101010100000000ULL));
     uint8x8_t    alpha_selector=vreinterpret_u8_u64(vcreate_u64(0x0707070703030303ULL));
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    pixman_image_get_solid(pSrc, src, pDst->bits.format);
 
     srca = src >> 24;
     if (src == 0)
@@ -863,7 +863,7 @@ fbCompositeSrcAdd_8888x8x8neon (
 
     fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1);
     fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1);
-    fbComposeGetSolid (pSrc, src, pDst->bits.format);
+    pixman_image_get_solid (pSrc, src, pDst->bits.format);
     sa = vdup_n_u8((src) >> 24);
 
     if (width>=8)
@@ -1734,7 +1734,7 @@ fbCompositeSolidMask_nx8x0565neon (
 	uint32_t     kernelCount, copyCount;
 	uint8_t      kernelOffset, copyOffset;
 
-	fbComposeGetSolid(pSrc, src, pDst->bits.format);
+	pixman_image_get_solid(pSrc, src, pDst->bits.format);
 
 	// bail out if fully transparent or degenerate
 	srca = src >> 24;
@@ -1875,7 +1875,7 @@ fbCompositeSolid_nx0565neon (
 	uint32_t     kernelCount, copyCount;
 	uint8_t      kernelOffset, copyOffset;
 
-	fbComposeGetSolid(pSrc, src, pDst->bits.format);
+	pixman_image_get_solid(pSrc, src, pDst->bits.format);
 
 	// bail out if fully transparent
 	srca = src >> 24;
diff --git a/pixman/pixman-arm-simd.c b/pixman/pixman-arm-simd.c
index 0b9c529..2030657 100644
--- a/pixman/pixman-arm-simd.c
+++ b/pixman/pixman-arm-simd.c
@@ -219,7 +219,7 @@ fbCompositeSrc_8888x8x8888arm (
     fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1);
     fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1);
 
-    fbComposeGetSolid (pMask, mask, pDst->bits.format);
+    pixman_image_get_solid (pMask, mask, pDst->bits.format);
     mask = (mask) >> 24;
 
     while (height--)
@@ -323,7 +323,7 @@ fbCompositeSolidMask_nx8x8888arm (
     int		 dstStride, maskStride;
     uint16_t	 w;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    pixman_image_get_solid(pSrc, src, pDst->bits.format);
 
     srca = src >> 24;
     if (src == 0)
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 0620420..35065ce 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -151,7 +151,7 @@ fbCompositeSolidMaskIn_nx8x8 (pixman_implementation_t *imp,
     uint16_t	w;
     uint16_t    t;
 
-    fbComposeGetSolid(iSrc, src, iDst->bits.format);
+    src = pixman_image_get_solid(iSrc, iDst->bits.format);
 
     srca = src >> 24;
 
@@ -281,7 +281,7 @@ fbCompositeSolidMask_nx8x8888 (pixman_implementation_t *imp,
     int		 dstStride, maskStride;
     uint16_t	 w;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     srca = src >> 24;
     if (src == 0)
@@ -340,7 +340,7 @@ fbCompositeSolidMask_nx8888x8888C (pixman_implementation_t *imp,
     uint16_t	w;
     uint32_t	m, n, o, p;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     srca = src >> 24;
     if (src == 0)
@@ -413,7 +413,7 @@ fbCompositeSolidMask_nx8x0888 (pixman_implementation_t *imp,
     int	dstStride, maskStride;
     uint16_t	w;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     srca = src >> 24;
     if (src == 0)
@@ -476,7 +476,7 @@ fbCompositeSolidMask_nx8x0565 (pixman_implementation_t *imp,
     int	dstStride, maskStride;
     uint16_t	w;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     srca = src >> 24;
     if (src == 0)
@@ -542,7 +542,7 @@ fbCompositeSolidMask_nx8888x0565C (pixman_implementation_t *imp,
     uint16_t	w;
     uint32_t	m, n, o;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     srca = src >> 24;
     if (src == 0)
@@ -913,7 +913,7 @@ fbCompositeSrcAdd_8888x8x8 (pixman_implementation_t *imp,
 
     fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1);
     fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1);
-    fbComposeGetSolid (pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid (pSrc, pDst->bits.format);
     sa = (src >> 24);
 
     while (height--)
@@ -963,7 +963,7 @@ fbCompositeSolidFill (pixman_implementation_t *imp,
 {
     uint32_t	src;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     if (pDst->bits.format == PIXMAN_a8)
 	src = src >> 24;
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index fcab468..a7fd21d 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -167,8 +167,6 @@ _pixman_image_get_fetcher (pixman_image_t *image,
 static void
 image_property_changed (pixman_image_t *image)
 {
-    
-    
     image->common.property_changed (image);
 }
 
@@ -543,6 +541,25 @@ pixman_image_can_get_solid (pixman_image_t *image)
     }
 }
 
+uint32_t
+pixman_image_get_solid (pixman_image_t *image, pixman_format_code_t format)
+{
+    uint32_t result;
+    
+    _pixman_image_get_scanline_32 (image, 0, 0, 1, &result, NULL, 0);
+    
+    /* If necessary, convert RGB <--> BGR. */
+    if (PIXMAN_FORMAT_TYPE (format) != PIXMAN_TYPE_ARGB)
+    {
+	result = (((result & 0xff000000) >>  0) |
+		  ((result & 0x00ff0000) >> 16) |
+		  ((result & 0x0000ff00) >>  0) |
+		  ((result & 0x000000ff) << 16));
+    }									
+    
+    return result;							
+}
+
 pixman_bool_t
 pixman_image_is_opaque (pixman_image_t *image)
 {
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 350a048..0909124 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -940,7 +940,7 @@ fbCompositeSolid_nx8888mmx (pixman_implementation_t *imp,
 
     CHECKPOINT();
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     if (src >> 24 == 0)
 	return;
@@ -1019,7 +1019,7 @@ fbCompositeSolid_nx0565mmx (pixman_implementation_t *imp,
 
     CHECKPOINT();
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     if (src >> 24 == 0)
 	return;
@@ -1105,7 +1105,7 @@ fbCompositeSolidMask_nx8888x8888Cmmx (pixman_implementation_t *imp,
 
     CHECKPOINT();
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     srca = src >> 24;
     if (srca == 0)
@@ -1214,7 +1214,7 @@ fbCompositeSrc_8888x8x8888mmx (pixman_implementation_t *imp,
     fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1);
     fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1);
 
-    fbComposeGetSolid (pMask, mask, pDst->bits.format);
+    mask = pixman_image_get_solid (pMask, pDst->bits.format);
     mask = mask | mask >> 8 | mask >> 16 | mask >> 24;
     vmask = load8888 (mask);
     srca = MC(4x00ff);
@@ -1298,7 +1298,7 @@ fbCompositeSrc_x888xnx8888mmx (pixman_implementation_t *imp,
 
     fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1);
     fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1);
-    fbComposeGetSolid (pMask, mask, pDst->bits.format);
+    mask = pixman_image_get_solid (pMask, pDst->bits.format);
 
     mask = mask | mask >> 8 | mask >> 16 | mask >> 24;
     vmask = load8888 (mask);
@@ -1586,7 +1586,7 @@ fbCompositeSolidMask_nx8x8888mmx (pixman_implementation_t *imp,
 
     CHECKPOINT();
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     srca = src >> 24;
     if (srca == 0)
@@ -1858,7 +1858,7 @@ fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_implementation_t *imp,
 
     CHECKPOINT();
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     srca = src >> 24;
     if (srca == 0)
@@ -1990,7 +1990,7 @@ fbCompositeSolidMask_nx8x0565mmx (pixman_implementation_t *imp,
 
     CHECKPOINT();
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     srca = src >> 24;
     if (srca == 0)
@@ -2343,7 +2343,7 @@ fbCompositeSolidMask_nx8888x0565Cmmx (pixman_implementation_t *imp,
 
     CHECKPOINT();
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     srca = src >> 24;
     if (srca == 0)
@@ -2454,7 +2454,7 @@ fbCompositeIn_nx8x8mmx (pixman_implementation_t *imp,
     fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1);
     fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1);
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     sa = src >> 24;
     if (sa == 0)
@@ -2604,7 +2604,7 @@ fbCompositeSrcAdd_8888x8x8mmx (pixman_implementation_t *imp,
     fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1);
     fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1);
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     sa = src >> 24;
     if (sa == 0)
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 18a028e..2f545c2 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -502,23 +502,6 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 
 #endif
 
-#define fbComposeGetSolid(img, res, fmt)				\
-    {									\
-	uint32_t __pixel;						\
-									\
-	_pixman_image_get_scanline_32 (img, 0, 0, 1, &__pixel, NULL, 0); \
-									\
-	/* If necessary, convert RGB <--> BGR. */			\
-	if (PIXMAN_FORMAT_TYPE(fmt) != PIXMAN_TYPE_ARGB)		\
-	{								\
-	    (__pixel) = ((((__pixel) & 0xff000000) >>  0) |		\
-			 (((__pixel) & 0x00ff0000) >> 16) |		\
-			 (((__pixel) & 0x0000ff00) >>  0) |		\
-			 (((__pixel) & 0x000000ff) << 16));		\
-	}								\
-	(res) = __pixel;						\
-    }
-
 #define fbComposeGetStart(pict,x,y,type,out_stride,line,mul) do {	\
 	uint32_t	*__bits__;					\
 	int		__stride__;					\
@@ -598,6 +581,10 @@ pixman_image_is_opaque(pixman_image_t *image);
 pixman_bool_t
 pixman_image_can_get_solid (pixman_image_t *image);
 
+uint32_t
+pixman_image_get_solid (pixman_image_t *image,
+			pixman_format_code_t format);
+
 pixman_bool_t
 pixman_compute_composite_region32 (pixman_region32_t *	pRegion,
 				   pixman_image_t *	pSrc,
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 0908fc9..00a2a26 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -2517,7 +2517,7 @@ fbCompositeSolid_nx8888sse2 (pixman_implementation_t *imp,
     __m128i xmmSrc, xmmAlpha;
     __m128i xmmDst, xmmDstLo, xmmDstHi;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     if (src == 0)
 	return;
@@ -2604,7 +2604,7 @@ fbCompositeSolid_nx0565sse2 (pixman_implementation_t *imp,
     __m128i xmmSrc, xmmAlpha;
     __m128i xmmDst, xmmDst0, xmmDst1, xmmDst2, xmmDst3;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     if (src == 0)
         return;
@@ -2699,7 +2699,7 @@ fbCompositeSolidMask_nx8888x8888Csse2 (pixman_implementation_t *imp,
 
     __m64 mmxSrc, mmxAlpha, mmxMask, mmxDst;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     if (src == 0)
 	return;
@@ -2834,7 +2834,7 @@ fbCompositeSrc_8888x8x8888sse2 (pixman_implementation_t *imp,
 
     fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1);
     fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1);
-    fbComposeGetSolid (pMask, mask, pDst->bits.format);
+    mask = pixman_image_get_solid (pMask, pDst->bits.format);
 
     xmmMask = createMask_16_128 (mask >> 24);
 
@@ -2946,7 +2946,7 @@ fbCompositeSrc_x888xnx8888sse2 (pixman_implementation_t *imp,
 
     fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1);
     fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1);
-    fbComposeGetSolid (pMask, mask, pDst->bits.format);
+    mask = pixman_image_get_solid (pMask, pDst->bits.format);
 
     xmmMask = createMask_16_128 (mask >> 24);
     xmmAlpha = Mask00ff;
@@ -3223,7 +3223,7 @@ fbCompositeSolidMask_nx8x8888sse2 (pixman_implementation_t *imp,
 
     __m64 mmxSrc, mmxAlpha, mmxMask, mmxDest;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     srca = src >> 24;
     if (src == 0)
@@ -3498,7 +3498,7 @@ fbCompositeSolidMaskSrc_nx8x8888sse2 (pixman_implementation_t *imp,
     __m128i xmmSrc, xmmDef;
     __m128i xmmMask, xmmMaskLo, xmmMaskHi;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     srca = src >> 24;
     if (src == 0)
@@ -3636,7 +3636,7 @@ fbCompositeSolidMask_nx8x0565sse2 (pixman_implementation_t *imp,
     __m128i xmmMask, xmmMaskLo, xmmMaskHi;
     __m128i xmmDst, xmmDst0, xmmDst1, xmmDst2, xmmDst3;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     srca = src >> 24;
     if (src == 0)
@@ -4037,7 +4037,7 @@ fbCompositeSolidMask_nx8888x0565Csse2 (pixman_implementation_t *imp,
 
     __m64 mmxSrc, mmxAlpha, mmxMask, mmxDest;
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     if (src == 0)
         return;
@@ -4186,7 +4186,7 @@ fbCompositeIn_nx8x8sse2 (pixman_implementation_t *imp,
     fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1);
     fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1);
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     sa = src >> 24;
     if (sa == 0)
@@ -4380,7 +4380,7 @@ fbCompositeSrcAdd_8888x8x8sse2 (pixman_implementation_t *imp,
     fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1);
     fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1);
 
-    fbComposeGetSolid(pSrc, src, pDst->bits.format);
+    src = pixman_image_get_solid(pSrc, pDst->bits.format);
 
     sa = src >> 24;
     if (sa == 0)
diff --git a/pixman/pixman-vmx.c b/pixman/pixman-vmx.c
index c57cb1e..5a0ed50 100644
--- a/pixman/pixman-vmx.c
+++ b/pixman/pixman-vmx.c
@@ -1499,7 +1499,7 @@ fbCompositeSolid_nx8888vmx (pixman_operator_t	op,
     uint32_t	*dstLine, *dst;
     int	dstStride;
 
-    fbComposeGetSolid (pSrc, pDst, src);
+    pixman_image_get_solid (pSrc, pDst, src);
 
     if (src >> 24 == 0)
 	return;
@@ -1533,7 +1533,7 @@ fbCompositeSolid_nx0565vmx (pixman_operator_t	op,
     uint16_t	w;
     int	dstStride;
 
-    fbComposeGetSolid (pSrc, pDst, src);
+    pixman_image_get_solid (pSrc, pDst, src);
 
     if (src >> 24 == 0)
 	return;
commit 76aa72e8cac12400ac8f635b81642335b0d27310
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 18:51:36 2009 -0400

    Delete unused WRITE_ACCESS() macro

diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 02efe61..fcab468 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -164,8 +164,6 @@ _pixman_image_get_fetcher (pixman_image_t *image,
 	return image->common.get_scanline_32;
 }
 
-#define WRITE_ACCESS(f) ((image->common.write_func)? f##_accessors : f)
-
 static void
 image_property_changed (pixman_image_t *image)
 {
commit 3c0ed5b92dc205d4fa6c9fa2f2772022f2404549
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 18:51:06 2009 -0400

    Move pixman_image_fill_rectangles() to pixman.c

diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index e95cff2..02efe61 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -511,151 +511,6 @@ pixman_image_get_depth (pixman_image_t *image)
     return 0;
 }
 
-static uint32_t
-color_to_uint32 (const pixman_color_t *color)
-{
-    return
-	(color->alpha >> 8 << 24) |
-	(color->red >> 8 << 16) |
-        (color->green & 0xff00) |
-	(color->blue >> 8);
-}
-
-static pixman_bool_t
-color_to_pixel (pixman_color_t *color,
-		uint32_t       *pixel,
-		pixman_format_code_t format)
-{
-    uint32_t c = color_to_uint32 (color);
-
-    if (!(format == PIXMAN_a8r8g8b8	||
-	  format == PIXMAN_x8r8g8b8	||
-	  format == PIXMAN_a8b8g8r8	||
-	  format == PIXMAN_x8b8g8r8	||
-	  format == PIXMAN_b8g8r8a8	||
-	  format == PIXMAN_b8g8r8x8	||
-	  format == PIXMAN_r5g6b5	||
-	  format == PIXMAN_b5g6r5	||
-	  format == PIXMAN_a8))
-    {
-	return FALSE;
-    }
-
-    if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_ABGR)
-    {
-	c = ((c & 0xff000000) >>  0) |
-	    ((c & 0x00ff0000) >> 16) |
-	    ((c & 0x0000ff00) >>  0) |
-	    ((c & 0x000000ff) << 16);
-    }
-    if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_BGRA)
-    {
-	c = ((c & 0xff000000) >> 24) |
-	    ((c & 0x00ff0000) >>  8) |
-	    ((c & 0x0000ff00) <<  8) |
-	    ((c & 0x000000ff) << 24);
-    }
-
-    if (format == PIXMAN_a8)
-	c = c >> 24;
-    else if (format == PIXMAN_r5g6b5 ||
-	     format == PIXMAN_b5g6r5)
-	c = cvt8888to0565 (c);
-
-#if 0
-    printf ("color: %x %x %x %x\n", color->alpha, color->red, color->green, color->blue);
-    printf ("pixel: %x\n", c);
-#endif
-
-    *pixel = c;
-    return TRUE;
-}
-
-PIXMAN_EXPORT pixman_bool_t
-pixman_image_fill_rectangles (pixman_op_t		    op,
-			      pixman_image_t		   *dest,
-			      pixman_color_t		   *color,
-			      int			    n_rects,
-			      const pixman_rectangle16_t   *rects)
-{
-    pixman_image_t *solid;
-    pixman_color_t c;
-    int i;
-
-    if (color->alpha == 0xffff)
-    {
-	if (op == PIXMAN_OP_OVER)
-	    op = PIXMAN_OP_SRC;
-    }
-
-    if (op == PIXMAN_OP_CLEAR)
-    {
-	c.red = 0;
-	c.green = 0;
-	c.blue = 0;
-	c.alpha = 0;
-
-	color = &c;
-
-	op = PIXMAN_OP_SRC;
-    }
-
-    if (op == PIXMAN_OP_SRC)
-    {
-	uint32_t pixel;
-
-	if (color_to_pixel (color, &pixel, dest->bits.format))
-	{
-	    for (i = 0; i < n_rects; ++i)
-	    {
-		pixman_region32_t fill_region;
-		int n_boxes, j;
-		pixman_box32_t *boxes;
-
-		pixman_region32_init_rect (&fill_region, rects[i].x, rects[i].y, rects[i].width, rects[i].height);
-
-		if (dest->common.have_clip_region)
-		{
-		    if (!pixman_region32_intersect (&fill_region,
-						    &fill_region,
-						    &dest->common.clip_region))
-			return FALSE;
-		}
-
-		boxes = pixman_region32_rectangles (&fill_region, &n_boxes);
-		for (j = 0; j < n_boxes; ++j)
-		{
-		    const pixman_box32_t *box = &(boxes[j]);
-		    pixman_fill (dest->bits.bits, dest->bits.rowstride, PIXMAN_FORMAT_BPP (dest->bits.format),
-				 box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1,
-				 pixel);
-		}
-
-		pixman_region32_fini (&fill_region);
-	    }
-	    return TRUE;
-	}
-    }
-
-    solid = pixman_image_create_solid_fill (color);
-    if (!solid)
-	return FALSE;
-
-    for (i = 0; i < n_rects; ++i)
-    {
-	const pixman_rectangle16_t *rect = &(rects[i]);
-
-	pixman_image_composite (op, solid, NULL, dest,
-				0, 0, 0, 0,
-				rect->x, rect->y,
-				rect->width, rect->height);
-    }
-
-    pixman_image_unref (solid);
-
-    return TRUE;
-}
-
 pixman_bool_t
 pixman_image_can_get_solid (pixman_image_t *image)
 {
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 8a09f79..18a028e 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -337,7 +337,8 @@ union pixman_image
     solid_fill_t		solid;
 };
 
-/* Gradient walker
+/*
+ * Gradient walker
  */
 typedef struct
 {
diff --git a/pixman/pixman.c b/pixman/pixman.c
index 17bd566..6f08583 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -173,3 +173,148 @@ pixman_fill (uint32_t *bits,
 
     return _pixman_implementation_fill (imp, bits, stride, bpp, x, y, width, height, xor);
 }
+
+static uint32_t
+color_to_uint32 (const pixman_color_t *color)
+{
+    return
+	(color->alpha >> 8 << 24) |
+	(color->red >> 8 << 16) |
+        (color->green & 0xff00) |
+	(color->blue >> 8);
+}
+
+static pixman_bool_t
+color_to_pixel (pixman_color_t *color,
+		uint32_t       *pixel,
+		pixman_format_code_t format)
+{
+    uint32_t c = color_to_uint32 (color);
+
+    if (!(format == PIXMAN_a8r8g8b8	||
+	  format == PIXMAN_x8r8g8b8	||
+	  format == PIXMAN_a8b8g8r8	||
+	  format == PIXMAN_x8b8g8r8	||
+	  format == PIXMAN_b8g8r8a8	||
+	  format == PIXMAN_b8g8r8x8	||
+	  format == PIXMAN_r5g6b5	||
+	  format == PIXMAN_b5g6r5	||
+	  format == PIXMAN_a8))
+    {
+	return FALSE;
+    }
+
+    if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_ABGR)
+    {
+	c = ((c & 0xff000000) >>  0) |
+	    ((c & 0x00ff0000) >> 16) |
+	    ((c & 0x0000ff00) >>  0) |
+	    ((c & 0x000000ff) << 16);
+    }
+    if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_BGRA)
+    {
+	c = ((c & 0xff000000) >> 24) |
+	    ((c & 0x00ff0000) >>  8) |
+	    ((c & 0x0000ff00) <<  8) |
+	    ((c & 0x000000ff) << 24);
+    }
+
+    if (format == PIXMAN_a8)
+	c = c >> 24;
+    else if (format == PIXMAN_r5g6b5 ||
+	     format == PIXMAN_b5g6r5)
+	c = cvt8888to0565 (c);
+
+#if 0
+    printf ("color: %x %x %x %x\n", color->alpha, color->red, color->green, color->blue);
+    printf ("pixel: %x\n", c);
+#endif
+
+    *pixel = c;
+    return TRUE;
+}
+
+PIXMAN_EXPORT pixman_bool_t
+pixman_image_fill_rectangles (pixman_op_t		    op,
+			      pixman_image_t		   *dest,
+			      pixman_color_t		   *color,
+			      int			    n_rects,
+			      const pixman_rectangle16_t   *rects)
+{
+    pixman_image_t *solid;
+    pixman_color_t c;
+    int i;
+
+    if (color->alpha == 0xffff)
+    {
+	if (op == PIXMAN_OP_OVER)
+	    op = PIXMAN_OP_SRC;
+    }
+
+    if (op == PIXMAN_OP_CLEAR)
+    {
+	c.red = 0;
+	c.green = 0;
+	c.blue = 0;
+	c.alpha = 0;
+
+	color = &c;
+
+	op = PIXMAN_OP_SRC;
+    }
+
+    if (op == PIXMAN_OP_SRC)
+    {
+	uint32_t pixel;
+
+	if (color_to_pixel (color, &pixel, dest->bits.format))
+	{
+	    for (i = 0; i < n_rects; ++i)
+	    {
+		pixman_region32_t fill_region;
+		int n_boxes, j;
+		pixman_box32_t *boxes;
+
+		pixman_region32_init_rect (&fill_region, rects[i].x, rects[i].y, rects[i].width, rects[i].height);
+
+		if (dest->common.have_clip_region)
+		{
+		    if (!pixman_region32_intersect (&fill_region,
+						    &fill_region,
+						    &dest->common.clip_region))
+			return FALSE;
+		}
+
+		boxes = pixman_region32_rectangles (&fill_region, &n_boxes);
+		for (j = 0; j < n_boxes; ++j)
+		{
+		    const pixman_box32_t *box = &(boxes[j]);
+		    pixman_fill (dest->bits.bits, dest->bits.rowstride, PIXMAN_FORMAT_BPP (dest->bits.format),
+				 box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1,
+				 pixel);
+		}
+
+		pixman_region32_fini (&fill_region);
+	    }
+	    return TRUE;
+	}
+    }
+
+    solid = pixman_image_create_solid_fill (color);
+    if (!solid)
+	return FALSE;
+
+    for (i = 0; i < n_rects; ++i)
+    {
+	const pixman_rectangle16_t *rect = &(rects[i]);
+
+	pixman_image_composite (op, solid, NULL, dest,
+				0, 0, 0, 0,
+				rect->x, rect->y,
+				rect->width, rect->height);
+    }
+
+    pixman_image_unref (solid);
+
+    return TRUE;
+}
commit fb0fe616f2e0ce8f31f88887ca2a7ec394886b90
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 18:43:27 2009 -0400

    Delete unused mod macro

diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 259a87d..8a09f79 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -456,11 +456,6 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 #  define MAX(a,b) ((a > b)? a : b)
 #endif
 
-#if 0
-/* FIXME: the MOD macro above is equivalent, but faster I think */
-#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
-#endif
-
 /* FIXME: the (void)__read_func hides lots of warnings (which is what they
  * are supposed to do), but some of them are real. For example the one
  * where Fetch4 doesn't have a READ
commit bfa6f8c0b0418a3b4337da6c8bd0d4e9eda7e83e
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 18:40:25 2009 -0400

    Eliminate bit fiddling macros from pixman-private.h.
    
    There was one remaining use of FbMaskBits in the a1 trap rasterizer;
    just move that macro there.

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index d535b85..699402f 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -795,7 +795,7 @@ create_bits (pixman_format_code_t format,
     
     /* what follows is a long-winded way, avoiding any possibility of integer
      * overflows, of saying:
-     * stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (uint32_t);
+     * stride = ((width * bpp + 0x1f) >> 5) * sizeof (uint32_t);
      */
     
     bpp = PIXMAN_FORMAT_BPP (format);
@@ -803,16 +803,12 @@ create_bits (pixman_format_code_t format,
 	return NULL;
     
     stride = width * bpp;
-    if (pixman_addition_overflows_int (stride, FB_MASK))
+    if (pixman_addition_overflows_int (stride, 0x1f))
 	return NULL;
     
-    stride += FB_MASK;
-    stride >>= FB_SHIFT;
+    stride += 0x1f;
+    stride >>= 5;
     
-#if FB_SHIFT < 2
-    if (pixman_multiply_overflows_int (stride, sizeof (uint32_t)))
-	return NULL;
-#endif
     stride *= sizeof (uint32_t);
     
     if (pixman_multiply_overflows_int (height, stride))
diff --git a/pixman/pixman-edge-imp.h b/pixman/pixman-edge-imp.h
index 016bfab..477ab6b 100644
--- a/pixman/pixman-edge-imp.h
+++ b/pixman/pixman-edge-imp.h
@@ -78,25 +78,57 @@ rasterizeEdges (pixman_image_t  *image,
 
 #if N_BITS == 1
 	    {
+
+#ifdef WORDS_BIGENDIAN
+#   define FbScrLeft(x,n)	((x) << (n))
+#   define FbScrRight(x,n)	((x) >> (n))
+#else
+#   define FbScrLeft(x,n)	((x) >> (n))
+#   define FbScrRight(x,n)	((x) << (n))
+#endif
+
+#define FbLeftMask(x)							\
+		(((x) & 0x1f) ?						\
+		 FbScrRight (0xffffffff, (x) & 0x1f) : 0)
+#define FbRightMask(x)							\
+		(((32 - (x)) & 0x1f) ?					\
+		 FbScrLeft (0xffffffff, (32 - (x)) & 0x1f) : 0)
+		
+#define FbMaskBits(x,w,l,n,r) {						\
+		    n = (w);						\
+		    r = FbRightMask ((x) + n);				\
+		    l = FbLeftMask (x);					\
+		    if (l) {						\
+			n -= 32 - ((x) & 0x1f);				\
+			if (n < 0) {					\
+			    n = 0;					\
+			    l &= r;					\
+			    r = 0;					\
+			}						\
+		    }							\
+		    n >>= 5;						\
+		}
+		
 		uint32_t  *a = line;
 		uint32_t  startmask;
 		uint32_t  endmask;
 		int	    nmiddle;
 		int	    width = rxi - lxi;
 		int	    x = lxi;
-
-		a += x >> FB_SHIFT;
-		x &= FB_MASK;
-
+		
+		a += x >> 5;
+		x &= 0x1f;
+		
 		FbMaskBits (x, width, startmask, nmiddle, endmask);
-		    if (startmask) {
-			WRITE(image, a, READ(image, a) | startmask);
-			a++;
-		    }
-		    while (nmiddle--)
-			WRITE(image, a++, FB_ALLONES);
-		    if (endmask)
-			WRITE(image, a, READ(image, a) | endmask);
+
+		if (startmask) {
+		    WRITE(image, a, READ(image, a) | startmask);
+		    a++;
+		}
+		while (nmiddle--)
+		    WRITE(image, a++, FB_ALLONES);
+		if (endmask)
+		    WRITE(image, a, READ(image, a) | endmask);
 	    }
 #else
 	    {
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 4d1cdc8..259a87d 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -23,10 +23,7 @@
 #undef DEBUG
 #define DEBUG 0
 
-#define FB_SHIFT    5
-#define FB_UNIT     (1 << FB_SHIFT)
-#define FB_HALFUNIT (1 << (FB_SHIFT-1))
-#define FB_MASK     (FB_UNIT - 1)
+#define FB_MASK     (0x1f)
 #define FB_ALLONES  ((uint32_t) -1)
 
 /* Memory allocation helpers */
@@ -374,44 +371,6 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 
 
 
-#define LOG2_BITMAP_PAD 5
-#define FB_STIP_SHIFT	LOG2_BITMAP_PAD
-#define FB_STIP_UNIT	(1 << FB_STIP_SHIFT)
-#define FB_STIP_MASK	(FB_STIP_UNIT - 1)
-#define FB_STIP_ALLONES	((uint32_t) -1)
-
-#ifdef WORDS_BIGENDIAN
-#define FbScrLeft(x,n)	((x) << (n))
-#define FbScrRight(x,n)	((x) >> (n))
-#define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n)))
-#else
-#define FbScrLeft(x,n)	((x) >> (n))
-#define FbScrRight(x,n)	((x) << (n))
-#define FbLeftStipBits(x,n) ((x) & ((((uint32_t) 1) << (n)) - 1))
-#endif
-
-#define FbStipLeft(x,n)	FbScrLeft(x,n)
-#define FbStipRight(x,n) FbScrRight(x,n)
-#define FbLeftMask(x)       ( ((x) & FB_MASK) ?	\
-			      FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0)
-#define FbRightMask(x)      ( ((FB_UNIT - (x)) & FB_MASK) ? \
-			      FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0)
-
-#define FbMaskBits(x,w,l,n,r) {						\
-	n = (w); \
-	r = FbRightMask((x)+n); \
-	l = FbLeftMask(x); \
-	if (l) { \
-	    n -= FB_UNIT - ((x) & FB_MASK); \
-	    if (n < 0) { \
-		n = 0; \
-		l &= r; \
-		r = 0; \
-	    } \
-	} \
-	n >>= FB_SHIFT; \
-    }
-
 #ifdef WORDS_BIGENDIAN
 #define Fetch24(img, a)  ((unsigned long) (a) & 1 ?	      \
     ((READ(img, a) << 16) | READ(img, (uint16_t *) ((a)+1))) : \
commit 84886292e2c9be4149a32c7499015960331db426
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 18:29:39 2009 -0400

    Implement fbComposeGetSolid() as a call to pixman_image_get_scanline()

diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index d701288..4d1cdc8 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -548,57 +548,21 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 #endif
 
 #define fbComposeGetSolid(img, res, fmt)				\
-    do									\
     {									\
-	pixman_format_code_t format__;					\
-	if (img->type == SOLID)						\
-	{								\
-	    format__ = PIXMAN_a8r8g8b8;					\
-	    (res) = img->solid.color;					\
-	}								\
-	else								\
-	{								\
-	    uint32_t	       *bits__   = (img)->bits.bits;		\
-	    format__ = (img)->bits.format;				\
-		  							\
-	    switch (PIXMAN_FORMAT_BPP((img)->bits.format))		\
-	    {								\
-	    case 32:							\
-		(res) = READ(img, (uint32_t *)bits__);			\
-		break;							\
-	    case 24:							\
-		(res) = Fetch24(img, (uint8_t *) bits__);		\
-		break;							\
-	    case 16:							\
-		(res) = READ(img, (uint16_t *) bits__);			\
-		(res) = cvt0565to0888(res);				\
-		break;							\
-	    case 8:							\
-		(res) = READ(img, (uint8_t *) bits__);			\
-		(res) = (res) << 24;					\
-		break;							\
-	    case 1:							\
-		(res) = READ(img, (uint32_t *) bits__);			\
-		(res) = FbLeftStipBits((res),1) ? 0xff000000 : 0x00000000; \
-		break;							\
-	    default:							\
-		return;							\
-	    }								\
-	    /* manage missing src alpha */				\
-	    if (!PIXMAN_FORMAT_A((img)->bits.format))			\
-		(res) |= 0xff000000;					\
-	}								\
+	uint32_t __pixel;						\
+									\
+	_pixman_image_get_scanline_32 (img, 0, 0, 1, &__pixel, NULL, 0); \
 									\
 	/* If necessary, convert RGB <--> BGR. */			\
-	if (PIXMAN_FORMAT_TYPE (format__) != PIXMAN_FORMAT_TYPE(fmt))	\
+	if (PIXMAN_FORMAT_TYPE(fmt) != PIXMAN_TYPE_ARGB)		\
 	{								\
-	    (res) = ((((res) & 0xff000000) >>  0) |			\
-		     (((res) & 0x00ff0000) >> 16) |			\
-		     (((res) & 0x0000ff00) >>  0) |			\
-		     (((res) & 0x000000ff) << 16));			\
+	    (__pixel) = ((((__pixel) & 0xff000000) >>  0) |		\
+			 (((__pixel) & 0x00ff0000) >> 16) |		\
+			 (((__pixel) & 0x0000ff00) >>  0) |		\
+			 (((__pixel) & 0x000000ff) << 16));		\
 	}								\
-    }									\
-    while (0)
+	(res) = __pixel;						\
+    }
 
 #define fbComposeGetStart(pict,x,y,type,out_stride,line,mul) do {	\
 	uint32_t	*__bits__;					\
commit 8e40734174e97ff319c31ba49096cc8b7d5117ae
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 16:45:17 2009 -0400

    Eliminate FbStipMask macro.
    
    It was only used for storing into a1 images, and that code could be
    written more clearly by computing the bit index directly.

diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 8a5a1f5..8fa1c9d 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -2427,11 +2427,16 @@ fbStore_a1 (pixman_image_t *image,
 	    uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
 {
     int i;
-    for (i = 0; i < width; ++i) {
+    for (i = 0; i < width; ++i)
+    {
 	uint32_t  *pixel = ((uint32_t *) bits) + ((i+x) >> 5);
-	uint32_t  mask = FbStipMask((i+x) & 0x1f, 1);
-
-	uint32_t v = values[i] & 0x80000000 ? mask : 0;
+	uint32_t mask, v;
+#ifdef WORDS_BIGENDIAN
+	mask = 1 << (0x1f - ((i+x) & 0x1f));
+#else
+	mask = 1 << ((i+x) & 0x1f);
+#endif
+	v = values[i] & 0x80000000 ? mask : 0;
 	WRITE(image, pixel, (READ(image, pixel) & ~mask) | v);
     }
 }
@@ -2441,11 +2446,17 @@ fbStore_g1 (pixman_image_t *image,
 	    uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
 {
     int i;
-    for (i = 0; i < width; ++i) {
+    for (i = 0; i < width; ++i)
+    {
 	uint32_t  *pixel = ((uint32_t *) bits) + ((i+x) >> 5);
-	uint32_t  mask = FbStipMask((i+x) & 0x1f, 1);
+	uint32_t  mask, v;
 
-	uint32_t v = miIndexToEntY24(indexed,values[i]) ? mask : 0;
+#ifdef WORDS_BIGENDIAN
+	mask = 1 << (0x1f - ((i+x) & 0x1f));
+#else
+	mask = 1 << ((i + x) & 0x1f);
+#endif
+	v = miIndexToEntY24 (indexed, values[i]) ? mask : 0;
 	WRITE(image, pixel, (READ(image, pixel) & ~mask) | v);
     }
 }
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 753d705..d701288 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -392,10 +392,7 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 
 #define FbStipLeft(x,n)	FbScrLeft(x,n)
 #define FbStipRight(x,n) FbScrRight(x,n)
-#define FbStipMask(x,w)	(FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \
-			 FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK))
-
-#define FbLeftMask(x)       ( ((x) & FB_MASK) ? \
+#define FbLeftMask(x)       ( ((x) & FB_MASK) ?	\
 			      FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0)
 #define FbRightMask(x)      ( ((FB_UNIT - (x)) & FB_MASK) ? \
 			      FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0)
commit 590d034bb399d28b191ac50c764d03ebd342e149
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 16:07:50 2009 -0400

    Implement pixman_format_supported_destination() in terms of pixman_format_supported_source()

diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index a7f9682..41eaaef 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -201,18 +201,17 @@ pixman_version_string (void)
 }
 
 /**
- * pixman_format_supported_destination:
+ * pixman_format_supported_source:
  * @format: A pixman_format_code_t format
  * 
  * Return value: whether the provided format code is a supported
- * format for a pixman surface used as a destination in
+ * format for a pixman surface used as a source in
  * rendering.
  *
- * Currently, all pixman_format_code_t values are supported
- * except for the YUV formats.
+ * Currently, all pixman_format_code_t values are supported.
  **/
 PIXMAN_EXPORT pixman_bool_t
-pixman_format_supported_destination (pixman_format_code_t format)
+pixman_format_supported_source (pixman_format_code_t format)
 {
     switch (format) {
     /* 32 bpp formats */
@@ -263,86 +262,35 @@ pixman_format_supported_destination (pixman_format_code_t format)
     /* 1bpp formats */
     case PIXMAN_a1:
     case PIXMAN_g1:
-	return TRUE;
-	
     /* YUV formats */
     case PIXMAN_yuy2:
     case PIXMAN_yv12:
+	return TRUE;
+
     default:
 	return FALSE;
     }
 }
 
 /**
- * pixman_format_supported_source:
+ * pixman_format_supported_destination:
  * @format: A pixman_format_code_t format
  * 
  * Return value: whether the provided format code is a supported
- * format for a pixman surface used as a source in
+ * format for a pixman surface used as a destination in
  * rendering.
  *
- * Currently, all pixman_format_code_t values are supported.
+ * Currently, all pixman_format_code_t values are supported
+ * except for the YUV formats.
  **/
 PIXMAN_EXPORT pixman_bool_t
-pixman_format_supported_source (pixman_format_code_t format)
+pixman_format_supported_destination (pixman_format_code_t format)
 {
-    switch (format) {
-    /* 32 bpp formats */
-    case PIXMAN_a2b10g10r10:
-    case PIXMAN_x2b10g10r10:
-    case PIXMAN_a8r8g8b8:
-    case PIXMAN_x8r8g8b8:
-    case PIXMAN_a8b8g8r8:
-    case PIXMAN_x8b8g8r8:
-    case PIXMAN_b8g8r8a8:
-    case PIXMAN_b8g8r8x8:
-    case PIXMAN_r8g8b8:
-    case PIXMAN_b8g8r8:
-    case PIXMAN_r5g6b5:
-    case PIXMAN_b5g6r5:
-    /* 16 bpp formats */
-    case PIXMAN_a1r5g5b5:
-    case PIXMAN_x1r5g5b5:
-    case PIXMAN_a1b5g5r5:
-    case PIXMAN_x1b5g5r5:
-    case PIXMAN_a4r4g4b4:
-    case PIXMAN_x4r4g4b4:
-    case PIXMAN_a4b4g4r4:
-    case PIXMAN_x4b4g4r4:
-    /* 8bpp formats */
-    case PIXMAN_a8:
-    case PIXMAN_r3g3b2:
-    case PIXMAN_b2g3r3:
-    case PIXMAN_a2r2g2b2:
-    case PIXMAN_a2b2g2r2:
-    case PIXMAN_c8:
-    case PIXMAN_g8:
-    case PIXMAN_x4a4:
-    /* Collides with PIXMAN_c8
-    case PIXMAN_x4c4:
-    */
-    /* Collides with PIXMAN_g8
-    case PIXMAN_x4g4:
-    */
-    /* 4bpp formats */
-    case PIXMAN_a4:
-    case PIXMAN_r1g2b1:
-    case PIXMAN_b1g2r1:
-    case PIXMAN_a1r1g1b1:
-    case PIXMAN_a1b1g1r1:
-    case PIXMAN_c4:
-    case PIXMAN_g4:
-    /* 1bpp formats */
-    case PIXMAN_a1:
-    case PIXMAN_g1:
-    /* YUV formats */
-    case PIXMAN_yuy2:
-    case PIXMAN_yv12:
-	return TRUE;
-
-    default:
+    /* YUV formats cannot be written to at the moment */
+    if (format == PIXMAN_yuy2 || format == PIXMAN_yv12)
 	return FALSE;
-    }
+
+    return pixman_format_supported_source (format);
 }
 
 static void
commit 16a87a89e1330c18876aaf17ccc6f07243062ca8
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 15:09:02 2009 -0400

    Move FbGen macro into pixman-combine.c

diff --git a/pixman/pixman-combine.c.template b/pixman/pixman-combine.c.template
index 2f4d6a7..7d05ce8 100644
--- a/pixman/pixman-combine.c.template
+++ b/pixman/pixman-combine.c.template
@@ -16,7 +16,6 @@
  * this difference will have two versions using the same convention.
  */
 
-
 /*
  * All of the composing functions
  */
@@ -343,6 +342,11 @@ fbCombineConjointInPart (comp1_t a, comp1_t b)
     return IntDiv(b,a);     /* b/a */
 }
 
+#define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (IntMult(GetComp(y,i),ay,(u)) + \
+					 IntMult(GetComp(x,i),ax,(v))), \
+				  	 (comp4_t) ((comp1_t) ((t) |		\
+					 (0 - ((t) >> G_SHIFT)))) << (i))
+
 static void
 fbCombineDisjointGeneralU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine)
 {
diff --git a/pixman/pixman-combine.h.template b/pixman/pixman-combine.h.template
index 6ecd301..f2e58a1 100644
--- a/pixman/pixman-combine.h.template
+++ b/pixman/pixman-combine.h.template
@@ -29,11 +29,6 @@
 #define Add(x,y,i,t)   ((t) = GetComp(x,i) + GetComp(y,i),              \
                         (comp4_t) ((comp1_t) ((t) | (0 - ((t) >> G_SHIFT)))) << (i))
 
-#define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (IntMult(GetComp(y,i),ay,(u)) + \
-					 IntMult(GetComp(x,i),ax,(v))), \
-				  (comp4_t) ((comp1_t) ((t) |		\
-							 (0 - ((t) >> G_SHIFT)))) << (i))
-
 /*
   The methods below use some tricks to be able to do two color
   components at the same time.
commit d18722cdb6ddde7abba9cd1492e636f2668fadf1
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 13:18:46 2009 -0400

    Use DIV instead of _div In pixman-trap.c.

diff --git a/pixman/pixman-trap.c b/pixman/pixman-trap.c
index 69ee726..3e88f8c 100644
--- a/pixman/pixman-trap.c
+++ b/pixman/pixman-trap.c
@@ -53,8 +53,6 @@ pixman_sample_ceil_y (pixman_fixed_t y, int n)
     return (i | f);
 }
 
-#define _div(a,b)    ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b)))
-
 /*
  * Compute the largest value no greater than y which is on a
  * grid row
@@ -65,7 +63,7 @@ pixman_sample_floor_y (pixman_fixed_t y, int n)
     pixman_fixed_t   f = pixman_fixed_frac(y);
     pixman_fixed_t   i = pixman_fixed_floor (y);
 
-    f = _div(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
+    f = DIV(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
     if (f < Y_FRAC_FIRST(n))
     {
 	if (pixman_fixed_to_int(i) == 0x8000)
commit 81d6725f3106a888fe0fbffba4a0d05d553d0777
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 11:19:00 2009 -0400

    Move edge utilities into pixman-trap.c

diff --git a/pixman/pixman-trap.c b/pixman/pixman-trap.c
index 7e44e4f..69ee726 100644
--- a/pixman/pixman-trap.c
+++ b/pixman/pixman-trap.c
@@ -27,6 +27,189 @@
 #include <stdio.h>
 #include "pixman-private.h"
 
+
+/*
+ * Compute the smallest value no less than y which is on a
+ * grid row
+ */
+
+PIXMAN_EXPORT pixman_fixed_t
+pixman_sample_ceil_y (pixman_fixed_t y, int n)
+{
+    pixman_fixed_t   f = pixman_fixed_frac(y);
+    pixman_fixed_t   i = pixman_fixed_floor(y);
+
+    f = ((f + Y_FRAC_FIRST(n)) / STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
+    if (f > Y_FRAC_LAST(n))
+    {
+	if (pixman_fixed_to_int(i) == 0x7fff)
+	{
+	    f = 0xffff; /* saturate */
+	} else {
+	    f = Y_FRAC_FIRST(n);
+	    i += pixman_fixed_1;
+	}
+    }
+    return (i | f);
+}
+
+#define _div(a,b)    ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b)))
+
+/*
+ * Compute the largest value no greater than y which is on a
+ * grid row
+ */
+PIXMAN_EXPORT pixman_fixed_t
+pixman_sample_floor_y (pixman_fixed_t y, int n)
+{
+    pixman_fixed_t   f = pixman_fixed_frac(y);
+    pixman_fixed_t   i = pixman_fixed_floor (y);
+
+    f = _div(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
+    if (f < Y_FRAC_FIRST(n))
+    {
+	if (pixman_fixed_to_int(i) == 0x8000)
+	{
+	    f = 0; /* saturate */
+	} else {
+	    f = Y_FRAC_LAST(n);
+	    i -= pixman_fixed_1;
+	}
+    }
+    return (i | f);
+}
+
+/*
+ * Step an edge by any amount (including negative values)
+ */
+PIXMAN_EXPORT void
+pixman_edge_step (pixman_edge_t *e, int n)
+{
+    pixman_fixed_48_16_t	ne;
+
+    e->x += n * e->stepx;
+
+    ne = e->e + n * (pixman_fixed_48_16_t) e->dx;
+
+    if (n >= 0)
+    {
+	if (ne > 0)
+	{
+	    int nx = (ne + e->dy - 1) / e->dy;
+	    e->e = ne - nx * (pixman_fixed_48_16_t) e->dy;
+	    e->x += nx * e->signdx;
+	}
+    }
+    else
+    {
+	if (ne <= -e->dy)
+	{
+	    int nx = (-ne) / e->dy;
+	    e->e = ne + nx * (pixman_fixed_48_16_t) e->dy;
+	    e->x -= nx * e->signdx;
+	}
+    }
+}
+
+/*
+ * A private routine to initialize the multi-step
+ * elements of an edge structure
+ */
+static void
+_pixman_edge_multi_init (pixman_edge_t *e, int n, pixman_fixed_t *stepx_p, pixman_fixed_t *dx_p)
+{
+    pixman_fixed_t	stepx;
+    pixman_fixed_48_16_t	ne;
+
+    ne = n * (pixman_fixed_48_16_t) e->dx;
+    stepx = n * e->stepx;
+    if (ne > 0)
+    {
+	int nx = ne / e->dy;
+	ne -= nx * e->dy;
+	stepx += nx * e->signdx;
+    }
+    *dx_p = ne;
+    *stepx_p = stepx;
+}
+
+/*
+ * Initialize one edge structure given the line endpoints and a
+ * starting y value
+ */
+PIXMAN_EXPORT void
+pixman_edge_init (pixman_edge_t	*e,
+		  int		n,
+		  pixman_fixed_t		y_start,
+		  pixman_fixed_t		x_top,
+		  pixman_fixed_t		y_top,
+		  pixman_fixed_t		x_bot,
+		  pixman_fixed_t		y_bot)
+{
+    pixman_fixed_t	dx, dy;
+
+    e->x = x_top;
+    e->e = 0;
+    dx = x_bot - x_top;
+    dy = y_bot - y_top;
+    e->dy = dy;
+    e->dx = 0;
+    if (dy)
+    {
+	if (dx >= 0)
+	{
+	    e->signdx = 1;
+	    e->stepx = dx / dy;
+	    e->dx = dx % dy;
+	    e->e = -dy;
+	}
+	else
+	{
+	    e->signdx = -1;
+	    e->stepx = -(-dx / dy);
+	    e->dx = -dx % dy;
+	    e->e = 0;
+	}
+
+	_pixman_edge_multi_init (e, STEP_Y_SMALL(n), &e->stepx_small, &e->dx_small);
+	_pixman_edge_multi_init (e, STEP_Y_BIG(n), &e->stepx_big, &e->dx_big);
+    }
+    pixman_edge_step (e, y_start - y_top);
+}
+
+/*
+ * Initialize one edge structure given a line, starting y value
+ * and a pixel offset for the line
+ */
+PIXMAN_EXPORT void
+pixman_line_fixed_edge_init (pixman_edge_t *e,
+			     int	    n,
+			     pixman_fixed_t	    y,
+			     const pixman_line_fixed_t *line,
+			     int	    x_off,
+			     int	    y_off)
+{
+    pixman_fixed_t	x_off_fixed = pixman_int_to_fixed(x_off);
+    pixman_fixed_t	y_off_fixed = pixman_int_to_fixed(y_off);
+    const pixman_point_fixed_t *top, *bot;
+
+    if (line->p1.y <= line->p2.y)
+    {
+	top = &line->p1;
+	bot = &line->p2;
+    }
+    else
+    {
+	top = &line->p2;
+	bot = &line->p1;
+    }
+    pixman_edge_init (e, n, y,
+		    top->x + x_off_fixed,
+		    top->y + y_off_fixed,
+		    bot->x + x_off_fixed,
+		    bot->y + y_off_fixed);
+}
+
 PIXMAN_EXPORT void
 pixman_add_traps (pixman_image_t *	image,
 		  int16_t	x_off,
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index c09bff4..a7f9682 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -29,188 +29,6 @@
 
 #include "pixman-private.h"
 
-/*
- * Compute the smallest value no less than y which is on a
- * grid row
- */
-
-PIXMAN_EXPORT pixman_fixed_t
-pixman_sample_ceil_y (pixman_fixed_t y, int n)
-{
-    pixman_fixed_t   f = pixman_fixed_frac(y);
-    pixman_fixed_t   i = pixman_fixed_floor(y);
-
-    f = ((f + Y_FRAC_FIRST(n)) / STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
-    if (f > Y_FRAC_LAST(n))
-    {
-	if (pixman_fixed_to_int(i) == 0x7fff)
-	{
-	    f = 0xffff; /* saturate */
-	} else {
-	    f = Y_FRAC_FIRST(n);
-	    i += pixman_fixed_1;
-	}
-    }
-    return (i | f);
-}
-
-#define _div(a,b)    ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b)))
-
-/*
- * Compute the largest value no greater than y which is on a
- * grid row
- */
-PIXMAN_EXPORT pixman_fixed_t
-pixman_sample_floor_y (pixman_fixed_t y, int n)
-{
-    pixman_fixed_t   f = pixman_fixed_frac(y);
-    pixman_fixed_t   i = pixman_fixed_floor (y);
-
-    f = _div(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
-    if (f < Y_FRAC_FIRST(n))
-    {
-	if (pixman_fixed_to_int(i) == 0x8000)
-	{
-	    f = 0; /* saturate */
-	} else {
-	    f = Y_FRAC_LAST(n);
-	    i -= pixman_fixed_1;
-	}
-    }
-    return (i | f);
-}
-
-/*
- * Step an edge by any amount (including negative values)
- */
-PIXMAN_EXPORT void
-pixman_edge_step (pixman_edge_t *e, int n)
-{
-    pixman_fixed_48_16_t	ne;
-
-    e->x += n * e->stepx;
-
-    ne = e->e + n * (pixman_fixed_48_16_t) e->dx;
-
-    if (n >= 0)
-    {
-	if (ne > 0)
-	{
-	    int nx = (ne + e->dy - 1) / e->dy;
-	    e->e = ne - nx * (pixman_fixed_48_16_t) e->dy;
-	    e->x += nx * e->signdx;
-	}
-    }
-    else
-    {
-	if (ne <= -e->dy)
-	{
-	    int nx = (-ne) / e->dy;
-	    e->e = ne + nx * (pixman_fixed_48_16_t) e->dy;
-	    e->x -= nx * e->signdx;
-	}
-    }
-}
-
-/*
- * A private routine to initialize the multi-step
- * elements of an edge structure
- */
-static void
-_pixman_edge_multi_init (pixman_edge_t *e, int n, pixman_fixed_t *stepx_p, pixman_fixed_t *dx_p)
-{
-    pixman_fixed_t	stepx;
-    pixman_fixed_48_16_t	ne;
-
-    ne = n * (pixman_fixed_48_16_t) e->dx;
-    stepx = n * e->stepx;
-    if (ne > 0)
-    {
-	int nx = ne / e->dy;
-	ne -= nx * e->dy;
-	stepx += nx * e->signdx;
-    }
-    *dx_p = ne;
-    *stepx_p = stepx;
-}
-
-/*
- * Initialize one edge structure given the line endpoints and a
- * starting y value
- */
-PIXMAN_EXPORT void
-pixman_edge_init (pixman_edge_t	*e,
-		  int		n,
-		  pixman_fixed_t		y_start,
-		  pixman_fixed_t		x_top,
-		  pixman_fixed_t		y_top,
-		  pixman_fixed_t		x_bot,
-		  pixman_fixed_t		y_bot)
-{
-    pixman_fixed_t	dx, dy;
-
-    e->x = x_top;
-    e->e = 0;
-    dx = x_bot - x_top;
-    dy = y_bot - y_top;
-    e->dy = dy;
-    e->dx = 0;
-    if (dy)
-    {
-	if (dx >= 0)
-	{
-	    e->signdx = 1;
-	    e->stepx = dx / dy;
-	    e->dx = dx % dy;
-	    e->e = -dy;
-	}
-	else
-	{
-	    e->signdx = -1;
-	    e->stepx = -(-dx / dy);
-	    e->dx = -dx % dy;
-	    e->e = 0;
-	}
-
-	_pixman_edge_multi_init (e, STEP_Y_SMALL(n), &e->stepx_small, &e->dx_small);
-	_pixman_edge_multi_init (e, STEP_Y_BIG(n), &e->stepx_big, &e->dx_big);
-    }
-    pixman_edge_step (e, y_start - y_top);
-}
-
-/*
- * Initialize one edge structure given a line, starting y value
- * and a pixel offset for the line
- */
-PIXMAN_EXPORT void
-pixman_line_fixed_edge_init (pixman_edge_t *e,
-			     int	    n,
-			     pixman_fixed_t	    y,
-			     const pixman_line_fixed_t *line,
-			     int	    x_off,
-			     int	    y_off)
-{
-    pixman_fixed_t	x_off_fixed = pixman_int_to_fixed(x_off);
-    pixman_fixed_t	y_off_fixed = pixman_int_to_fixed(y_off);
-    const pixman_point_fixed_t *top, *bot;
-
-    if (line->p1.y <= line->p2.y)
-    {
-	top = &line->p1;
-	bot = &line->p2;
-    }
-    else
-    {
-	top = &line->p2;
-	bot = &line->p1;
-    }
-    pixman_edge_init (e, n, y,
-		    top->x + x_off_fixed,
-		    top->y + y_off_fixed,
-		    bot->x + x_off_fixed,
-		    bot->y + y_off_fixed);
-}
-
 pixman_bool_t
 pixman_multiply_overflows_int (unsigned int a,
 		               unsigned int b)
commit 793c92dadb6f9c82ace50711c0e8c51e62368f19
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 11:15:30 2009 -0400

    Move compiler dependencies to a new pixman-compiler.h file

diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index 1f6afb4..4593757 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -10,6 +10,7 @@ libpixman_1_la_SOURCES =			\
 	pixman-gradient-walker.c		\
 	pixman-region16.c			\
 	pixman-region32.c			\
+	pixman-compiler.h			\
 	pixman-private.h			\
 	pixman-image.c				\
 	pixman-implementation.c			\
diff --git a/pixman/pixman-compiler.h b/pixman/pixman-compiler.h
new file mode 100644
index 0000000..466199d
--- /dev/null
+++ b/pixman/pixman-compiler.h
@@ -0,0 +1,71 @@
+/* Pixman uses some non-standard compiler features. This file ensures
+ * they exist
+ *
+ * The features are:
+ *
+ *    FUNC	     must be defined to expand to the current function
+ *    PIXMAN_EXPORT  should be defined to whatever is required to
+ *                   export functions from a shared library
+ *    limits	     limits for various types must be defined
+ *    inline         must be defined
+ *    force_inline   must be defined
+ */
+#if defined (__GNUC__)
+#  define FUNC     ((const char*) (__PRETTY_FUNCTION__))
+#elif defined (__sun) || (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
+#  define FUNC     ((const char*) (__func__))
+#else
+#  define FUNC     ((const char*) ("???"))
+#endif
+
+#ifndef INT16_MIN
+# define INT16_MIN              (-32767-1)
+#endif
+
+#ifndef INT16_MAX
+# define INT16_MAX              (32767)
+#endif
+
+#ifndef INT32_MIN
+# define INT32_MIN              (-2147483647-1)
+#endif
+
+#ifndef INT32_MAX
+# define INT32_MAX              (2147483647)
+#endif
+
+#ifndef UINT32_MIN
+# define UINT32_MIN             (0)
+#endif
+
+#ifndef UINT32_MAX
+# define UINT32_MAX             (4294967295U)
+#endif
+
+#ifndef M_PI
+# define M_PI			3.14159265358979323846
+#endif
+
+#ifdef _MSC_VER
+/* 'inline' is available only in C++ in MSVC */
+#   define inline __inline
+#   define force_inline __forceinline
+#elif defined __GNUC__ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#   define inline __inline__
+#   define force_inline __inline__ __attribute__ ((__always_inline__))
+#else
+# ifndef force_inline
+#  define force_inline inline
+# endif
+#endif
+
+/* GCC visibility */
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define PIXMAN_EXPORT __attribute__ ((visibility("default")))
+/* Sun Studio 8 visibility */
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
+#define PIXMAN_EXPORT __global
+#else
+#define PIXMAN_EXPORT
+#endif
+
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 4fae0fc..753d705 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -9,6 +9,9 @@
 #include <time.h>
 #include <assert.h>
 
+#include "pixman-compiler.h"
+
+
 #ifndef FALSE
 #define FALSE 0
 #endif
@@ -20,55 +23,6 @@
 #undef DEBUG
 #define DEBUG 0
 
-#if defined (__GNUC__)
-#  define FUNC     ((const char*) (__PRETTY_FUNCTION__))
-#elif defined (__sun) || (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
-#  define FUNC     ((const char*) (__func__))
-#else
-#  define FUNC     ((const char*) ("???"))
-#endif
-
-#ifndef INT16_MIN
-# define INT16_MIN              (-32767-1)
-#endif
-
-#ifndef INT16_MAX
-# define INT16_MAX              (32767)
-#endif
-
-#ifndef INT32_MIN
-# define INT32_MIN              (-2147483647-1)
-#endif
-
-#ifndef INT32_MAX
-# define INT32_MAX              (2147483647)
-#endif
-
-#ifndef UINT32_MIN
-# define UINT32_MIN             (0)
-#endif
-
-#ifndef UINT32_MAX
-# define UINT32_MAX             (4294967295U)
-#endif
-
-#ifndef M_PI
-# define M_PI			3.14159265358979323846
-#endif
-
-#ifdef _MSC_VER
-/* 'inline' is available only in C++ in MSVC */
-#   define inline __inline
-#   define force_inline __forceinline
-#elif defined __GNUC__ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-#   define inline __inline__
-#   define force_inline __inline__ __attribute__ ((__always_inline__))
-#else
-# ifndef force_inline
-#  define force_inline inline
-# endif
-#endif
-
 #define FB_SHIFT    5
 #define FB_UNIT     (1 << FB_SHIFT)
 #define FB_HALFUNIT (1 << (FB_SHIFT-1))
@@ -742,16 +696,6 @@ pixman_compute_composite_region32 (pixman_region32_t *	pRegion,
 				   uint16_t		width,
 				   uint16_t		height);
 
-/* GCC visibility */
-#if defined(__GNUC__) && __GNUC__ >= 4
-#define PIXMAN_EXPORT __attribute__ ((visibility("default")))
-/* Sun Studio 8 visibility */
-#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
-#define PIXMAN_EXPORT __global
-#else
-#define PIXMAN_EXPORT
-#endif
-
 /* Region Helpers */
 pixman_bool_t pixman_region32_copy_from_region16 (pixman_region32_t *dst,
 						  pixman_region16_t *src);
commit 5624ca0417bf7a30b5b05235e902b237a77b8543
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 10:12:15 2009 -0400

    Rename FastPathInfo to pixman_fast_path_t

diff --git a/pixman/pixman-arm-neon.c b/pixman/pixman-arm-neon.c
index 37ae9f2..966704a 100644
--- a/pixman/pixman-arm-neon.c
+++ b/pixman/pixman-arm-neon.c
@@ -2092,7 +2092,7 @@ fbCompositeOver_8888x0565neon (
 
 #endif  // USE_GCC_INLINE_ASM
 
-static const FastPathInfo arm_neon_fast_path_array[] = 
+static const pixman_fast_path_t arm_neon_fast_path_array[] = 
 {
     { PIXMAN_OP_ADD,  PIXMAN_solid,    PIXMAN_a8,       PIXMAN_a8,       fbCompositeSrcAdd_8888x8x8neon,        0 },
     { PIXMAN_OP_ADD,  PIXMAN_a8,       PIXMAN_null,     PIXMAN_a8,       fbCompositeSrcAdd_8000x8000neon,       0 },
@@ -2123,7 +2123,7 @@ static const FastPathInfo arm_neon_fast_path_array[] =
     { PIXMAN_OP_NONE },
 };
 
-const FastPathInfo *const arm_neon_fast_paths = arm_neon_fast_path_array;
+const pixman_fast_path_t *const arm_neon_fast_paths = arm_neon_fast_path_array;
 
 static void
 arm_neon_composite (pixman_implementation_t *imp,
diff --git a/pixman/pixman-arm-neon.h b/pixman/pixman-arm-neon.h
index aed7a4d..19eebec 100644
--- a/pixman/pixman-arm-neon.h
+++ b/pixman/pixman-arm-neon.h
@@ -36,7 +36,7 @@ pixman_bool_t pixman_have_arm_neon(void);
 
 #ifdef USE_ARM_NEON
 
-extern const FastPathInfo *const arm_neon_fast_paths;
+extern const pixman_fast_path_t *const arm_neon_fast_paths;
 
 void
 fbCompositeSrcAdd_8000x8000neon (
diff --git a/pixman/pixman-arm-simd.c b/pixman/pixman-arm-simd.c
index 951f847..0b9c529 100644
--- a/pixman/pixman-arm-simd.c
+++ b/pixman/pixman-arm-simd.c
@@ -416,7 +416,7 @@ fbCompositeSolidMask_nx8x8888arm (
     }
 }
 
-static const FastPathInfo arm_simd_fast_path_array[] =
+static const pixman_fast_path_t arm_simd_fast_path_array[] =
 {
     { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_null,     PIXMAN_a8r8g8b8, fbCompositeSrc_8888x8888arm,      0 },
     { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_null,	PIXMAN_x8r8g8b8, fbCompositeSrc_8888x8888arm,	   0 },
@@ -435,7 +435,7 @@ static const FastPathInfo arm_simd_fast_path_array[] =
     { PIXMAN_OP_NONE },
 };
 
-const FastPathInfo *const arm_simd_fast_paths = arm_simd_fast_path_array;
+const pixman_fast_path_t *const arm_simd_fast_paths = arm_simd_fast_path_array;
 
 static void
 arm_simd_composite (pixman_implementation_t *imp,
diff --git a/pixman/pixman-arm-simd.h b/pixman/pixman-arm-simd.h
index 8c1f883..c76315a 100644
--- a/pixman/pixman-arm-simd.h
+++ b/pixman/pixman-arm-simd.h
@@ -36,7 +36,7 @@ pixman_bool_t pixman_have_arm_simd(void);
 
 #ifdef USE_ARM_SIMD
 
-extern const FastPathInfo *const arm_simd_fast_paths;
+extern const pixman_fast_path_t *const arm_simd_fast_paths;
 
 void
 fbCompositeSrcAdd_8000x8000arm (
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 67510c3..0620420 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -1010,7 +1010,7 @@ fbCompositeSrc_8888xx888 (pixman_implementation_t *imp,
     }
 }
 
-static const FastPathInfo c_fast_paths[] =
+static const pixman_fast_path_t c_fast_paths[] =
 {
     { PIXMAN_OP_OVER, PIXMAN_solid,    PIXMAN_a8,       PIXMAN_r5g6b5,   fbCompositeSolidMask_nx8x0565, 0 },
     { PIXMAN_OP_OVER, PIXMAN_solid,    PIXMAN_a8,       PIXMAN_b5g6r5,   fbCompositeSolidMask_nx8x0565, 0 },
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 293f425..350a048 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -3018,7 +3018,7 @@ fbCompositeOver_x888x8x8888mmx (pixman_implementation_t *imp,
     _mm_empty();
 }
 
-static const FastPathInfo mmx_fast_paths[] =
+static const pixman_fast_path_t mmx_fast_paths[] =
 {
     { PIXMAN_OP_OVER, PIXMAN_solid,    PIXMAN_a8,       PIXMAN_r5g6b5,   fbCompositeSolidMask_nx8x0565mmx,     0 },
     { PIXMAN_OP_OVER, PIXMAN_solid,    PIXMAN_a8,       PIXMAN_b5g6r5,   fbCompositeSolidMask_nx8x0565mmx,     0 },
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 66fab9d..4fae0fc 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -894,7 +894,7 @@ typedef struct
     pixman_format_code_t	dest_format;
     pixman_composite_func_t	func;
     uint32_t			flags;
-} FastPathInfo;
+} pixman_fast_path_t;
 
 struct pixman_implementation_t
 {
@@ -1009,7 +1009,7 @@ _pixman_implementation_create_vmx (void);
 #endif
 
 pixman_bool_t
-_pixman_run_fast_path (const FastPathInfo *paths,
+_pixman_run_fast_path (const pixman_fast_path_t *paths,
 		       pixman_implementation_t *imp,
 		       pixman_op_t op,
 		       pixman_image_t *src,
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 0709a3b..0908fc9 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -4869,7 +4869,7 @@ fbCompositeOver_x888x8x8888sse2 (pixman_implementation_t *imp,
 }
 #endif
 
-static const FastPathInfo sse2_fast_paths[] =
+static const pixman_fast_path_t sse2_fast_paths[] =
 {
     { PIXMAN_OP_OVER, PIXMAN_solid,    PIXMAN_a8,       PIXMAN_r5g6b5,   fbCompositeSolidMask_nx8x0565sse2,     0 },
     { PIXMAN_OP_OVER, PIXMAN_solid,    PIXMAN_a8,       PIXMAN_b5g6r5,   fbCompositeSolidMask_nx8x0565sse2,     0 },
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index c13bc3b..c09bff4 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -663,15 +663,15 @@ mask_is_solid (pixman_image_t *mask)
     return FALSE;
 }
 
-static const FastPathInfo *
-get_fast_path (const FastPathInfo *fast_paths,
+static const pixman_fast_path_t *
+get_fast_path (const pixman_fast_path_t *fast_paths,
 	       pixman_op_t         op,
 	       pixman_image_t     *pSrc,
 	       pixman_image_t     *pMask,
 	       pixman_image_t     *pDst,
 	       pixman_bool_t       is_pixbuf)
 {
-    const FastPathInfo *info;
+    const pixman_fast_path_t *info;
 
     for (info = fast_paths; info->op != PIXMAN_OP_NONE; info++)
     {
@@ -740,7 +740,7 @@ image_covers (pixman_image_t *image, pixman_box32_t *extents)
 }
 
 pixman_bool_t
-_pixman_run_fast_path (const FastPathInfo *paths,
+_pixman_run_fast_path (const pixman_fast_path_t *paths,
 		       pixman_implementation_t *imp,
 		       pixman_op_t op,
 		       pixman_image_t *src,
@@ -776,7 +776,7 @@ _pixman_run_fast_path (const FastPathInfo *paths,
 	&& !dest->common.read_func
 	&& !dest->common.write_func)
     {
-	const FastPathInfo *info;	
+	const pixman_fast_path_t *info;	
 	pixman_bool_t pixbuf;
 
 	pixbuf =
diff --git a/pixman/pixman-vmx.c b/pixman/pixman-vmx.c
index 96d5488..c57cb1e 100644
--- a/pixman/pixman-vmx.c
+++ b/pixman/pixman-vmx.c
@@ -1548,12 +1548,12 @@ fbCompositeSolid_nx0565vmx (pixman_operator_t	op,
     }
 }
 
-static const FastPathInfo vmx_fast_path_array[] =
+static const pixman_fast_path_t vmx_fast_path_array[] =
 {
     { PIXMAN_OP_NONE },
 };
 
-const FastPathInfo *const vmx_fast_paths = vmx_fast_path_array;
+const pixman_fast_path_t *const vmx_fast_paths = vmx_fast_path_array;
 
 #endif
 
commit afcfc8efc48630f0f349aefc8c86619fc7514647
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 10:09:22 2009 -0400

    Eliminate MSBFirst, LSBFirst, IMAGE_BYTE_ORDER, and BITMAP_BIT_ORDER.
    
    Just use WORDS_BIGENDIAN instead.

diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 269fad0..8a5a1f5 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -216,7 +216,7 @@ fbFetch_b8g8r8 (bits_image_t *pict, int x, int y, int width, uint32_t *buffer)
     const uint8_t *end = pixel + 3*width;
     while (pixel < end) {
 	uint32_t b = 0xff000000;
-#if IMAGE_BYTE_ORDER == MSBFirst
+#ifdef WORDS_BIGENDIAN
 	b |= (READ(pict, pixel++));
 	b |= (READ(pict, pixel++) << 8);
 	b |= (READ(pict, pixel++) << 16);
@@ -517,7 +517,7 @@ fbFetch_x4a4 (bits_image_t *pict, int x, int y, int width, uint32_t *buffer)
 }
 
 #define Fetch8(img,l,o)    (READ(img, (uint8_t *)(l) + ((o) >> 2)))
-#if IMAGE_BYTE_ORDER == MSBFirst
+#ifdef WORDS_BIGENDIAN
 #define Fetch4(img,l,o)    ((o) & 2 ? Fetch8(img,l,o) & 0xf : Fetch8(img,l,o) >> 4)
 #else
 #define Fetch4(img,l,o)    ((o) & 2 ? Fetch8(img,l,o) >> 4 : Fetch8(img,l,o) & 0xf)
@@ -624,7 +624,7 @@ fbFetch_a1 (bits_image_t *pict, int x, int y, int width, uint32_t *buffer)
     for (i = 0; i < width; ++i) {
 	uint32_t  p = READ(pict, bits + ((i + x) >> 5));
 	uint32_t  a;
-#if BITMAP_BIT_ORDER == MSBFirst
+#ifdef WORDS_BIGENDIAN
 	a = p >> (0x1f - ((i+x) & 0x1f));
 #else
 	a = p >> ((i+x) & 0x1f);
@@ -646,7 +646,7 @@ fbFetch_g1 (bits_image_t *pict, int x, int y, int width, uint32_t *buffer)
     for (i = 0; i < width; ++i) {
 	uint32_t p = READ(pict, bits + ((i+x) >> 5));
 	uint32_t a;
-#if BITMAP_BIT_ORDER == MSBFirst
+#ifdef WORDS_BIGENDIAN
 	a = p >> (0x1f - ((i+x) & 0x1f));
 #else
 	a = p >> ((i+x) & 0x1f);
@@ -1037,7 +1037,7 @@ fbFetchPixel_r8g8b8 (bits_image_t *pict, uint32_t *buffer, int n_pixels)
 	{
 	    uint32_t *bits = pict->bits + line*pict->rowstride;
 	    uint8_t   *pixel = ((uint8_t *) bits) + (offset*3);
-#if IMAGE_BYTE_ORDER == MSBFirst
+#ifdef WORDS_BIGENDIAN
 	    buffer[i] = (0xff000000 |
 			 (READ(pict, pixel + 0) << 16) |
 			 (READ(pict, pixel + 1) << 8) |
@@ -1070,7 +1070,7 @@ fbFetchPixel_b8g8r8 (bits_image_t *pict, uint32_t *buffer, int n_pixels)
 	{
 	    uint32_t *bits = pict->bits + line*pict->rowstride;
 	    uint8_t   *pixel = ((uint8_t *) bits) + (offset*3);
-#if IMAGE_BYTE_ORDER == MSBFirst
+#ifdef WORDS_BIGENDIAN
 	    buffer[i] = (0xff000000 |
 			 (READ(pict, pixel + 2) << 16) |
 			 (READ(pict, pixel + 1) << 8) |
@@ -1747,7 +1747,7 @@ fbFetchPixel_a1 (bits_image_t *pict, uint32_t *buffer, int n_pixels)
 	    uint32_t *bits = pict->bits + line*pict->rowstride;
 	    uint32_t  pixel = READ(pict, bits + (offset >> 5));
 	    uint32_t  a;
-#if BITMAP_BIT_ORDER == MSBFirst
+#ifdef WORDS_BIGENDIAN
 	    a = pixel >> (0x1f - (offset & 0x1f));
 #else
 	    a = pixel >> (offset & 0x1f);
@@ -1781,7 +1781,7 @@ fbFetchPixel_g1 (bits_image_t *pict, uint32_t *buffer, int n_pixels)
 	    uint32_t pixel = READ(pict, bits + (offset >> 5));
 	    const pixman_indexed_t * indexed = pict->indexed;
 	    uint32_t a;
-#if BITMAP_BIT_ORDER == MSBFirst
+#ifdef WORDS_BIGENDIAN
 	    a = pixel >> (0x1f - (offset & 0x1f));
 #else
 	    a = pixel >> (offset & 0x1f);
@@ -2090,7 +2090,7 @@ fbStore_b8g8r8 (pixman_image_t *image,
     uint8_t *pixel = ((uint8_t *) bits) + 3*x;
     for (i = 0; i < width; ++i) {
 	uint32_t val = values[i];
-#if IMAGE_BYTE_ORDER == MSBFirst
+#ifdef WORDS_BIGENDIAN
 	WRITE(image, pixel++, Blue(val));
 	WRITE(image, pixel++, Green(val));
 	WRITE(image, pixel++, Red(val));
@@ -2325,7 +2325,7 @@ fbStore_x4a4 (pixman_image_t *image,
 }
 
 #define Store8(img,l,o,v)  (WRITE(img, (uint8_t *)(l) + ((o) >> 3), (v)))
-#if IMAGE_BYTE_ORDER == MSBFirst
+#ifdef WORDS_BIGENDIAN
 #define Store4(img,l,o,v)  Store8(img,l,o,((o) & 4 ?				\
 				   (Fetch8(img,l,o) & 0xf0) | (v) :		\
 				   (Fetch8(img,l,o) & 0x0f) | ((v) << 4)))
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index a23ed9c..66fab9d 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -17,17 +17,6 @@
 #define TRUE 1
 #endif
 
-#define MSBFirst 0
-#define LSBFirst 1
-
-#ifdef WORDS_BIGENDIAN
-#  define IMAGE_BYTE_ORDER MSBFirst
-#  define BITMAP_BIT_ORDER MSBFirst
-#else
-#  define IMAGE_BYTE_ORDER LSBFirst
-#  define BITMAP_BIT_ORDER LSBFirst
-#endif
-
 #undef DEBUG
 #define DEBUG 0
 
@@ -437,14 +426,14 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 #define FB_STIP_MASK	(FB_STIP_UNIT - 1)
 #define FB_STIP_ALLONES	((uint32_t) -1)
 
-#if BITMAP_BIT_ORDER == LSBFirst
-#define FbScrLeft(x,n)	((x) >> (n))
-#define FbScrRight(x,n)	((x) << (n))
-#define FbLeftStipBits(x,n) ((x) & ((((uint32_t) 1) << (n)) - 1))
-#else
+#ifdef WORDS_BIGENDIAN
 #define FbScrLeft(x,n)	((x) << (n))
 #define FbScrRight(x,n)	((x) >> (n))
 #define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n)))
+#else
+#define FbScrLeft(x,n)	((x) >> (n))
+#define FbScrRight(x,n)	((x) << (n))
+#define FbLeftStipBits(x,n) ((x) & ((((uint32_t) 1) << (n)) - 1))
 #endif
 
 #define FbStipLeft(x,n)	FbScrLeft(x,n)
@@ -472,7 +461,7 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 	n >>= FB_SHIFT; \
     }
 
-#if IMAGE_BYTE_ORDER == MSBFirst
+#ifdef WORDS_BIGENDIAN
 #define Fetch24(img, a)  ((unsigned long) (a) & 1 ?	      \
     ((READ(img, a) << 16) | READ(img, (uint16_t *) ((a)+1))) : \
     ((READ(img, (uint16_t *) (a)) << 8) | READ(img, (a)+2)))
commit fd83e3594b440ade9acc1263dcd2a0980aa7ebcc
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 09:50:24 2009 -0400

    Rename combine.inc and combine.h.inc to pixman-combine.{c,h}.template.

diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index 46bfcf8..1f6afb4 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -38,18 +38,18 @@ libpixmanincludedir = $(includedir)/pixman-1/
 libpixmaninclude_HEADERS = pixman.h pixman-version.h
 noinst_LTLIBRARIES = 
 
-pixman-combine32.c : combine.inc pixman-combine32.h combine.pl
-	$(PERL) $(srcdir)/combine.pl 8 < $(srcdir)/combine.inc > $@ || ($(RM) $@; exit 1)
-pixman-combine32.h : combine.h.inc combine.pl
-	$(PERL) $(srcdir)/combine.pl 8 < $(srcdir)/combine.h.inc > $@ || ($(RM) $@; exit 1)
+pixman-combine32.c : pixman-combine.c.template pixman-combine32.h make-combine.pl
+	$(PERL) $(srcdir)/make-combine.pl 8 < $(srcdir)/pixman-combine.c.template > $@ || ($(RM) $@; exit 1)
+pixman-combine32.h : pixman-combine.h.template make-combine.pl
+	$(PERL) $(srcdir)/make-combine.pl 8 < $(srcdir)/pixman-combine.h.template > $@ || ($(RM) $@; exit 1)
 
-pixman-combine64.c : combine.inc pixman-combine64.h combine.pl
-	$(PERL) $(srcdir)/combine.pl 16 < $(srcdir)/combine.inc > $@ || ($(RM) $@; exit 1)
-pixman-combine64.h : combine.h.inc combine.pl
-	$(PERL) $(srcdir)/combine.pl 16 < $(srcdir)/combine.h.inc > $@ || ($(RM) $@; exit 1)
+pixman-combine64.c : pixman-combine.c.template pixman-combine64.h make-combine.pl
+	$(PERL) $(srcdir)/make-combine.pl 16 < $(srcdir)/pixman-combine.c.template > $@ || ($(RM) $@; exit 1)
+pixman-combine64.h : pixman-combine.h.template make-combine.pl
+	$(PERL) $(srcdir)/make-combine.pl 16 < $(srcdir)/pixman-combine.h.template > $@ || ($(RM) $@; exit 1)
 
-EXTRA_DIST = Makefile.win32 combine.inc combine.pl pixman-region.c \
-	combine.h.inc solaris-hwcap.mapfile
+EXTRA_DIST = Makefile.win32 pixman-combine.c.template make-combine.pl pixman-region.c \
+	pixman-combine.h.template solaris-hwcap.mapfile
 CLEANFILES = pixman-combine32.c pixman-combine64.c pixman-combine32.h pixman-combine64.h
 
 # mmx code
diff --git a/pixman/combine.h.inc b/pixman/combine.h.inc
deleted file mode 100644
index 6ecd301..0000000
--- a/pixman/combine.h.inc
+++ /dev/null
@@ -1,213 +0,0 @@
-
-#define COMPONENT_SIZE
-#define MASK
-#define ONE_HALF
-
-#define A_SHIFT
-#define R_SHIFT
-#define G_SHIFT
-#define A_MASK
-#define R_MASK
-#define G_MASK
-
-#define RB_MASK
-#define AG_MASK
-#define RB_ONE_HALF
-#define RB_MASK_PLUS_ONE
-
-#define Alpha(x) ((x) >> A_SHIFT)
-
-/*
- * Helper macros.
- */
-
-#define IntMult(a,b,t) ( (t) = (a) * (b) + ONE_HALF, ( ( ( (t)>>G_SHIFT ) + (t) )>>G_SHIFT ) )
-#define IntDiv(a,b)    (((comp2_t) (a) * MASK) / (b))
-
-#define GetComp(v,i)   ((comp2_t) (comp1_t) ((v) >> i))
-
-#define Add(x,y,i,t)   ((t) = GetComp(x,i) + GetComp(y,i),              \
-                        (comp4_t) ((comp1_t) ((t) | (0 - ((t) >> G_SHIFT)))) << (i))
-
-#define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (IntMult(GetComp(y,i),ay,(u)) + \
-					 IntMult(GetComp(x,i),ax,(v))), \
-				  (comp4_t) ((comp1_t) ((t) |		\
-							 (0 - ((t) >> G_SHIFT)))) << (i))
-
-/*
-  The methods below use some tricks to be able to do two color
-  components at the same time.
-*/
-
-/*
-  x_c = (x_c * a) / 255
-*/
-#define FbByteMul(x, a) do {                                            \
-        comp4_t t = ((x & RB_MASK) * a) + RB_ONE_HALF;                  \
-        t = (t + ((t >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE;  \
-        t &= RB_MASK;                                                   \
-                                                                        \
-        x = (((x >> COMPONENT_SIZE) & RB_MASK) * a) + RB_ONE_HALF;      \
-        x = (x + ((x >> COMPONENT_SIZE) & RB_MASK));                    \
-        x &= RB_MASK << COMPONENT_SIZE;                                 \
-        x += t;                                                         \
-    } while (0)
-
-/*
-  x_c = (x_c * a) / 255 + y
-*/
-#define FbByteMulAdd(x, a, y) do {                                      \
-        /* multiply and divide: trunc((i + 128)*257/65536) */           \
-        comp4_t t = ((x & RB_MASK) * a) + RB_ONE_HALF;                  \
-        t = (t + ((t >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE;  \
-        t &= RB_MASK;                                                   \
-                                                                        \
-        /* add */                                                       \
-        t += y & RB_MASK;                                               \
-                                                                        \
-        /* saturate */                                                  \
-        t |= RB_MASK_PLUS_ONE - ((t >> COMPONENT_SIZE) & RB_MASK);      \
-        t &= RB_MASK;                                                   \
-                                                                        \
-        /* multiply and divide */                                       \
-        x = (((x >> COMPONENT_SIZE) & RB_MASK) * a) + RB_ONE_HALF;      \
-        x = (x + ((x >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE;  \
-        x &= RB_MASK;                                                   \
-                                                                        \
-        /* add */                                                       \
-        x += (y >> COMPONENT_SIZE) & RB_MASK;                           \
-                                                                        \
-        /* saturate */                                                  \
-        x |= RB_MASK_PLUS_ONE - ((x >> COMPONENT_SIZE) & RB_MASK);      \
-        x &= RB_MASK;                                                   \
-                                                                        \
-        /* recombine */                                                 \
-        x <<= COMPONENT_SIZE;                                           \
-        x += t;                                                         \
-    } while (0)
-
-/*
-  x_c = (x_c * a + y_c * b) / 255
-*/
-#define FbByteAddMul(x, a, y, b) do {                                   \
-        comp4_t t;                                                      \
-        comp4_t r = (x >> A_SHIFT) * a + (y >> A_SHIFT) * b + ONE_HALF; \
-        r += (r >> G_SHIFT);                                            \
-        r >>= G_SHIFT;                                                  \
-                                                                        \
-        t = (x & G_MASK) * a + (y & G_MASK) * b;                        \
-        t += (t >> G_SHIFT) + (ONE_HALF << G_SHIFT);                    \
-        t >>= R_SHIFT;                                                  \
-                                                                        \
-        t |= r << R_SHIFT;                                              \
-        t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK);             \
-        t &= RB_MASK;                                                   \
-        t <<= G_SHIFT;                                                  \
-                                                                        \
-        r = ((x >> R_SHIFT) & MASK) * a +                               \
-            ((y >> R_SHIFT) & MASK) * b + ONE_HALF;                     \
-        r += (r >> G_SHIFT);                                            \
-        r >>= G_SHIFT;                                                  \
-                                                                        \
-        x = (x & MASK) * a + (y & MASK) * b + ONE_HALF;                 \
-        x += (x >> G_SHIFT);                                            \
-        x >>= G_SHIFT;                                                  \
-        x |= r << R_SHIFT;                                              \
-        x |= RB_MASK_PLUS_ONE - ((x >> G_SHIFT) & RB_MASK);             \
-        x &= RB_MASK;                                                   \
-        x |= t;                                                         \
-    } while (0)
-
-/*
-  x_c = (x_c * a_c) / 255
-*/
-#define FbByteMulC(x, a) do {                                           \
-        comp4_t t;                                                      \
-        comp4_t r = (x & MASK) * (a & MASK);                            \
-        r |= (x & R_MASK) * ((a >> R_SHIFT) & MASK);                    \
-        r += RB_ONE_HALF;                                               \
-        r = (r + ((r >> G_SHIFT) & RB_MASK)) >> G_SHIFT;                \
-        r &= RB_MASK;                                                   \
-                                                                        \
-        x >>= G_SHIFT;                                                  \
-        t = (x & MASK) * ((a >> G_SHIFT) & MASK);                       \
-        t |= (x & R_MASK) * (a >> A_SHIFT);                             \
-        t += RB_ONE_HALF;                                               \
-        t = t + ((t >> G_SHIFT) & RB_MASK);                             \
-        x = r | (t & AG_MASK);                                          \
-    } while (0)
-
-/*
-  x_c = (x_c * a) / 255 + y
-*/
-#define FbByteMulAddC(x, a, y) do {                                     \
-        comp4_t t;                                                      \
-        comp4_t r = (x & MASK) * (a & MASK);                            \
-        r |= (x & R_MASK) * ((a >> R_SHIFT) & MASK);                    \
-        r += RB_ONE_HALF;                                               \
-        r = (r + ((r >> G_SHIFT) & RB_MASK)) >> G_SHIFT;                \
-        r &= RB_MASK;                                                   \
-        r += y & RB_MASK;                                               \
-        r |= RB_MASK_PLUS_ONE - ((r >> G_SHIFT) & RB_MASK);             \
-        r &= RB_MASK;                                                   \
-                                                                        \
-        x >>= G_SHIFT;                                                  \
-        t = (x & MASK) * ((a >> G_SHIFT) & MASK);                       \
-        t |= (x & R_MASK) * (a >> A_SHIFT);                             \
-        t += RB_ONE_HALF;                                               \
-        t = (t + ((t >> G_SHIFT) & RB_MASK)) >> G_SHIFT;                \
-        t &= RB_MASK;                                                   \
-        t += (y >> G_SHIFT) & RB_MASK;                                  \
-        t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK);             \
-        t &= RB_MASK;                                                   \
-        x = r | (t << G_SHIFT);                                         \
-    } while (0)
-
-/*
-  x_c = (x_c * a_c + y_c * b) / 255
-*/
-#define FbByteAddMulC(x, a, y, b) do {                                  \
-        comp4_t t;                                                      \
-        comp4_t r = (x >> A_SHIFT) * (a >> A_SHIFT) +                   \
-                     (y >> A_SHIFT) * b;                                \
-        r += (r >> G_SHIFT) + ONE_HALF;                                 \
-        r >>= G_SHIFT;                                                  \
-                                                                        \
-        t = (x & G_MASK) * ((a >> G_SHIFT) & MASK) + (y & G_MASK) * b;  \
-        t += (t >> G_SHIFT) + (ONE_HALF << G_SHIFT);                    \
-        t >>= R_SHIFT;                                                  \
-                                                                        \
-        t |= r << R_SHIFT;                                              \
-        t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK);             \
-        t &= RB_MASK;                                                   \
-        t <<= G_SHIFT;                                                  \
-                                                                        \
-        r = ((x >> R_SHIFT) & MASK) * ((a >> R_SHIFT) & MASK) +         \
-            ((y >> R_SHIFT) & MASK) * b + ONE_HALF;                     \
-        r += (r >> G_SHIFT);                                            \
-        r >>= G_SHIFT;                                                  \
-                                                                        \
-        x = (x & MASK) * (a & MASK) + (y & MASK) * b + ONE_HALF;        \
-        x += (x >> G_SHIFT);                                            \
-        x >>= G_SHIFT;                                                  \
-        x |= r << R_SHIFT;                                              \
-        x |= RB_MASK_PLUS_ONE - ((x >> G_SHIFT) & RB_MASK);             \
-        x &= RB_MASK;                                                   \
-        x |= t;                                                         \
-    } while (0)
-
-/*
-  x_c = min(x_c + y_c, 255)
-*/
-#define FbByteAdd(x, y) do {                                            \
-        comp4_t t;                                                      \
-        comp4_t r = (x & RB_MASK) + (y & RB_MASK);                      \
-        r |= RB_MASK_PLUS_ONE - ((r >> G_SHIFT) & RB_MASK);             \
-        r &= RB_MASK;                                                   \
-                                                                        \
-        t = ((x >> G_SHIFT) & RB_MASK) + ((y >> G_SHIFT) & RB_MASK);    \
-        t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK);             \
-        r |= (t & RB_MASK) << G_SHIFT;                                  \
-        x = r;                                                          \
-    } while (0)
-
diff --git a/pixman/combine.inc b/pixman/combine.inc
deleted file mode 100644
index 2f4d6a7..0000000
--- a/pixman/combine.inc
+++ /dev/null
@@ -1,1339 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include "pixman-private.h"
-
-#include "pixman-combine.h"
-
-/*
- * There are two ways of handling alpha -- either as a single unified value or
- * a separate value for each component, hence each macro must have two
- * versions.  The unified alpha version has a 'U' at the end of the name,
- * the component version has a 'C'.  Similarly, functions which deal with
- * this difference will have two versions using the same convention.
- */
-
-
-/*
- * All of the composing functions
- */
-
-static force_inline comp4_t
-combineMask (const comp4_t *src, const comp4_t *mask, int i)
-{
-    comp4_t s, m;
-
-    if (mask)
-    {
-	m = *(mask + i) >> A_SHIFT;
-
-	if (!m)
-	    return 0;
-    }
-
-    s = *(src + i);
-
-    if (mask)
-	FbByteMul (s, m);
-
-    return s;
-}
-
-static void
-fbCombineClear (pixman_implementation_t *imp, pixman_op_t op,
-		comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    memset(dest, 0, width*sizeof(comp4_t));
-}
-
-static void
-fbCombineSrcU (pixman_implementation_t *imp, pixman_op_t op,
-	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-
-    if (!mask)
-	memcpy (dest, src, width * sizeof (comp4_t));
-    else
-    {
-	for (i = 0; i < width; ++i)
-	{
-	    comp4_t s = combineMask (src, mask, i);
-	    
-	    *(dest + i) = s;
-	}
-    }
-}
-
-/* if the Src is opaque, call fbCombineSrcU */
-static void
-fbCombineOverU (pixman_implementation_t *imp, pixman_op_t op,
-		comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-        comp4_t s = combineMask (src, mask, i);
-        comp4_t d = *(dest + i);
-        comp4_t ia = Alpha(~s);
-
-        FbByteMulAdd(d, ia, s);
-	*(dest + i) = d;
-    }
-}
-
-/* if the Dst is opaque, this is a noop */
-static void
-fbCombineOverReverseU (pixman_implementation_t *imp, pixman_op_t op,
-		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-        comp4_t s = combineMask (src, mask, i);
-        comp4_t d = *(dest + i);
-        comp4_t ia = Alpha(~*(dest + i));
-        FbByteMulAdd(s, ia, d);
-	*(dest + i) = s;
-    }
-}
-
-/* if the Dst is opaque, call fbCombineSrcU */
-static void
-fbCombineInU (pixman_implementation_t *imp, pixman_op_t op,
-	      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-        comp4_t s = combineMask (src, mask, i);
-        comp4_t a = Alpha(*(dest + i));
-        FbByteMul(s, a);
-	*(dest + i) = s;
-    }
-}
-
-/* if the Src is opaque, this is a noop */
-static void
-fbCombineInReverseU (pixman_implementation_t *imp, pixman_op_t op,
-		     comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-	comp4_t s = combineMask (src, mask, i);
-	comp4_t d = *(dest + i);
-        comp4_t a = Alpha(s);
-        FbByteMul(d, a);
-	*(dest + i) = d;
-    }
-}
-
-/* if the Dst is opaque, call fbCombineClear */
-static void
-fbCombineOutU (pixman_implementation_t *imp, pixman_op_t op,
-	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-        comp4_t s = combineMask (src, mask, i);
-        comp4_t a = Alpha(~*(dest + i));
-        FbByteMul(s, a);
-	*(dest + i) = s;
-    }
-}
-
-/* if the Src is opaque, call fbCombineClear */
-static void
-fbCombineOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
-		      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-	comp4_t s = combineMask (src, mask, i);
-        comp4_t d = *(dest + i);
-        comp4_t a = Alpha(~s);
-        FbByteMul(d, a);
-	*(dest + i) = d;
-    }
-}
-
-/* if the Src is opaque, call fbCombineInU */
-/* if the Dst is opaque, call fbCombineOverU */
-/* if both the Src and Dst are opaque, call fbCombineSrcU */
-static void
-fbCombineAtopU (pixman_implementation_t *imp, pixman_op_t op,
-		comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-        comp4_t s = combineMask (src, mask, i);
-        comp4_t d = *(dest + i);
-        comp4_t dest_a = Alpha(d);
-        comp4_t src_ia = Alpha(~s);
-
-        FbByteAddMul(s, dest_a, d, src_ia);
-	*(dest + i) = s;
-    }
-}
-
-/* if the Src is opaque, call fbCombineOverReverseU */
-/* if the Dst is opaque, call fbCombineInReverseU */
-/* if both the Src and Dst are opaque, call fbCombineDstU */
-static void
-fbCombineAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
-		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-        comp4_t s = combineMask (src, mask, i);
-        comp4_t d = *(dest + i);
-        comp4_t src_a = Alpha(s);
-        comp4_t dest_ia = Alpha(~d);
-
-        FbByteAddMul(s, dest_ia, d, src_a);
-	*(dest + i) = s;
-    }
-}
-
-/* if the Src is opaque, call fbCombineOverU */
-/* if the Dst is opaque, call fbCombineOverReverseU */
-/* if both the Src and Dst are opaque, call fbCombineClear */
-static void
-fbCombineXorU (pixman_implementation_t *imp, pixman_op_t op,
-	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-        comp4_t s = combineMask (src, mask, i);
-        comp4_t d = *(dest + i);
-        comp4_t src_ia = Alpha(~s);
-        comp4_t dest_ia = Alpha(~d);
-
-        FbByteAddMul(s, dest_ia, d, src_ia);
-	*(dest + i) = s;
-    }
-}
-
-static void
-fbCombineAddU (pixman_implementation_t *imp, pixman_op_t op,
-	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-        comp4_t s = combineMask (src, mask, i);
-        comp4_t d = *(dest + i);
-        FbByteAdd(d, s);
-	*(dest + i) = d;
-    }
-}
-
-/* if the Src is opaque, call fbCombineAddU */
-/* if the Dst is opaque, call fbCombineAddU */
-/* if both the Src and Dst are opaque, call fbCombineAddU */
-static void
-fbCombineSaturateU (pixman_implementation_t *imp, pixman_op_t op,
-		    comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-        comp4_t s = combineMask (src, mask, i);
-        comp4_t d = *(dest + i);
-        comp2_t sa, da;
-
-        sa = s >> A_SHIFT;
-        da = ~d >> A_SHIFT;
-        if (sa > da)
-        {
-            sa = IntDiv(da, sa);
-            FbByteMul(s, sa);
-        };
-        FbByteAdd(d, s);
-	*(dest + i) = d;
-    }
-}
-
-
-/*
- * All of the disjoint composing functions
-
- The four entries in the first column indicate what source contributions
- come from each of the four areas of the picture -- areas covered by neither
- A nor B, areas covered only by A, areas covered only by B and finally
- areas covered by both A and B.
-
- Disjoint			Conjoint
- Fa		Fb		Fa		Fb
- (0,0,0,0)	0		0		0		0
- (0,A,0,A)	1		0		1		0
- (0,0,B,B)	0		1		0		1
- (0,A,B,A)	1		min((1-a)/b,1)	1		max(1-a/b,0)
- (0,A,B,B)	min((1-b)/a,1)	1		max(1-b/a,0)	1
- (0,0,0,A)	max(1-(1-b)/a,0) 0		min(1,b/a)	0
- (0,0,0,B)	0		max(1-(1-a)/b,0) 0		min(a/b,1)
- (0,A,0,0)	min(1,(1-b)/a)	0		max(1-b/a,0)	0
- (0,0,B,0)	0		min(1,(1-a)/b)	0		max(1-a/b,0)
- (0,0,B,A)	max(1-(1-b)/a,0) min(1,(1-a)/b)	 min(1,b/a)	max(1-a/b,0)
- (0,A,0,B)	min(1,(1-b)/a)	max(1-(1-a)/b,0) max(1-b/a,0)	min(1,a/b)
- (0,A,B,0)	min(1,(1-b)/a)	min(1,(1-a)/b)	max(1-b/a,0)	max(1-a/b,0)
-
-*/
-
-#define CombineAOut 1
-#define CombineAIn  2
-#define CombineBOut 4
-#define CombineBIn  8
-
-#define CombineClear	0
-#define CombineA	(CombineAOut|CombineAIn)
-#define CombineB	(CombineBOut|CombineBIn)
-#define CombineAOver	(CombineAOut|CombineBOut|CombineAIn)
-#define CombineBOver	(CombineAOut|CombineBOut|CombineBIn)
-#define CombineAAtop	(CombineBOut|CombineAIn)
-#define CombineBAtop	(CombineAOut|CombineBIn)
-#define CombineXor	(CombineAOut|CombineBOut)
-
-/* portion covered by a but not b */
-static comp1_t
-fbCombineDisjointOutPart (comp1_t a, comp1_t b)
-{
-    /* min (1, (1-b) / a) */
-
-    b = ~b;		    /* 1 - b */
-    if (b >= a)		    /* 1 - b >= a -> (1-b)/a >= 1 */
-	return MASK;	    /* 1 */
-    return IntDiv(b,a);     /* (1-b) / a */
-}
-
-/* portion covered by both a and b */
-static comp1_t
-fbCombineDisjointInPart (comp1_t a, comp1_t b)
-{
-    /* max (1-(1-b)/a,0) */
-    /*  = - min ((1-b)/a - 1, 0) */
-    /*  = 1 - min (1, (1-b)/a) */
-
-    b = ~b;		    /* 1 - b */
-    if (b >= a)		    /* 1 - b >= a -> (1-b)/a >= 1 */
-	return 0;	    /* 1 - 1 */
-    return ~IntDiv(b,a);    /* 1 - (1-b) / a */
-}
-
-/* portion covered by a but not b */
-static comp1_t
-fbCombineConjointOutPart (comp1_t a, comp1_t b)
-{
-    /* max (1-b/a,0) */
-    /* = 1-min(b/a,1) */
-
-    /* min (1, (1-b) / a) */
-
-    if (b >= a)		    /* b >= a -> b/a >= 1 */
-	return 0x00;	    /* 0 */
-    return ~IntDiv(b,a);    /* 1 - b/a */
-}
-
-/* portion covered by both a and b */
-static comp1_t
-fbCombineConjointInPart (comp1_t a, comp1_t b)
-{
-    /* min (1,b/a) */
-
-    if (b >= a)		    /* b >= a -> b/a >= 1 */
-	return MASK;	    /* 1 */
-    return IntDiv(b,a);     /* b/a */
-}
-
-static void
-fbCombineDisjointGeneralU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-        comp4_t s = combineMask (src, mask, i);
-        comp4_t d = *(dest + i);
-        comp4_t m,n,o,p;
-        comp2_t Fa, Fb, t, u, v;
-        comp1_t sa = s >> A_SHIFT;
-        comp1_t da = d >> A_SHIFT;
-
-        switch (combine & CombineA) {
-        default:
-            Fa = 0;
-            break;
-        case CombineAOut:
-            Fa = fbCombineDisjointOutPart (sa, da);
-            break;
-        case CombineAIn:
-            Fa = fbCombineDisjointInPart (sa, da);
-            break;
-        case CombineA:
-            Fa = MASK;
-            break;
-        }
-
-        switch (combine & CombineB) {
-        default:
-            Fb = 0;
-            break;
-        case CombineBOut:
-            Fb = fbCombineDisjointOutPart (da, sa);
-            break;
-        case CombineBIn:
-            Fb = fbCombineDisjointInPart (da, sa);
-            break;
-        case CombineB:
-            Fb = MASK;
-            break;
-        }
-        m = FbGen (s,d,0,Fa,Fb,t, u, v);
-        n = FbGen (s,d,G_SHIFT,Fa,Fb,t, u, v);
-        o = FbGen (s,d,R_SHIFT,Fa,Fb,t, u, v);
-        p = FbGen (s,d,A_SHIFT,Fa,Fb,t, u, v);
-        s = m|n|o|p;
-	*(dest + i) = s;
-    }
-}
-
-static void
-fbCombineDisjointOverU (pixman_implementation_t *imp, pixman_op_t op,
-			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-        comp4_t s = combineMask (src, mask, i);
-        comp2_t a = s >> A_SHIFT;
-
-        if (a != 0x00)
-        {
-            if (a != MASK)
-            {
-                comp4_t d = *(dest + i);
-                a = fbCombineDisjointOutPart (d >> A_SHIFT, a);
-                FbByteMulAdd(d, a, s);
-                s = d;
-            }
-	    *(dest + i) = s;
-        }
-    }
-}
-
-static void
-fbCombineDisjointInU (pixman_implementation_t *imp, pixman_op_t op,
-		      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralU (dest, src, mask, width, CombineAIn);
-}
-
-static void
-fbCombineDisjointInReverseU (pixman_implementation_t *imp, pixman_op_t op,
-			     comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralU (dest, src, mask, width, CombineBIn);
-}
-
-static void
-fbCombineDisjointOutU (pixman_implementation_t *imp, pixman_op_t op,
-		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralU (dest, src, mask, width, CombineAOut);
-}
-
-static void
-fbCombineDisjointOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
-			      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralU (dest, src, mask, width, CombineBOut);
-}
-
-static void
-fbCombineDisjointAtopU (pixman_implementation_t *imp, pixman_op_t op,
-			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralU (dest, src, mask, width, CombineAAtop);
-}
-
-static void
-fbCombineDisjointAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
-			       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralU (dest, src, mask, width, CombineBAtop);
-}
-
-static void
-fbCombineDisjointXorU (pixman_implementation_t *imp, pixman_op_t op,
-		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralU (dest, src, mask, width, CombineXor);
-}
-
-static void
-fbCombineConjointGeneralU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine)
-{
-    int i;
-    for (i = 0; i < width; ++i) {
-        comp4_t s = combineMask (src, mask, i);
-        comp4_t d = *(dest + i);
-        comp4_t m,n,o,p;
-        comp2_t Fa, Fb, t, u, v;
-        comp1_t sa = s >> A_SHIFT;
-        comp1_t da = d >> A_SHIFT;
-
-        switch (combine & CombineA) {
-        default:
-            Fa = 0;
-            break;
-        case CombineAOut:
-            Fa = fbCombineConjointOutPart (sa, da);
-            break;
-        case CombineAIn:
-            Fa = fbCombineConjointInPart (sa, da);
-            break;
-        case CombineA:
-            Fa = MASK;
-            break;
-        }
-
-        switch (combine & CombineB) {
-        default:
-            Fb = 0;
-            break;
-        case CombineBOut:
-            Fb = fbCombineConjointOutPart (da, sa);
-            break;
-        case CombineBIn:
-            Fb = fbCombineConjointInPart (da, sa);
-            break;
-        case CombineB:
-            Fb = MASK;
-            break;
-        }
-        m = FbGen (s,d,0,Fa,Fb,t, u, v);
-        n = FbGen (s,d,G_SHIFT,Fa,Fb,t, u, v);
-        o = FbGen (s,d,R_SHIFT,Fa,Fb,t, u, v);
-        p = FbGen (s,d,A_SHIFT,Fa,Fb,t, u, v);
-        s = m|n|o|p;
-	*(dest + i) = s;
-    }
-}
-
-static void
-fbCombineConjointOverU (pixman_implementation_t *imp, pixman_op_t op,
-			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralU (dest, src, mask, width, CombineAOver);
-}
-
-
-static void
-fbCombineConjointOverReverseU (pixman_implementation_t *imp, pixman_op_t op,
-			       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralU (dest, src, mask, width, CombineBOver);
-}
-
-
-static void
-fbCombineConjointInU (pixman_implementation_t *imp, pixman_op_t op,
-		      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralU (dest, src, mask, width, CombineAIn);
-}
-
-
-static void
-fbCombineConjointInReverseU (pixman_implementation_t *imp, pixman_op_t op,
-			     comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralU (dest, src, mask, width, CombineBIn);
-}
-
-static void
-fbCombineConjointOutU (pixman_implementation_t *imp, pixman_op_t op,
-		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralU (dest, src, mask, width, CombineAOut);
-}
-
-static void
-fbCombineConjointOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
-			      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralU (dest, src, mask, width, CombineBOut);
-}
-
-static void
-fbCombineConjointAtopU (pixman_implementation_t *imp, pixman_op_t op,
-			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralU (dest, src, mask, width, CombineAAtop);
-}
-
-static void
-fbCombineConjointAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
-			       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralU (dest, src, mask, width, CombineBAtop);
-}
-
-static void
-fbCombineConjointXorU (pixman_implementation_t *imp, pixman_op_t op,
-		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralU (dest, src, mask, width, CombineXor);
-}
-
-/********************************************************************************/
-/*************************** Per Channel functions ******************************/
-/********************************************************************************/
-
-static void
-fbCombineMaskC (comp4_t *src, comp4_t *mask)
-{
-    comp4_t a = *mask;
-
-    comp4_t	x;
-    comp2_t	xa;
-
-    if (!a)
-    {
-	*(src) = 0;
-	return;
-    }
-
-    x = *(src);
-    if (a == ~0)
-    {
-	x = x >> A_SHIFT;
-	x |= x << G_SHIFT;
-	x |= x << R_SHIFT;
-	*(mask) = x;
-	return;
-    }
-
-    xa = x >> A_SHIFT;
-    FbByteMulC(x, a);
-    *(src) = x;
-    FbByteMul(a, xa);
-    *(mask) = a;
-}
-
-static void
-fbCombineMaskValueC (comp4_t *src, const comp4_t *mask)
-{
-    comp4_t a = *mask;
-    comp4_t	x;
-
-    if (!a)
-    {
-	*(src) = 0;
-	return;
-    }
-
-    if (a == ~0)
-	return;
-
-    x = *(src);
-    FbByteMulC(x, a);
-    *(src) =x;
-}
-
-static void
-fbCombineMaskAlphaC (const comp4_t *src, comp4_t *mask)
-{
-    comp4_t a = *(mask);
-    comp4_t	x;
-
-    if (!a)
-	return;
-
-    x = *(src) >> A_SHIFT;
-    if (x == MASK)
-	return;
-    if (a == ~0)
-    {
-	x = x >> A_SHIFT;
-	x |= x << G_SHIFT;
-	x |= x << R_SHIFT;
-	*(mask) = x;
-	return;
-    }
-
-    FbByteMul(a, x);
-    *(mask) = a;
-}
-
-static void
-fbCombineClearC (pixman_implementation_t *imp, pixman_op_t op,
-		 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    memset(dest, 0, width*sizeof(comp4_t));
-}
-
-static void
-fbCombineSrcC (pixman_implementation_t *imp, pixman_op_t op,
-	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-	comp4_t s = *(src + i);
-	comp4_t m = *(mask + i);
-
-	fbCombineMaskValueC (&s, &m);
-
-	*(dest) = s;
-    }
-}
-
-static void
-fbCombineOverC (pixman_implementation_t *imp, pixman_op_t op,
-		comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-	comp4_t s = *(src + i);
-	comp4_t m = *(mask + i);
-	comp4_t a;
-
-	fbCombineMaskC (&s, &m);
-
-	a = ~m;
-        if (a != ~0)
-        {
-            if (a)
-            {
-                comp4_t d = *(dest + i);
-                FbByteMulAddC(d, a, s);
-                s = d;
-            }
-	    *(dest + i) = s;
-        }
-    }
-}
-
-static void
-fbCombineOverReverseC (pixman_implementation_t *imp, pixman_op_t op,
-		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-        comp4_t d = *(dest + i);
-        comp4_t a = ~d >> A_SHIFT;
-
-        if (a)
-        {
-            comp4_t s = *(src + i);
-	    comp4_t m = *(mask + i);
-
-	    fbCombineMaskValueC (&s, &m);
-
-            if (a != MASK)
-            {
-                FbByteMulAdd(s, a, d);
-            }
-	    *(dest + i) = s;
-        }
-    }
-}
-
-static void
-fbCombineInC (pixman_implementation_t *imp, pixman_op_t op,
-	      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-        comp4_t d = *(dest + i);
-        comp2_t a = d >> A_SHIFT;
-        comp4_t s = 0;
-        if (a)
-        {
-	    comp4_t m = *(mask + i);
-
-	    s = *(src + i);
-	    fbCombineMaskValueC (&s, &m);
-            if (a != MASK)
-            {
-                FbByteMul(s, a);
-            }
-        }
-	*(dest + i) = s;
-    }
-}
-
-static void
-fbCombineInReverseC (pixman_implementation_t *imp, pixman_op_t op,
-		     comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-        comp4_t s = *(src + i);
-        comp4_t m = *(mask + i);
-        comp4_t a;
-
-	fbCombineMaskAlphaC (&s, &m);
-
-	a = m;
-        if (a != ~0)
-        {
-            comp4_t d = 0;
-            if (a)
-            {
-                d = *(dest + i);
-                FbByteMulC(d, a);
-            }
-	    *(dest + i) = d;
-        }
-    }
-}
-
-static void
-fbCombineOutC (pixman_implementation_t *imp, pixman_op_t op,
-	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-        comp4_t d = *(dest + i);
-        comp2_t a = ~d >> A_SHIFT;
-        comp4_t s = 0;
-        if (a)
-        {
-	    comp4_t m = *(mask + i);
-
-	    s = *(src + i);
-	    fbCombineMaskValueC (&s, &m);
-
-            if (a != MASK)
-            {
-                FbByteMul(s, a);
-            }
-        }
-	*(dest + i) = s;
-    }
-}
-
-static void
-fbCombineOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
-		      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-	comp4_t s = *(src + i);
-	comp4_t m = *(mask + i);
-	comp4_t a;
-
-	fbCombineMaskAlphaC (&s, &m);
-
-        a = ~m;
-        if (a != ~0)
-        {
-            comp4_t d = 0;
-            if (a)
-            {
-                d = *(dest + i);
-                FbByteMulC(d, a);
-            }
-	    *(dest + i) = d;
-        }
-    }
-}
-
-static void
-fbCombineAtopC (pixman_implementation_t *imp, pixman_op_t op,
-		comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-        comp4_t d = *(dest + i);
-        comp4_t s = *(src + i);
-        comp4_t m = *(mask + i);
-        comp4_t ad;
-        comp2_t as = d >> A_SHIFT;
-
-	fbCombineMaskC (&s, &m);
-
-        ad = ~m;
-
-        FbByteAddMulC(d, ad, s, as);
-	*(dest + i) = d;
-    }
-}
-
-static void
-fbCombineAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
-		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-
-        comp4_t d = *(dest + i);
-        comp4_t s = *(src + i);
-        comp4_t m = *(mask + i);
-        comp4_t ad;
-        comp2_t as = ~d >> A_SHIFT;
-
-	fbCombineMaskC (&s, &m);
-
-	ad = m;
-
-        FbByteAddMulC(d, ad, s, as);
-	*(dest + i) = d;
-    }
-}
-
-static void
-fbCombineXorC (pixman_implementation_t *imp, pixman_op_t op,
-	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-        comp4_t d = *(dest + i);
-        comp4_t s = *(src + i);
-        comp4_t m = *(mask + i);
-        comp4_t ad;
-        comp2_t as = ~d >> A_SHIFT;
-
-	fbCombineMaskC (&s, &m);
-
-	ad = ~m;
-
-        FbByteAddMulC(d, ad, s, as);
-	*(dest + i) = d;
-    }
-}
-
-static void
-fbCombineAddC (pixman_implementation_t *imp, pixman_op_t op,
-	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-        comp4_t s = *(src + i);
-        comp4_t m = *(mask + i);
-        comp4_t d = *(dest + i);
-
-	fbCombineMaskValueC (&s, &m);
-
-        FbByteAdd(d, s);
-	*(dest + i) = d;
-    }
-}
-
-static void
-fbCombineSaturateC (pixman_implementation_t *imp, pixman_op_t op,
-		    comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-        comp4_t s, d;
-        comp2_t sa, sr, sg, sb, da;
-        comp2_t t, u, v;
-        comp4_t m,n,o,p;
-
-        d = *(dest + i);
-        s = *(src + i);
-	m = *(mask + i);
-
-	fbCombineMaskC (&s, &m);
-
-        sa = (m >> A_SHIFT);
-        sr = (m >> R_SHIFT) & MASK;
-        sg = (m >> G_SHIFT) & MASK;
-        sb =  m             & MASK;
-        da = ~d >> A_SHIFT;
-
-        if (sb <= da)
-            m = Add(s,d,0,t);
-        else
-            m = FbGen (s, d, 0, (da << G_SHIFT) / sb, MASK, t, u, v);
-
-        if (sg <= da)
-            n = Add(s,d,G_SHIFT,t);
-        else
-            n = FbGen (s, d, G_SHIFT, (da << G_SHIFT) / sg, MASK, t, u, v);
-
-        if (sr <= da)
-            o = Add(s,d,R_SHIFT,t);
-        else
-            o = FbGen (s, d, R_SHIFT, (da << G_SHIFT) / sr, MASK, t, u, v);
-
-        if (sa <= da)
-            p = Add(s,d,A_SHIFT,t);
-        else
-            p = FbGen (s, d, A_SHIFT, (da << G_SHIFT) / sa, MASK, t, u, v);
-
-	*(dest + i) = m|n|o|p;
-    }
-}
-
-static void
-fbCombineDisjointGeneralC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-        comp4_t s, d;
-        comp4_t m,n,o,p;
-        comp4_t Fa, Fb;
-        comp2_t t, u, v;
-        comp4_t sa;
-        comp1_t da;
-
-        s = *(src + i);
-        m = *(mask + i);
-        d = *(dest + i);
-        da = d >> A_SHIFT;
-
-	fbCombineMaskC (&s, &m);
-
-	sa = m;
-
-        switch (combine & CombineA) {
-        default:
-            Fa = 0;
-            break;
-        case CombineAOut:
-            m = (comp4_t)fbCombineDisjointOutPart ((comp1_t) (sa >> 0), da);
-            n = (comp4_t)fbCombineDisjointOutPart ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
-            o = (comp4_t)fbCombineDisjointOutPart ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
-            p = (comp4_t)fbCombineDisjointOutPart ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
-            Fa = m|n|o|p;
-            break;
-        case CombineAIn:
-            m = (comp4_t)fbCombineDisjointInPart ((comp1_t) (sa >> 0), da);
-            n = (comp4_t)fbCombineDisjointInPart ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
-            o = (comp4_t)fbCombineDisjointInPart ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
-            p = (comp4_t)fbCombineDisjointInPart ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
-            Fa = m|n|o|p;
-            break;
-        case CombineA:
-            Fa = ~0;
-            break;
-        }
-
-        switch (combine & CombineB) {
-        default:
-            Fb = 0;
-            break;
-        case CombineBOut:
-            m = (comp4_t)fbCombineDisjointOutPart (da, (comp1_t) (sa >> 0));
-            n = (comp4_t)fbCombineDisjointOutPart (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
-            o = (comp4_t)fbCombineDisjointOutPart (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
-            p = (comp4_t)fbCombineDisjointOutPart (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
-            Fb = m|n|o|p;
-            break;
-        case CombineBIn:
-            m = (comp4_t)fbCombineDisjointInPart (da, (comp1_t) (sa >> 0));
-            n = (comp4_t)fbCombineDisjointInPart (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
-            o = (comp4_t)fbCombineDisjointInPart (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
-            p = (comp4_t)fbCombineDisjointInPart (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
-            Fb = m|n|o|p;
-            break;
-        case CombineB:
-            Fb = ~0;
-            break;
-        }
-        m = FbGen (s,d,0,GetComp(Fa,0),GetComp(Fb,0),t, u, v);
-        n = FbGen (s,d,G_SHIFT,GetComp(Fa,G_SHIFT),GetComp(Fb,G_SHIFT),t, u, v);
-        o = FbGen (s,d,R_SHIFT,GetComp(Fa,R_SHIFT),GetComp(Fb,R_SHIFT),t, u, v);
-        p = FbGen (s,d,A_SHIFT,GetComp(Fa,A_SHIFT),GetComp(Fb,A_SHIFT),t, u, v);
-        s = m|n|o|p;
-	*(dest + i) = s;
-    }
-}
-
-static void
-fbCombineDisjointOverC (pixman_implementation_t *imp, pixman_op_t op,
-			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOver);
-}
-
-static void
-fbCombineDisjointInC (pixman_implementation_t *imp, pixman_op_t op,
-		      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralC (dest, src, mask, width, CombineAIn);
-}
-
-static void
-fbCombineDisjointInReverseC (pixman_implementation_t *imp, pixman_op_t op,
-			     comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralC (dest, src, mask, width, CombineBIn);
-}
-
-static void
-fbCombineDisjointOutC (pixman_implementation_t *imp, pixman_op_t op,
-		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOut);
-}
-
-static void
-fbCombineDisjointOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
-			      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralC (dest, src, mask, width, CombineBOut);
-}
-
-static void
-fbCombineDisjointAtopC (pixman_implementation_t *imp, pixman_op_t op,
-			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralC (dest, src, mask, width, CombineAAtop);
-}
-
-static void
-fbCombineDisjointAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
-			       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralC (dest, src, mask, width, CombineBAtop);
-}
-
-static void
-fbCombineDisjointXorC (pixman_implementation_t *imp, pixman_op_t op,
-		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineDisjointGeneralC (dest, src, mask, width, CombineXor);
-}
-
-static void
-fbCombineConjointGeneralC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine)
-{
-    int i;
-
-    for (i = 0; i < width; ++i) {
-        comp4_t s, d;
-        comp4_t m,n,o,p;
-        comp4_t Fa, Fb;
-        comp2_t t, u, v;
-        comp4_t sa;
-        comp1_t da;
-
-        s = *(src + i);
-        m = *(mask + i);
-        d = *(dest + i);
-        da = d >> A_SHIFT;
-
-	fbCombineMaskC (&s, &m);
-
-        sa = m;
-
-        switch (combine & CombineA) {
-        default:
-            Fa = 0;
-            break;
-        case CombineAOut:
-            m = (comp4_t)fbCombineConjointOutPart ((comp1_t) (sa >> 0), da);
-            n = (comp4_t)fbCombineConjointOutPart ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
-            o = (comp4_t)fbCombineConjointOutPart ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
-            p = (comp4_t)fbCombineConjointOutPart ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
-            Fa = m|n|o|p;
-            break;
-        case CombineAIn:
-            m = (comp4_t)fbCombineConjointInPart ((comp1_t) (sa >> 0), da);
-            n = (comp4_t)fbCombineConjointInPart ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
-            o = (comp4_t)fbCombineConjointInPart ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
-            p = (comp4_t)fbCombineConjointInPart ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
-            Fa = m|n|o|p;
-            break;
-        case CombineA:
-            Fa = ~0;
-            break;
-        }
-
-        switch (combine & CombineB) {
-        default:
-            Fb = 0;
-            break;
-        case CombineBOut:
-            m = (comp4_t)fbCombineConjointOutPart (da, (comp1_t) (sa >> 0));
-            n = (comp4_t)fbCombineConjointOutPart (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
-            o = (comp4_t)fbCombineConjointOutPart (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
-            p = (comp4_t)fbCombineConjointOutPart (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
-            Fb = m|n|o|p;
-            break;
-        case CombineBIn:
-            m = (comp4_t)fbCombineConjointInPart (da, (comp1_t) (sa >> 0));
-            n = (comp4_t)fbCombineConjointInPart (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
-            o = (comp4_t)fbCombineConjointInPart (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
-            p = (comp4_t)fbCombineConjointInPart (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
-            Fb = m|n|o|p;
-            break;
-        case CombineB:
-            Fb = ~0;
-            break;
-        }
-        m = FbGen (s,d,0,GetComp(Fa,0),GetComp(Fb,0),t, u, v);
-        n = FbGen (s,d,G_SHIFT,GetComp(Fa,G_SHIFT),GetComp(Fb,G_SHIFT),t, u, v);
-        o = FbGen (s,d,R_SHIFT,GetComp(Fa,R_SHIFT),GetComp(Fb,R_SHIFT),t, u, v);
-        p = FbGen (s,d,A_SHIFT,GetComp(Fa,A_SHIFT),GetComp(Fb,A_SHIFT),t, u, v);
-        s = m|n|o|p;
-	*(dest + i) = s;
-    }
-}
-
-static void
-fbCombineConjointOverC (pixman_implementation_t *imp, pixman_op_t op,
-			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralC (dest, src, mask, width, CombineAOver);
-}
-
-static void
-fbCombineConjointOverReverseC (pixman_implementation_t *imp, pixman_op_t op,
-			       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralC (dest, src, mask, width, CombineBOver);
-}
-
-static void
-fbCombineConjointInC (pixman_implementation_t *imp, pixman_op_t op,
-		      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralC (dest, src, mask, width, CombineAIn);
-}
-
-static void
-fbCombineConjointInReverseC (pixman_implementation_t *imp, pixman_op_t op,
-			     comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralC (dest, src, mask, width, CombineBIn);
-}
-
-static void
-fbCombineConjointOutC (pixman_implementation_t *imp, pixman_op_t op,
-		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralC (dest, src, mask, width, CombineAOut);
-}
-
-static void
-fbCombineConjointOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
-			      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralC (dest, src, mask, width, CombineBOut);
-}
-
-static void
-fbCombineConjointAtopC (pixman_implementation_t *imp, pixman_op_t op,
-			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralC (dest, src, mask, width, CombineAAtop);
-}
-
-static void
-fbCombineConjointAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
-			       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralC (dest, src, mask, width, CombineBAtop);
-}
-
-static void
-fbCombineConjointXorC (pixman_implementation_t *imp, pixman_op_t op,
-		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
-{
-    fbCombineConjointGeneralC (dest, src, mask, width, CombineXor);
-}
-
-void
-_pixman_setup_combiner_functions_width (pixman_implementation_t *imp)
-{
-    /* Unified alpha */
-    imp->combine_width[PIXMAN_OP_CLEAR] = fbCombineClear;
-    imp->combine_width[PIXMAN_OP_SRC] = fbCombineSrcU;
-    /* dest */
-    imp->combine_width[PIXMAN_OP_OVER] = fbCombineOverU;
-    imp->combine_width[PIXMAN_OP_OVER_REVERSE] = fbCombineOverReverseU;
-    imp->combine_width[PIXMAN_OP_IN] = fbCombineInU;
-    imp->combine_width[PIXMAN_OP_IN_REVERSE] = fbCombineInReverseU;
-    imp->combine_width[PIXMAN_OP_OUT] = fbCombineOutU;
-    imp->combine_width[PIXMAN_OP_OUT_REVERSE] = fbCombineOutReverseU;
-    imp->combine_width[PIXMAN_OP_ATOP] = fbCombineAtopU;
-    imp->combine_width[PIXMAN_OP_ATOP_REVERSE] = fbCombineAtopReverseU;
-    imp->combine_width[PIXMAN_OP_XOR] = fbCombineXorU;
-    imp->combine_width[PIXMAN_OP_ADD] = fbCombineAddU;
-    imp->combine_width[PIXMAN_OP_SATURATE] = fbCombineSaturateU;
-
-    /* Disjoint, unified */
-    imp->combine_width[PIXMAN_OP_DISJOINT_CLEAR] = fbCombineClear;
-    imp->combine_width[PIXMAN_OP_DISJOINT_SRC] = fbCombineSrcU;
-    /* dest */
-    imp->combine_width[PIXMAN_OP_DISJOINT_OVER] = fbCombineDisjointOverU;
-    imp->combine_width[PIXMAN_OP_DISJOINT_OVER_REVERSE] = fbCombineSaturateU;
-    imp->combine_width[PIXMAN_OP_DISJOINT_IN] = fbCombineDisjointInU;
-    imp->combine_width[PIXMAN_OP_DISJOINT_IN_REVERSE] = fbCombineDisjointInReverseU;
-    imp->combine_width[PIXMAN_OP_DISJOINT_OUT] = fbCombineDisjointOutU;
-    imp->combine_width[PIXMAN_OP_DISJOINT_OUT_REVERSE] = fbCombineDisjointOutReverseU;
-    imp->combine_width[PIXMAN_OP_DISJOINT_ATOP] = fbCombineDisjointAtopU;
-    imp->combine_width[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = fbCombineDisjointAtopReverseU;
-    imp->combine_width[PIXMAN_OP_DISJOINT_XOR] = fbCombineDisjointXorU;
-
-    /* Conjoint, unified */
-    imp->combine_width[PIXMAN_OP_CONJOINT_CLEAR] = fbCombineClear;
-    imp->combine_width[PIXMAN_OP_CONJOINT_SRC] = fbCombineSrcU;
-    /* dest */
-    imp->combine_width[PIXMAN_OP_CONJOINT_OVER] = fbCombineConjointOverU;
-    imp->combine_width[PIXMAN_OP_CONJOINT_OVER_REVERSE] = fbCombineConjointOverReverseU;
-    imp->combine_width[PIXMAN_OP_CONJOINT_IN] = fbCombineConjointInU;
-    imp->combine_width[PIXMAN_OP_CONJOINT_IN_REVERSE] = fbCombineConjointInReverseU;
-    imp->combine_width[PIXMAN_OP_CONJOINT_OUT] = fbCombineConjointOutU;
-    imp->combine_width[PIXMAN_OP_CONJOINT_OUT_REVERSE] = fbCombineConjointOutReverseU;
-    imp->combine_width[PIXMAN_OP_CONJOINT_ATOP] = fbCombineConjointAtopU;
-    imp->combine_width[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = fbCombineConjointAtopReverseU;
-    imp->combine_width[PIXMAN_OP_CONJOINT_XOR] = fbCombineConjointXorU;
-
-    /* Component alpha combiners */
-    imp->combine_width_ca[PIXMAN_OP_CLEAR] = fbCombineClearC;
-    imp->combine_width_ca[PIXMAN_OP_SRC] = fbCombineSrcC;
-    /* dest */
-    imp->combine_width_ca[PIXMAN_OP_OVER] = fbCombineOverC;
-    imp->combine_width_ca[PIXMAN_OP_OVER_REVERSE] = fbCombineOverReverseC;
-    imp->combine_width_ca[PIXMAN_OP_IN] = fbCombineInC;
-    imp->combine_width_ca[PIXMAN_OP_IN_REVERSE] = fbCombineInReverseC;
-    imp->combine_width_ca[PIXMAN_OP_OUT] = fbCombineOutC;
-    imp->combine_width_ca[PIXMAN_OP_OUT_REVERSE] = fbCombineOutReverseC;
-    imp->combine_width_ca[PIXMAN_OP_ATOP] = fbCombineAtopC;
-    imp->combine_width_ca[PIXMAN_OP_ATOP_REVERSE] = fbCombineAtopReverseC;
-    imp->combine_width_ca[PIXMAN_OP_XOR] = fbCombineXorC;
-    imp->combine_width_ca[PIXMAN_OP_ADD] = fbCombineAddC;
-    imp->combine_width_ca[PIXMAN_OP_SATURATE] = fbCombineSaturateC;
-
-    /* Disjoint CA */
-    imp->combine_width_ca[PIXMAN_OP_DISJOINT_CLEAR] = fbCombineClearC;
-    imp->combine_width_ca[PIXMAN_OP_DISJOINT_SRC] = fbCombineSrcC;
-    /* dest */
-    imp->combine_width_ca[PIXMAN_OP_DISJOINT_OVER] = fbCombineDisjointOverC;
-    imp->combine_width_ca[PIXMAN_OP_DISJOINT_OVER_REVERSE] = fbCombineSaturateC,
-    imp->combine_width_ca[PIXMAN_OP_DISJOINT_IN] = fbCombineDisjointInC;
-    imp->combine_width_ca[PIXMAN_OP_DISJOINT_IN_REVERSE] = fbCombineDisjointInReverseC;
-    imp->combine_width_ca[PIXMAN_OP_DISJOINT_OUT] = fbCombineDisjointOutC;
-    imp->combine_width_ca[PIXMAN_OP_DISJOINT_OUT_REVERSE] = fbCombineDisjointOutReverseC;
-    imp->combine_width_ca[PIXMAN_OP_DISJOINT_ATOP] = fbCombineDisjointAtopC;
-    imp->combine_width_ca[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = fbCombineDisjointAtopReverseC;
-    imp->combine_width_ca[PIXMAN_OP_DISJOINT_XOR] = fbCombineDisjointXorC;
-
-    /* Conjoint CA */
-    imp->combine_width_ca[PIXMAN_OP_CONJOINT_CLEAR] = fbCombineClearC;
-    imp->combine_width_ca[PIXMAN_OP_CONJOINT_SRC] = fbCombineSrcC;
-    /* dest */
-    imp->combine_width_ca[PIXMAN_OP_CONJOINT_OVER] = fbCombineConjointOverC;
-    imp->combine_width_ca[PIXMAN_OP_CONJOINT_OVER_REVERSE] = fbCombineConjointOverReverseC;
-    imp->combine_width_ca[PIXMAN_OP_CONJOINT_IN] = fbCombineConjointInC;
-    imp->combine_width_ca[PIXMAN_OP_CONJOINT_IN_REVERSE] = fbCombineConjointInReverseC;
-    imp->combine_width_ca[PIXMAN_OP_CONJOINT_OUT] = fbCombineConjointOutC;
-    imp->combine_width_ca[PIXMAN_OP_CONJOINT_OUT_REVERSE] = fbCombineConjointOutReverseC;
-    imp->combine_width_ca[PIXMAN_OP_CONJOINT_ATOP] = fbCombineConjointAtopC;
-    imp->combine_width_ca[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = fbCombineConjointAtopReverseC;
-    imp->combine_width_ca[PIXMAN_OP_CONJOINT_XOR] = fbCombineConjointXorC;
-}
diff --git a/pixman/combine.pl b/pixman/combine.pl
deleted file mode 100644
index 3b75362..0000000
--- a/pixman/combine.pl
+++ /dev/null
@@ -1,81 +0,0 @@
-$usage = "Usage: combine.pl { 8 | 16 } < combine.inc";
-
-$#ARGV == 0 or die $usage;
-
-# Get the component size.
-$size = int($ARGV[0]);
-$size == 8 or $size == 16 or die $usage;
-
-$pixel_size = $size * 4;
-$half_pixel_size = $size * 2;
-
-sub mask {
-    my $str = shift;
-    my $suffix;
-    $suffix = "ULL" if $size > 8;
-
-    return "0x" . $str . $suffix;
-}
-
-# Generate mask strings.
-$nibbles = $size / 4;
-$mask = "f" x $nibbles;
-$zero_mask = "0" x $nibbles;
-$one_half = "8" . "0" x ($nibbles - 1);
-
-print "/* WARNING: This file is generated by combine.pl from combine.inc.\n";
-print "   Please edit one of those files rather than this one. */\n";
-print "\n";
-
-print "#line 1 \"combine.inc\"\n";
-
-$mask_ = mask($mask);
-$one_half_ = mask($one_half);
-$g_mask = mask($mask . $zero_mask);
-$b_mask = mask($mask . $zero_mask x 2);
-$a_mask = mask($mask . $zero_mask x 3);
-$rb_mask = mask($mask . $zero_mask . $mask);
-$ag_mask = mask($mask . $zero_mask . $mask . $zero_mask);
-$rb_one_half = mask($one_half . $zero_mask . $one_half);
-$rb_mask_plus_one = mask("1" . $zero_mask x 2 . "1" .  $zero_mask);
-
-while (<STDIN>) {
-    # Mask and 1/2 value for a single component.
-    s/#define COMPONENT_SIZE\b/$& $size/;
-    s/#define MASK\b/$& $mask_/;
-    s/#define ONE_HALF\b/$& $one_half_/;
-
-    # Shifts and masks for green, blue, and alpha.
-    s/#define G_SHIFT\b/$& $size/;
-    s/#define R_SHIFT\b/$& $size * 2/;
-    s/#define A_SHIFT\b/$& $size * 3/;
-    s/#define G_MASK\b/$& $g_mask/;
-    s/#define R_MASK\b/$& $b_mask/;
-    s/#define A_MASK\b/$& $a_mask/;
-
-    # Special values for dealing with red + blue at the same time.
-    s/#define RB_MASK\b/$& $rb_mask/;
-    s/#define AG_MASK\b/$& $ag_mask/;
-    s/#define RB_ONE_HALF\b/$& $rb_one_half/;
-    s/#define RB_MASK_PLUS_ONE\b/$& $rb_mask_plus_one/;
-
-    # Add 32/64 suffix to combining function types.
-    s/\bCombineFunc\b/CombineFunc$pixel_size/;
-    s/\bFbComposeFunctions\b/FbComposeFunctions$pixel_size/;
-    s/combine_width/combine_$pixel_size/;
-    s/_pixman_setup_combiner_functions_width/_pixman_setup_combiner_functions_$pixel_size/;
-
-    # Convert comp*_t values into the appropriate real types.
-    s/comp1_t/uint${size}_t/g;
-    s/comp2_t/uint${half_pixel_size}_t/g;
-    s/comp4_t/uint${pixel_size}_t/g;
-
-    # Change the function table name for the 64-bit version.
-    s/pixman_composeFunctions/pixman_composeFunctions64/ if $size == 16;
-
-    # Change the header for the 64-bit version
-    s/pixman-combine.h/pixman-combine64.h/ if $size == 16;
-    s/pixman-combine.h/pixman-combine32.h/ if $size == 8;
-
-    print;
-}
diff --git a/pixman/make-combine.pl b/pixman/make-combine.pl
new file mode 100644
index 0000000..3b75362
--- /dev/null
+++ b/pixman/make-combine.pl
@@ -0,0 +1,81 @@
+$usage = "Usage: combine.pl { 8 | 16 } < combine.inc";
+
+$#ARGV == 0 or die $usage;
+
+# Get the component size.
+$size = int($ARGV[0]);
+$size == 8 or $size == 16 or die $usage;
+
+$pixel_size = $size * 4;
+$half_pixel_size = $size * 2;
+
+sub mask {
+    my $str = shift;
+    my $suffix;
+    $suffix = "ULL" if $size > 8;
+
+    return "0x" . $str . $suffix;
+}
+
+# Generate mask strings.
+$nibbles = $size / 4;
+$mask = "f" x $nibbles;
+$zero_mask = "0" x $nibbles;
+$one_half = "8" . "0" x ($nibbles - 1);
+
+print "/* WARNING: This file is generated by combine.pl from combine.inc.\n";
+print "   Please edit one of those files rather than this one. */\n";
+print "\n";
+
+print "#line 1 \"combine.inc\"\n";
+
+$mask_ = mask($mask);
+$one_half_ = mask($one_half);
+$g_mask = mask($mask . $zero_mask);
+$b_mask = mask($mask . $zero_mask x 2);
+$a_mask = mask($mask . $zero_mask x 3);
+$rb_mask = mask($mask . $zero_mask . $mask);
+$ag_mask = mask($mask . $zero_mask . $mask . $zero_mask);
+$rb_one_half = mask($one_half . $zero_mask . $one_half);
+$rb_mask_plus_one = mask("1" . $zero_mask x 2 . "1" .  $zero_mask);
+
+while (<STDIN>) {
+    # Mask and 1/2 value for a single component.
+    s/#define COMPONENT_SIZE\b/$& $size/;
+    s/#define MASK\b/$& $mask_/;
+    s/#define ONE_HALF\b/$& $one_half_/;
+
+    # Shifts and masks for green, blue, and alpha.
+    s/#define G_SHIFT\b/$& $size/;
+    s/#define R_SHIFT\b/$& $size * 2/;
+    s/#define A_SHIFT\b/$& $size * 3/;
+    s/#define G_MASK\b/$& $g_mask/;
+    s/#define R_MASK\b/$& $b_mask/;
+    s/#define A_MASK\b/$& $a_mask/;
+
+    # Special values for dealing with red + blue at the same time.
+    s/#define RB_MASK\b/$& $rb_mask/;
+    s/#define AG_MASK\b/$& $ag_mask/;
+    s/#define RB_ONE_HALF\b/$& $rb_one_half/;
+    s/#define RB_MASK_PLUS_ONE\b/$& $rb_mask_plus_one/;
+
+    # Add 32/64 suffix to combining function types.
+    s/\bCombineFunc\b/CombineFunc$pixel_size/;
+    s/\bFbComposeFunctions\b/FbComposeFunctions$pixel_size/;
+    s/combine_width/combine_$pixel_size/;
+    s/_pixman_setup_combiner_functions_width/_pixman_setup_combiner_functions_$pixel_size/;
+
+    # Convert comp*_t values into the appropriate real types.
+    s/comp1_t/uint${size}_t/g;
+    s/comp2_t/uint${half_pixel_size}_t/g;
+    s/comp4_t/uint${pixel_size}_t/g;
+
+    # Change the function table name for the 64-bit version.
+    s/pixman_composeFunctions/pixman_composeFunctions64/ if $size == 16;
+
+    # Change the header for the 64-bit version
+    s/pixman-combine.h/pixman-combine64.h/ if $size == 16;
+    s/pixman-combine.h/pixman-combine32.h/ if $size == 8;
+
+    print;
+}
diff --git a/pixman/pixman-combine.c.template b/pixman/pixman-combine.c.template
new file mode 100644
index 0000000..2f4d6a7
--- /dev/null
+++ b/pixman/pixman-combine.c.template
@@ -0,0 +1,1339 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+
+#include "pixman-private.h"
+
+#include "pixman-combine.h"
+
+/*
+ * There are two ways of handling alpha -- either as a single unified value or
+ * a separate value for each component, hence each macro must have two
+ * versions.  The unified alpha version has a 'U' at the end of the name,
+ * the component version has a 'C'.  Similarly, functions which deal with
+ * this difference will have two versions using the same convention.
+ */
+
+
+/*
+ * All of the composing functions
+ */
+
+static force_inline comp4_t
+combineMask (const comp4_t *src, const comp4_t *mask, int i)
+{
+    comp4_t s, m;
+
+    if (mask)
+    {
+	m = *(mask + i) >> A_SHIFT;
+
+	if (!m)
+	    return 0;
+    }
+
+    s = *(src + i);
+
+    if (mask)
+	FbByteMul (s, m);
+
+    return s;
+}
+
+static void
+fbCombineClear (pixman_implementation_t *imp, pixman_op_t op,
+		comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    memset(dest, 0, width*sizeof(comp4_t));
+}
+
+static void
+fbCombineSrcU (pixman_implementation_t *imp, pixman_op_t op,
+	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+
+    if (!mask)
+	memcpy (dest, src, width * sizeof (comp4_t));
+    else
+    {
+	for (i = 0; i < width; ++i)
+	{
+	    comp4_t s = combineMask (src, mask, i);
+	    
+	    *(dest + i) = s;
+	}
+    }
+}
+
+/* if the Src is opaque, call fbCombineSrcU */
+static void
+fbCombineOverU (pixman_implementation_t *imp, pixman_op_t op,
+		comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+        comp4_t s = combineMask (src, mask, i);
+        comp4_t d = *(dest + i);
+        comp4_t ia = Alpha(~s);
+
+        FbByteMulAdd(d, ia, s);
+	*(dest + i) = d;
+    }
+}
+
+/* if the Dst is opaque, this is a noop */
+static void
+fbCombineOverReverseU (pixman_implementation_t *imp, pixman_op_t op,
+		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+        comp4_t s = combineMask (src, mask, i);
+        comp4_t d = *(dest + i);
+        comp4_t ia = Alpha(~*(dest + i));
+        FbByteMulAdd(s, ia, d);
+	*(dest + i) = s;
+    }
+}
+
+/* if the Dst is opaque, call fbCombineSrcU */
+static void
+fbCombineInU (pixman_implementation_t *imp, pixman_op_t op,
+	      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+        comp4_t s = combineMask (src, mask, i);
+        comp4_t a = Alpha(*(dest + i));
+        FbByteMul(s, a);
+	*(dest + i) = s;
+    }
+}
+
+/* if the Src is opaque, this is a noop */
+static void
+fbCombineInReverseU (pixman_implementation_t *imp, pixman_op_t op,
+		     comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+	comp4_t s = combineMask (src, mask, i);
+	comp4_t d = *(dest + i);
+        comp4_t a = Alpha(s);
+        FbByteMul(d, a);
+	*(dest + i) = d;
+    }
+}
+
+/* if the Dst is opaque, call fbCombineClear */
+static void
+fbCombineOutU (pixman_implementation_t *imp, pixman_op_t op,
+	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+        comp4_t s = combineMask (src, mask, i);
+        comp4_t a = Alpha(~*(dest + i));
+        FbByteMul(s, a);
+	*(dest + i) = s;
+    }
+}
+
+/* if the Src is opaque, call fbCombineClear */
+static void
+fbCombineOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
+		      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+	comp4_t s = combineMask (src, mask, i);
+        comp4_t d = *(dest + i);
+        comp4_t a = Alpha(~s);
+        FbByteMul(d, a);
+	*(dest + i) = d;
+    }
+}
+
+/* if the Src is opaque, call fbCombineInU */
+/* if the Dst is opaque, call fbCombineOverU */
+/* if both the Src and Dst are opaque, call fbCombineSrcU */
+static void
+fbCombineAtopU (pixman_implementation_t *imp, pixman_op_t op,
+		comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+        comp4_t s = combineMask (src, mask, i);
+        comp4_t d = *(dest + i);
+        comp4_t dest_a = Alpha(d);
+        comp4_t src_ia = Alpha(~s);
+
+        FbByteAddMul(s, dest_a, d, src_ia);
+	*(dest + i) = s;
+    }
+}
+
+/* if the Src is opaque, call fbCombineOverReverseU */
+/* if the Dst is opaque, call fbCombineInReverseU */
+/* if both the Src and Dst are opaque, call fbCombineDstU */
+static void
+fbCombineAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
+		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+        comp4_t s = combineMask (src, mask, i);
+        comp4_t d = *(dest + i);
+        comp4_t src_a = Alpha(s);
+        comp4_t dest_ia = Alpha(~d);
+
+        FbByteAddMul(s, dest_ia, d, src_a);
+	*(dest + i) = s;
+    }
+}
+
+/* if the Src is opaque, call fbCombineOverU */
+/* if the Dst is opaque, call fbCombineOverReverseU */
+/* if both the Src and Dst are opaque, call fbCombineClear */
+static void
+fbCombineXorU (pixman_implementation_t *imp, pixman_op_t op,
+	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+        comp4_t s = combineMask (src, mask, i);
+        comp4_t d = *(dest + i);
+        comp4_t src_ia = Alpha(~s);
+        comp4_t dest_ia = Alpha(~d);
+
+        FbByteAddMul(s, dest_ia, d, src_ia);
+	*(dest + i) = s;
+    }
+}
+
+static void
+fbCombineAddU (pixman_implementation_t *imp, pixman_op_t op,
+	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+        comp4_t s = combineMask (src, mask, i);
+        comp4_t d = *(dest + i);
+        FbByteAdd(d, s);
+	*(dest + i) = d;
+    }
+}
+
+/* if the Src is opaque, call fbCombineAddU */
+/* if the Dst is opaque, call fbCombineAddU */
+/* if both the Src and Dst are opaque, call fbCombineAddU */
+static void
+fbCombineSaturateU (pixman_implementation_t *imp, pixman_op_t op,
+		    comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+        comp4_t s = combineMask (src, mask, i);
+        comp4_t d = *(dest + i);
+        comp2_t sa, da;
+
+        sa = s >> A_SHIFT;
+        da = ~d >> A_SHIFT;
+        if (sa > da)
+        {
+            sa = IntDiv(da, sa);
+            FbByteMul(s, sa);
+        };
+        FbByteAdd(d, s);
+	*(dest + i) = d;
+    }
+}
+
+
+/*
+ * All of the disjoint composing functions
+
+ The four entries in the first column indicate what source contributions
+ come from each of the four areas of the picture -- areas covered by neither
+ A nor B, areas covered only by A, areas covered only by B and finally
+ areas covered by both A and B.
+
+ Disjoint			Conjoint
+ Fa		Fb		Fa		Fb
+ (0,0,0,0)	0		0		0		0
+ (0,A,0,A)	1		0		1		0
+ (0,0,B,B)	0		1		0		1
+ (0,A,B,A)	1		min((1-a)/b,1)	1		max(1-a/b,0)
+ (0,A,B,B)	min((1-b)/a,1)	1		max(1-b/a,0)	1
+ (0,0,0,A)	max(1-(1-b)/a,0) 0		min(1,b/a)	0
+ (0,0,0,B)	0		max(1-(1-a)/b,0) 0		min(a/b,1)
+ (0,A,0,0)	min(1,(1-b)/a)	0		max(1-b/a,0)	0
+ (0,0,B,0)	0		min(1,(1-a)/b)	0		max(1-a/b,0)
+ (0,0,B,A)	max(1-(1-b)/a,0) min(1,(1-a)/b)	 min(1,b/a)	max(1-a/b,0)
+ (0,A,0,B)	min(1,(1-b)/a)	max(1-(1-a)/b,0) max(1-b/a,0)	min(1,a/b)
+ (0,A,B,0)	min(1,(1-b)/a)	min(1,(1-a)/b)	max(1-b/a,0)	max(1-a/b,0)
+
+*/
+
+#define CombineAOut 1
+#define CombineAIn  2
+#define CombineBOut 4
+#define CombineBIn  8
+
+#define CombineClear	0
+#define CombineA	(CombineAOut|CombineAIn)
+#define CombineB	(CombineBOut|CombineBIn)
+#define CombineAOver	(CombineAOut|CombineBOut|CombineAIn)
+#define CombineBOver	(CombineAOut|CombineBOut|CombineBIn)
+#define CombineAAtop	(CombineBOut|CombineAIn)
+#define CombineBAtop	(CombineAOut|CombineBIn)
+#define CombineXor	(CombineAOut|CombineBOut)
+
+/* portion covered by a but not b */
+static comp1_t
+fbCombineDisjointOutPart (comp1_t a, comp1_t b)
+{
+    /* min (1, (1-b) / a) */
+
+    b = ~b;		    /* 1 - b */
+    if (b >= a)		    /* 1 - b >= a -> (1-b)/a >= 1 */
+	return MASK;	    /* 1 */
+    return IntDiv(b,a);     /* (1-b) / a */
+}
+
+/* portion covered by both a and b */
+static comp1_t
+fbCombineDisjointInPart (comp1_t a, comp1_t b)
+{
+    /* max (1-(1-b)/a,0) */
+    /*  = - min ((1-b)/a - 1, 0) */
+    /*  = 1 - min (1, (1-b)/a) */
+
+    b = ~b;		    /* 1 - b */
+    if (b >= a)		    /* 1 - b >= a -> (1-b)/a >= 1 */
+	return 0;	    /* 1 - 1 */
+    return ~IntDiv(b,a);    /* 1 - (1-b) / a */
+}
+
+/* portion covered by a but not b */
+static comp1_t
+fbCombineConjointOutPart (comp1_t a, comp1_t b)
+{
+    /* max (1-b/a,0) */
+    /* = 1-min(b/a,1) */
+
+    /* min (1, (1-b) / a) */
+
+    if (b >= a)		    /* b >= a -> b/a >= 1 */
+	return 0x00;	    /* 0 */
+    return ~IntDiv(b,a);    /* 1 - b/a */
+}
+
+/* portion covered by both a and b */
+static comp1_t
+fbCombineConjointInPart (comp1_t a, comp1_t b)
+{
+    /* min (1,b/a) */
+
+    if (b >= a)		    /* b >= a -> b/a >= 1 */
+	return MASK;	    /* 1 */
+    return IntDiv(b,a);     /* b/a */
+}
+
+static void
+fbCombineDisjointGeneralU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+        comp4_t s = combineMask (src, mask, i);
+        comp4_t d = *(dest + i);
+        comp4_t m,n,o,p;
+        comp2_t Fa, Fb, t, u, v;
+        comp1_t sa = s >> A_SHIFT;
+        comp1_t da = d >> A_SHIFT;
+
+        switch (combine & CombineA) {
+        default:
+            Fa = 0;
+            break;
+        case CombineAOut:
+            Fa = fbCombineDisjointOutPart (sa, da);
+            break;
+        case CombineAIn:
+            Fa = fbCombineDisjointInPart (sa, da);
+            break;
+        case CombineA:
+            Fa = MASK;
+            break;
+        }
+
+        switch (combine & CombineB) {
+        default:
+            Fb = 0;
+            break;
+        case CombineBOut:
+            Fb = fbCombineDisjointOutPart (da, sa);
+            break;
+        case CombineBIn:
+            Fb = fbCombineDisjointInPart (da, sa);
+            break;
+        case CombineB:
+            Fb = MASK;
+            break;
+        }
+        m = FbGen (s,d,0,Fa,Fb,t, u, v);
+        n = FbGen (s,d,G_SHIFT,Fa,Fb,t, u, v);
+        o = FbGen (s,d,R_SHIFT,Fa,Fb,t, u, v);
+        p = FbGen (s,d,A_SHIFT,Fa,Fb,t, u, v);
+        s = m|n|o|p;
+	*(dest + i) = s;
+    }
+}
+
+static void
+fbCombineDisjointOverU (pixman_implementation_t *imp, pixman_op_t op,
+			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+        comp4_t s = combineMask (src, mask, i);
+        comp2_t a = s >> A_SHIFT;
+
+        if (a != 0x00)
+        {
+            if (a != MASK)
+            {
+                comp4_t d = *(dest + i);
+                a = fbCombineDisjointOutPart (d >> A_SHIFT, a);
+                FbByteMulAdd(d, a, s);
+                s = d;
+            }
+	    *(dest + i) = s;
+        }
+    }
+}
+
+static void
+fbCombineDisjointInU (pixman_implementation_t *imp, pixman_op_t op,
+		      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralU (dest, src, mask, width, CombineAIn);
+}
+
+static void
+fbCombineDisjointInReverseU (pixman_implementation_t *imp, pixman_op_t op,
+			     comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralU (dest, src, mask, width, CombineBIn);
+}
+
+static void
+fbCombineDisjointOutU (pixman_implementation_t *imp, pixman_op_t op,
+		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralU (dest, src, mask, width, CombineAOut);
+}
+
+static void
+fbCombineDisjointOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
+			      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralU (dest, src, mask, width, CombineBOut);
+}
+
+static void
+fbCombineDisjointAtopU (pixman_implementation_t *imp, pixman_op_t op,
+			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralU (dest, src, mask, width, CombineAAtop);
+}
+
+static void
+fbCombineDisjointAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
+			       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralU (dest, src, mask, width, CombineBAtop);
+}
+
+static void
+fbCombineDisjointXorU (pixman_implementation_t *imp, pixman_op_t op,
+		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralU (dest, src, mask, width, CombineXor);
+}
+
+static void
+fbCombineConjointGeneralU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine)
+{
+    int i;
+    for (i = 0; i < width; ++i) {
+        comp4_t s = combineMask (src, mask, i);
+        comp4_t d = *(dest + i);
+        comp4_t m,n,o,p;
+        comp2_t Fa, Fb, t, u, v;
+        comp1_t sa = s >> A_SHIFT;
+        comp1_t da = d >> A_SHIFT;
+
+        switch (combine & CombineA) {
+        default:
+            Fa = 0;
+            break;
+        case CombineAOut:
+            Fa = fbCombineConjointOutPart (sa, da);
+            break;
+        case CombineAIn:
+            Fa = fbCombineConjointInPart (sa, da);
+            break;
+        case CombineA:
+            Fa = MASK;
+            break;
+        }
+
+        switch (combine & CombineB) {
+        default:
+            Fb = 0;
+            break;
+        case CombineBOut:
+            Fb = fbCombineConjointOutPart (da, sa);
+            break;
+        case CombineBIn:
+            Fb = fbCombineConjointInPart (da, sa);
+            break;
+        case CombineB:
+            Fb = MASK;
+            break;
+        }
+        m = FbGen (s,d,0,Fa,Fb,t, u, v);
+        n = FbGen (s,d,G_SHIFT,Fa,Fb,t, u, v);
+        o = FbGen (s,d,R_SHIFT,Fa,Fb,t, u, v);
+        p = FbGen (s,d,A_SHIFT,Fa,Fb,t, u, v);
+        s = m|n|o|p;
+	*(dest + i) = s;
+    }
+}
+
+static void
+fbCombineConjointOverU (pixman_implementation_t *imp, pixman_op_t op,
+			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralU (dest, src, mask, width, CombineAOver);
+}
+
+
+static void
+fbCombineConjointOverReverseU (pixman_implementation_t *imp, pixman_op_t op,
+			       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralU (dest, src, mask, width, CombineBOver);
+}
+
+
+static void
+fbCombineConjointInU (pixman_implementation_t *imp, pixman_op_t op,
+		      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralU (dest, src, mask, width, CombineAIn);
+}
+
+
+static void
+fbCombineConjointInReverseU (pixman_implementation_t *imp, pixman_op_t op,
+			     comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralU (dest, src, mask, width, CombineBIn);
+}
+
+static void
+fbCombineConjointOutU (pixman_implementation_t *imp, pixman_op_t op,
+		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralU (dest, src, mask, width, CombineAOut);
+}
+
+static void
+fbCombineConjointOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
+			      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralU (dest, src, mask, width, CombineBOut);
+}
+
+static void
+fbCombineConjointAtopU (pixman_implementation_t *imp, pixman_op_t op,
+			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralU (dest, src, mask, width, CombineAAtop);
+}
+
+static void
+fbCombineConjointAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
+			       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralU (dest, src, mask, width, CombineBAtop);
+}
+
+static void
+fbCombineConjointXorU (pixman_implementation_t *imp, pixman_op_t op,
+		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralU (dest, src, mask, width, CombineXor);
+}
+
+/********************************************************************************/
+/*************************** Per Channel functions ******************************/
+/********************************************************************************/
+
+static void
+fbCombineMaskC (comp4_t *src, comp4_t *mask)
+{
+    comp4_t a = *mask;
+
+    comp4_t	x;
+    comp2_t	xa;
+
+    if (!a)
+    {
+	*(src) = 0;
+	return;
+    }
+
+    x = *(src);
+    if (a == ~0)
+    {
+	x = x >> A_SHIFT;
+	x |= x << G_SHIFT;
+	x |= x << R_SHIFT;
+	*(mask) = x;
+	return;
+    }
+
+    xa = x >> A_SHIFT;
+    FbByteMulC(x, a);
+    *(src) = x;
+    FbByteMul(a, xa);
+    *(mask) = a;
+}
+
+static void
+fbCombineMaskValueC (comp4_t *src, const comp4_t *mask)
+{
+    comp4_t a = *mask;
+    comp4_t	x;
+
+    if (!a)
+    {
+	*(src) = 0;
+	return;
+    }
+
+    if (a == ~0)
+	return;
+
+    x = *(src);
+    FbByteMulC(x, a);
+    *(src) =x;
+}
+
+static void
+fbCombineMaskAlphaC (const comp4_t *src, comp4_t *mask)
+{
+    comp4_t a = *(mask);
+    comp4_t	x;
+
+    if (!a)
+	return;
+
+    x = *(src) >> A_SHIFT;
+    if (x == MASK)
+	return;
+    if (a == ~0)
+    {
+	x = x >> A_SHIFT;
+	x |= x << G_SHIFT;
+	x |= x << R_SHIFT;
+	*(mask) = x;
+	return;
+    }
+
+    FbByteMul(a, x);
+    *(mask) = a;
+}
+
+static void
+fbCombineClearC (pixman_implementation_t *imp, pixman_op_t op,
+		 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    memset(dest, 0, width*sizeof(comp4_t));
+}
+
+static void
+fbCombineSrcC (pixman_implementation_t *imp, pixman_op_t op,
+	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+	comp4_t s = *(src + i);
+	comp4_t m = *(mask + i);
+
+	fbCombineMaskValueC (&s, &m);
+
+	*(dest) = s;
+    }
+}
+
+static void
+fbCombineOverC (pixman_implementation_t *imp, pixman_op_t op,
+		comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+	comp4_t s = *(src + i);
+	comp4_t m = *(mask + i);
+	comp4_t a;
+
+	fbCombineMaskC (&s, &m);
+
+	a = ~m;
+        if (a != ~0)
+        {
+            if (a)
+            {
+                comp4_t d = *(dest + i);
+                FbByteMulAddC(d, a, s);
+                s = d;
+            }
+	    *(dest + i) = s;
+        }
+    }
+}
+
+static void
+fbCombineOverReverseC (pixman_implementation_t *imp, pixman_op_t op,
+		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+        comp4_t d = *(dest + i);
+        comp4_t a = ~d >> A_SHIFT;
+
+        if (a)
+        {
+            comp4_t s = *(src + i);
+	    comp4_t m = *(mask + i);
+
+	    fbCombineMaskValueC (&s, &m);
+
+            if (a != MASK)
+            {
+                FbByteMulAdd(s, a, d);
+            }
+	    *(dest + i) = s;
+        }
+    }
+}
+
+static void
+fbCombineInC (pixman_implementation_t *imp, pixman_op_t op,
+	      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+        comp4_t d = *(dest + i);
+        comp2_t a = d >> A_SHIFT;
+        comp4_t s = 0;
+        if (a)
+        {
+	    comp4_t m = *(mask + i);
+
+	    s = *(src + i);
+	    fbCombineMaskValueC (&s, &m);
+            if (a != MASK)
+            {
+                FbByteMul(s, a);
+            }
+        }
+	*(dest + i) = s;
+    }
+}
+
+static void
+fbCombineInReverseC (pixman_implementation_t *imp, pixman_op_t op,
+		     comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+        comp4_t s = *(src + i);
+        comp4_t m = *(mask + i);
+        comp4_t a;
+
+	fbCombineMaskAlphaC (&s, &m);
+
+	a = m;
+        if (a != ~0)
+        {
+            comp4_t d = 0;
+            if (a)
+            {
+                d = *(dest + i);
+                FbByteMulC(d, a);
+            }
+	    *(dest + i) = d;
+        }
+    }
+}
+
+static void
+fbCombineOutC (pixman_implementation_t *imp, pixman_op_t op,
+	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+        comp4_t d = *(dest + i);
+        comp2_t a = ~d >> A_SHIFT;
+        comp4_t s = 0;
+        if (a)
+        {
+	    comp4_t m = *(mask + i);
+
+	    s = *(src + i);
+	    fbCombineMaskValueC (&s, &m);
+
+            if (a != MASK)
+            {
+                FbByteMul(s, a);
+            }
+        }
+	*(dest + i) = s;
+    }
+}
+
+static void
+fbCombineOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
+		      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+	comp4_t s = *(src + i);
+	comp4_t m = *(mask + i);
+	comp4_t a;
+
+	fbCombineMaskAlphaC (&s, &m);
+
+        a = ~m;
+        if (a != ~0)
+        {
+            comp4_t d = 0;
+            if (a)
+            {
+                d = *(dest + i);
+                FbByteMulC(d, a);
+            }
+	    *(dest + i) = d;
+        }
+    }
+}
+
+static void
+fbCombineAtopC (pixman_implementation_t *imp, pixman_op_t op,
+		comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+        comp4_t d = *(dest + i);
+        comp4_t s = *(src + i);
+        comp4_t m = *(mask + i);
+        comp4_t ad;
+        comp2_t as = d >> A_SHIFT;
+
+	fbCombineMaskC (&s, &m);
+
+        ad = ~m;
+
+        FbByteAddMulC(d, ad, s, as);
+	*(dest + i) = d;
+    }
+}
+
+static void
+fbCombineAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
+		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+
+        comp4_t d = *(dest + i);
+        comp4_t s = *(src + i);
+        comp4_t m = *(mask + i);
+        comp4_t ad;
+        comp2_t as = ~d >> A_SHIFT;
+
+	fbCombineMaskC (&s, &m);
+
+	ad = m;
+
+        FbByteAddMulC(d, ad, s, as);
+	*(dest + i) = d;
+    }
+}
+
+static void
+fbCombineXorC (pixman_implementation_t *imp, pixman_op_t op,
+	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+        comp4_t d = *(dest + i);
+        comp4_t s = *(src + i);
+        comp4_t m = *(mask + i);
+        comp4_t ad;
+        comp2_t as = ~d >> A_SHIFT;
+
+	fbCombineMaskC (&s, &m);
+
+	ad = ~m;
+
+        FbByteAddMulC(d, ad, s, as);
+	*(dest + i) = d;
+    }
+}
+
+static void
+fbCombineAddC (pixman_implementation_t *imp, pixman_op_t op,
+	       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+        comp4_t s = *(src + i);
+        comp4_t m = *(mask + i);
+        comp4_t d = *(dest + i);
+
+	fbCombineMaskValueC (&s, &m);
+
+        FbByteAdd(d, s);
+	*(dest + i) = d;
+    }
+}
+
+static void
+fbCombineSaturateC (pixman_implementation_t *imp, pixman_op_t op,
+		    comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+        comp4_t s, d;
+        comp2_t sa, sr, sg, sb, da;
+        comp2_t t, u, v;
+        comp4_t m,n,o,p;
+
+        d = *(dest + i);
+        s = *(src + i);
+	m = *(mask + i);
+
+	fbCombineMaskC (&s, &m);
+
+        sa = (m >> A_SHIFT);
+        sr = (m >> R_SHIFT) & MASK;
+        sg = (m >> G_SHIFT) & MASK;
+        sb =  m             & MASK;
+        da = ~d >> A_SHIFT;
+
+        if (sb <= da)
+            m = Add(s,d,0,t);
+        else
+            m = FbGen (s, d, 0, (da << G_SHIFT) / sb, MASK, t, u, v);
+
+        if (sg <= da)
+            n = Add(s,d,G_SHIFT,t);
+        else
+            n = FbGen (s, d, G_SHIFT, (da << G_SHIFT) / sg, MASK, t, u, v);
+
+        if (sr <= da)
+            o = Add(s,d,R_SHIFT,t);
+        else
+            o = FbGen (s, d, R_SHIFT, (da << G_SHIFT) / sr, MASK, t, u, v);
+
+        if (sa <= da)
+            p = Add(s,d,A_SHIFT,t);
+        else
+            p = FbGen (s, d, A_SHIFT, (da << G_SHIFT) / sa, MASK, t, u, v);
+
+	*(dest + i) = m|n|o|p;
+    }
+}
+
+static void
+fbCombineDisjointGeneralC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+        comp4_t s, d;
+        comp4_t m,n,o,p;
+        comp4_t Fa, Fb;
+        comp2_t t, u, v;
+        comp4_t sa;
+        comp1_t da;
+
+        s = *(src + i);
+        m = *(mask + i);
+        d = *(dest + i);
+        da = d >> A_SHIFT;
+
+	fbCombineMaskC (&s, &m);
+
+	sa = m;
+
+        switch (combine & CombineA) {
+        default:
+            Fa = 0;
+            break;
+        case CombineAOut:
+            m = (comp4_t)fbCombineDisjointOutPart ((comp1_t) (sa >> 0), da);
+            n = (comp4_t)fbCombineDisjointOutPart ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
+            o = (comp4_t)fbCombineDisjointOutPart ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
+            p = (comp4_t)fbCombineDisjointOutPart ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
+            Fa = m|n|o|p;
+            break;
+        case CombineAIn:
+            m = (comp4_t)fbCombineDisjointInPart ((comp1_t) (sa >> 0), da);
+            n = (comp4_t)fbCombineDisjointInPart ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
+            o = (comp4_t)fbCombineDisjointInPart ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
+            p = (comp4_t)fbCombineDisjointInPart ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
+            Fa = m|n|o|p;
+            break;
+        case CombineA:
+            Fa = ~0;
+            break;
+        }
+
+        switch (combine & CombineB) {
+        default:
+            Fb = 0;
+            break;
+        case CombineBOut:
+            m = (comp4_t)fbCombineDisjointOutPart (da, (comp1_t) (sa >> 0));
+            n = (comp4_t)fbCombineDisjointOutPart (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
+            o = (comp4_t)fbCombineDisjointOutPart (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
+            p = (comp4_t)fbCombineDisjointOutPart (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
+            Fb = m|n|o|p;
+            break;
+        case CombineBIn:
+            m = (comp4_t)fbCombineDisjointInPart (da, (comp1_t) (sa >> 0));
+            n = (comp4_t)fbCombineDisjointInPart (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
+            o = (comp4_t)fbCombineDisjointInPart (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
+            p = (comp4_t)fbCombineDisjointInPart (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
+            Fb = m|n|o|p;
+            break;
+        case CombineB:
+            Fb = ~0;
+            break;
+        }
+        m = FbGen (s,d,0,GetComp(Fa,0),GetComp(Fb,0),t, u, v);
+        n = FbGen (s,d,G_SHIFT,GetComp(Fa,G_SHIFT),GetComp(Fb,G_SHIFT),t, u, v);
+        o = FbGen (s,d,R_SHIFT,GetComp(Fa,R_SHIFT),GetComp(Fb,R_SHIFT),t, u, v);
+        p = FbGen (s,d,A_SHIFT,GetComp(Fa,A_SHIFT),GetComp(Fb,A_SHIFT),t, u, v);
+        s = m|n|o|p;
+	*(dest + i) = s;
+    }
+}
+
+static void
+fbCombineDisjointOverC (pixman_implementation_t *imp, pixman_op_t op,
+			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOver);
+}
+
+static void
+fbCombineDisjointInC (pixman_implementation_t *imp, pixman_op_t op,
+		      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralC (dest, src, mask, width, CombineAIn);
+}
+
+static void
+fbCombineDisjointInReverseC (pixman_implementation_t *imp, pixman_op_t op,
+			     comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralC (dest, src, mask, width, CombineBIn);
+}
+
+static void
+fbCombineDisjointOutC (pixman_implementation_t *imp, pixman_op_t op,
+		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOut);
+}
+
+static void
+fbCombineDisjointOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
+			      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralC (dest, src, mask, width, CombineBOut);
+}
+
+static void
+fbCombineDisjointAtopC (pixman_implementation_t *imp, pixman_op_t op,
+			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralC (dest, src, mask, width, CombineAAtop);
+}
+
+static void
+fbCombineDisjointAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
+			       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralC (dest, src, mask, width, CombineBAtop);
+}
+
+static void
+fbCombineDisjointXorC (pixman_implementation_t *imp, pixman_op_t op,
+		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineDisjointGeneralC (dest, src, mask, width, CombineXor);
+}
+
+static void
+fbCombineConjointGeneralC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine)
+{
+    int i;
+
+    for (i = 0; i < width; ++i) {
+        comp4_t s, d;
+        comp4_t m,n,o,p;
+        comp4_t Fa, Fb;
+        comp2_t t, u, v;
+        comp4_t sa;
+        comp1_t da;
+
+        s = *(src + i);
+        m = *(mask + i);
+        d = *(dest + i);
+        da = d >> A_SHIFT;
+
+	fbCombineMaskC (&s, &m);
+
+        sa = m;
+
+        switch (combine & CombineA) {
+        default:
+            Fa = 0;
+            break;
+        case CombineAOut:
+            m = (comp4_t)fbCombineConjointOutPart ((comp1_t) (sa >> 0), da);
+            n = (comp4_t)fbCombineConjointOutPart ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
+            o = (comp4_t)fbCombineConjointOutPart ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
+            p = (comp4_t)fbCombineConjointOutPart ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
+            Fa = m|n|o|p;
+            break;
+        case CombineAIn:
+            m = (comp4_t)fbCombineConjointInPart ((comp1_t) (sa >> 0), da);
+            n = (comp4_t)fbCombineConjointInPart ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
+            o = (comp4_t)fbCombineConjointInPart ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
+            p = (comp4_t)fbCombineConjointInPart ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
+            Fa = m|n|o|p;
+            break;
+        case CombineA:
+            Fa = ~0;
+            break;
+        }
+
+        switch (combine & CombineB) {
+        default:
+            Fb = 0;
+            break;
+        case CombineBOut:
+            m = (comp4_t)fbCombineConjointOutPart (da, (comp1_t) (sa >> 0));
+            n = (comp4_t)fbCombineConjointOutPart (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
+            o = (comp4_t)fbCombineConjointOutPart (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
+            p = (comp4_t)fbCombineConjointOutPart (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
+            Fb = m|n|o|p;
+            break;
+        case CombineBIn:
+            m = (comp4_t)fbCombineConjointInPart (da, (comp1_t) (sa >> 0));
+            n = (comp4_t)fbCombineConjointInPart (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
+            o = (comp4_t)fbCombineConjointInPart (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
+            p = (comp4_t)fbCombineConjointInPart (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
+            Fb = m|n|o|p;
+            break;
+        case CombineB:
+            Fb = ~0;
+            break;
+        }
+        m = FbGen (s,d,0,GetComp(Fa,0),GetComp(Fb,0),t, u, v);
+        n = FbGen (s,d,G_SHIFT,GetComp(Fa,G_SHIFT),GetComp(Fb,G_SHIFT),t, u, v);
+        o = FbGen (s,d,R_SHIFT,GetComp(Fa,R_SHIFT),GetComp(Fb,R_SHIFT),t, u, v);
+        p = FbGen (s,d,A_SHIFT,GetComp(Fa,A_SHIFT),GetComp(Fb,A_SHIFT),t, u, v);
+        s = m|n|o|p;
+	*(dest + i) = s;
+    }
+}
+
+static void
+fbCombineConjointOverC (pixman_implementation_t *imp, pixman_op_t op,
+			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralC (dest, src, mask, width, CombineAOver);
+}
+
+static void
+fbCombineConjointOverReverseC (pixman_implementation_t *imp, pixman_op_t op,
+			       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralC (dest, src, mask, width, CombineBOver);
+}
+
+static void
+fbCombineConjointInC (pixman_implementation_t *imp, pixman_op_t op,
+		      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralC (dest, src, mask, width, CombineAIn);
+}
+
+static void
+fbCombineConjointInReverseC (pixman_implementation_t *imp, pixman_op_t op,
+			     comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralC (dest, src, mask, width, CombineBIn);
+}
+
+static void
+fbCombineConjointOutC (pixman_implementation_t *imp, pixman_op_t op,
+		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralC (dest, src, mask, width, CombineAOut);
+}
+
+static void
+fbCombineConjointOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
+			      comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralC (dest, src, mask, width, CombineBOut);
+}
+
+static void
+fbCombineConjointAtopC (pixman_implementation_t *imp, pixman_op_t op,
+			comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralC (dest, src, mask, width, CombineAAtop);
+}
+
+static void
+fbCombineConjointAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
+			       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralC (dest, src, mask, width, CombineBAtop);
+}
+
+static void
+fbCombineConjointXorC (pixman_implementation_t *imp, pixman_op_t op,
+		       comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+{
+    fbCombineConjointGeneralC (dest, src, mask, width, CombineXor);
+}
+
+void
+_pixman_setup_combiner_functions_width (pixman_implementation_t *imp)
+{
+    /* Unified alpha */
+    imp->combine_width[PIXMAN_OP_CLEAR] = fbCombineClear;
+    imp->combine_width[PIXMAN_OP_SRC] = fbCombineSrcU;
+    /* dest */
+    imp->combine_width[PIXMAN_OP_OVER] = fbCombineOverU;
+    imp->combine_width[PIXMAN_OP_OVER_REVERSE] = fbCombineOverReverseU;
+    imp->combine_width[PIXMAN_OP_IN] = fbCombineInU;
+    imp->combine_width[PIXMAN_OP_IN_REVERSE] = fbCombineInReverseU;
+    imp->combine_width[PIXMAN_OP_OUT] = fbCombineOutU;
+    imp->combine_width[PIXMAN_OP_OUT_REVERSE] = fbCombineOutReverseU;
+    imp->combine_width[PIXMAN_OP_ATOP] = fbCombineAtopU;
+    imp->combine_width[PIXMAN_OP_ATOP_REVERSE] = fbCombineAtopReverseU;
+    imp->combine_width[PIXMAN_OP_XOR] = fbCombineXorU;
+    imp->combine_width[PIXMAN_OP_ADD] = fbCombineAddU;
+    imp->combine_width[PIXMAN_OP_SATURATE] = fbCombineSaturateU;
+
+    /* Disjoint, unified */
+    imp->combine_width[PIXMAN_OP_DISJOINT_CLEAR] = fbCombineClear;
+    imp->combine_width[PIXMAN_OP_DISJOINT_SRC] = fbCombineSrcU;
+    /* dest */
+    imp->combine_width[PIXMAN_OP_DISJOINT_OVER] = fbCombineDisjointOverU;
+    imp->combine_width[PIXMAN_OP_DISJOINT_OVER_REVERSE] = fbCombineSaturateU;
+    imp->combine_width[PIXMAN_OP_DISJOINT_IN] = fbCombineDisjointInU;
+    imp->combine_width[PIXMAN_OP_DISJOINT_IN_REVERSE] = fbCombineDisjointInReverseU;
+    imp->combine_width[PIXMAN_OP_DISJOINT_OUT] = fbCombineDisjointOutU;
+    imp->combine_width[PIXMAN_OP_DISJOINT_OUT_REVERSE] = fbCombineDisjointOutReverseU;
+    imp->combine_width[PIXMAN_OP_DISJOINT_ATOP] = fbCombineDisjointAtopU;
+    imp->combine_width[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = fbCombineDisjointAtopReverseU;
+    imp->combine_width[PIXMAN_OP_DISJOINT_XOR] = fbCombineDisjointXorU;
+
+    /* Conjoint, unified */
+    imp->combine_width[PIXMAN_OP_CONJOINT_CLEAR] = fbCombineClear;
+    imp->combine_width[PIXMAN_OP_CONJOINT_SRC] = fbCombineSrcU;
+    /* dest */
+    imp->combine_width[PIXMAN_OP_CONJOINT_OVER] = fbCombineConjointOverU;
+    imp->combine_width[PIXMAN_OP_CONJOINT_OVER_REVERSE] = fbCombineConjointOverReverseU;
+    imp->combine_width[PIXMAN_OP_CONJOINT_IN] = fbCombineConjointInU;
+    imp->combine_width[PIXMAN_OP_CONJOINT_IN_REVERSE] = fbCombineConjointInReverseU;
+    imp->combine_width[PIXMAN_OP_CONJOINT_OUT] = fbCombineConjointOutU;
+    imp->combine_width[PIXMAN_OP_CONJOINT_OUT_REVERSE] = fbCombineConjointOutReverseU;
+    imp->combine_width[PIXMAN_OP_CONJOINT_ATOP] = fbCombineConjointAtopU;
+    imp->combine_width[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = fbCombineConjointAtopReverseU;
+    imp->combine_width[PIXMAN_OP_CONJOINT_XOR] = fbCombineConjointXorU;
+
+    /* Component alpha combiners */
+    imp->combine_width_ca[PIXMAN_OP_CLEAR] = fbCombineClearC;
+    imp->combine_width_ca[PIXMAN_OP_SRC] = fbCombineSrcC;
+    /* dest */
+    imp->combine_width_ca[PIXMAN_OP_OVER] = fbCombineOverC;
+    imp->combine_width_ca[PIXMAN_OP_OVER_REVERSE] = fbCombineOverReverseC;
+    imp->combine_width_ca[PIXMAN_OP_IN] = fbCombineInC;
+    imp->combine_width_ca[PIXMAN_OP_IN_REVERSE] = fbCombineInReverseC;
+    imp->combine_width_ca[PIXMAN_OP_OUT] = fbCombineOutC;
+    imp->combine_width_ca[PIXMAN_OP_OUT_REVERSE] = fbCombineOutReverseC;
+    imp->combine_width_ca[PIXMAN_OP_ATOP] = fbCombineAtopC;
+    imp->combine_width_ca[PIXMAN_OP_ATOP_REVERSE] = fbCombineAtopReverseC;
+    imp->combine_width_ca[PIXMAN_OP_XOR] = fbCombineXorC;
+    imp->combine_width_ca[PIXMAN_OP_ADD] = fbCombineAddC;
+    imp->combine_width_ca[PIXMAN_OP_SATURATE] = fbCombineSaturateC;
+
+    /* Disjoint CA */
+    imp->combine_width_ca[PIXMAN_OP_DISJOINT_CLEAR] = fbCombineClearC;
+    imp->combine_width_ca[PIXMAN_OP_DISJOINT_SRC] = fbCombineSrcC;
+    /* dest */
+    imp->combine_width_ca[PIXMAN_OP_DISJOINT_OVER] = fbCombineDisjointOverC;
+    imp->combine_width_ca[PIXMAN_OP_DISJOINT_OVER_REVERSE] = fbCombineSaturateC,
+    imp->combine_width_ca[PIXMAN_OP_DISJOINT_IN] = fbCombineDisjointInC;
+    imp->combine_width_ca[PIXMAN_OP_DISJOINT_IN_REVERSE] = fbCombineDisjointInReverseC;
+    imp->combine_width_ca[PIXMAN_OP_DISJOINT_OUT] = fbCombineDisjointOutC;
+    imp->combine_width_ca[PIXMAN_OP_DISJOINT_OUT_REVERSE] = fbCombineDisjointOutReverseC;
+    imp->combine_width_ca[PIXMAN_OP_DISJOINT_ATOP] = fbCombineDisjointAtopC;
+    imp->combine_width_ca[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = fbCombineDisjointAtopReverseC;
+    imp->combine_width_ca[PIXMAN_OP_DISJOINT_XOR] = fbCombineDisjointXorC;
+
+    /* Conjoint CA */
+    imp->combine_width_ca[PIXMAN_OP_CONJOINT_CLEAR] = fbCombineClearC;
+    imp->combine_width_ca[PIXMAN_OP_CONJOINT_SRC] = fbCombineSrcC;
+    /* dest */
+    imp->combine_width_ca[PIXMAN_OP_CONJOINT_OVER] = fbCombineConjointOverC;
+    imp->combine_width_ca[PIXMAN_OP_CONJOINT_OVER_REVERSE] = fbCombineConjointOverReverseC;
+    imp->combine_width_ca[PIXMAN_OP_CONJOINT_IN] = fbCombineConjointInC;
+    imp->combine_width_ca[PIXMAN_OP_CONJOINT_IN_REVERSE] = fbCombineConjointInReverseC;
+    imp->combine_width_ca[PIXMAN_OP_CONJOINT_OUT] = fbCombineConjointOutC;
+    imp->combine_width_ca[PIXMAN_OP_CONJOINT_OUT_REVERSE] = fbCombineConjointOutReverseC;
+    imp->combine_width_ca[PIXMAN_OP_CONJOINT_ATOP] = fbCombineConjointAtopC;
+    imp->combine_width_ca[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = fbCombineConjointAtopReverseC;
+    imp->combine_width_ca[PIXMAN_OP_CONJOINT_XOR] = fbCombineConjointXorC;
+}
diff --git a/pixman/pixman-combine.h.template b/pixman/pixman-combine.h.template
new file mode 100644
index 0000000..6ecd301
--- /dev/null
+++ b/pixman/pixman-combine.h.template
@@ -0,0 +1,213 @@
+
+#define COMPONENT_SIZE
+#define MASK
+#define ONE_HALF
+
+#define A_SHIFT
+#define R_SHIFT
+#define G_SHIFT
+#define A_MASK
+#define R_MASK
+#define G_MASK
+
+#define RB_MASK
+#define AG_MASK
+#define RB_ONE_HALF
+#define RB_MASK_PLUS_ONE
+
+#define Alpha(x) ((x) >> A_SHIFT)
+
+/*
+ * Helper macros.
+ */
+
+#define IntMult(a,b,t) ( (t) = (a) * (b) + ONE_HALF, ( ( ( (t)>>G_SHIFT ) + (t) )>>G_SHIFT ) )
+#define IntDiv(a,b)    (((comp2_t) (a) * MASK) / (b))
+
+#define GetComp(v,i)   ((comp2_t) (comp1_t) ((v) >> i))
+
+#define Add(x,y,i,t)   ((t) = GetComp(x,i) + GetComp(y,i),              \
+                        (comp4_t) ((comp1_t) ((t) | (0 - ((t) >> G_SHIFT)))) << (i))
+
+#define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (IntMult(GetComp(y,i),ay,(u)) + \
+					 IntMult(GetComp(x,i),ax,(v))), \
+				  (comp4_t) ((comp1_t) ((t) |		\
+							 (0 - ((t) >> G_SHIFT)))) << (i))
+
+/*
+  The methods below use some tricks to be able to do two color
+  components at the same time.
+*/
+
+/*
+  x_c = (x_c * a) / 255
+*/
+#define FbByteMul(x, a) do {                                            \
+        comp4_t t = ((x & RB_MASK) * a) + RB_ONE_HALF;                  \
+        t = (t + ((t >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE;  \
+        t &= RB_MASK;                                                   \
+                                                                        \
+        x = (((x >> COMPONENT_SIZE) & RB_MASK) * a) + RB_ONE_HALF;      \
+        x = (x + ((x >> COMPONENT_SIZE) & RB_MASK));                    \
+        x &= RB_MASK << COMPONENT_SIZE;                                 \
+        x += t;                                                         \
+    } while (0)
+
+/*
+  x_c = (x_c * a) / 255 + y
+*/
+#define FbByteMulAdd(x, a, y) do {                                      \
+        /* multiply and divide: trunc((i + 128)*257/65536) */           \
+        comp4_t t = ((x & RB_MASK) * a) + RB_ONE_HALF;                  \
+        t = (t + ((t >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE;  \
+        t &= RB_MASK;                                                   \
+                                                                        \
+        /* add */                                                       \
+        t += y & RB_MASK;                                               \
+                                                                        \
+        /* saturate */                                                  \
+        t |= RB_MASK_PLUS_ONE - ((t >> COMPONENT_SIZE) & RB_MASK);      \
+        t &= RB_MASK;                                                   \
+                                                                        \
+        /* multiply and divide */                                       \
+        x = (((x >> COMPONENT_SIZE) & RB_MASK) * a) + RB_ONE_HALF;      \
+        x = (x + ((x >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE;  \
+        x &= RB_MASK;                                                   \
+                                                                        \
+        /* add */                                                       \
+        x += (y >> COMPONENT_SIZE) & RB_MASK;                           \
+                                                                        \
+        /* saturate */                                                  \
+        x |= RB_MASK_PLUS_ONE - ((x >> COMPONENT_SIZE) & RB_MASK);      \
+        x &= RB_MASK;                                                   \
+                                                                        \
+        /* recombine */                                                 \
+        x <<= COMPONENT_SIZE;                                           \
+        x += t;                                                         \
+    } while (0)
+
+/*
+  x_c = (x_c * a + y_c * b) / 255
+*/
+#define FbByteAddMul(x, a, y, b) do {                                   \
+        comp4_t t;                                                      \
+        comp4_t r = (x >> A_SHIFT) * a + (y >> A_SHIFT) * b + ONE_HALF; \
+        r += (r >> G_SHIFT);                                            \
+        r >>= G_SHIFT;                                                  \
+                                                                        \
+        t = (x & G_MASK) * a + (y & G_MASK) * b;                        \
+        t += (t >> G_SHIFT) + (ONE_HALF << G_SHIFT);                    \
+        t >>= R_SHIFT;                                                  \
+                                                                        \
+        t |= r << R_SHIFT;                                              \
+        t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK);             \
+        t &= RB_MASK;                                                   \
+        t <<= G_SHIFT;                                                  \
+                                                                        \
+        r = ((x >> R_SHIFT) & MASK) * a +                               \
+            ((y >> R_SHIFT) & MASK) * b + ONE_HALF;                     \
+        r += (r >> G_SHIFT);                                            \
+        r >>= G_SHIFT;                                                  \
+                                                                        \
+        x = (x & MASK) * a + (y & MASK) * b + ONE_HALF;                 \
+        x += (x >> G_SHIFT);                                            \
+        x >>= G_SHIFT;                                                  \
+        x |= r << R_SHIFT;                                              \
+        x |= RB_MASK_PLUS_ONE - ((x >> G_SHIFT) & RB_MASK);             \
+        x &= RB_MASK;                                                   \
+        x |= t;                                                         \
+    } while (0)
+
+/*
+  x_c = (x_c * a_c) / 255
+*/
+#define FbByteMulC(x, a) do {                                           \
+        comp4_t t;                                                      \
+        comp4_t r = (x & MASK) * (a & MASK);                            \
+        r |= (x & R_MASK) * ((a >> R_SHIFT) & MASK);                    \
+        r += RB_ONE_HALF;                                               \
+        r = (r + ((r >> G_SHIFT) & RB_MASK)) >> G_SHIFT;                \
+        r &= RB_MASK;                                                   \
+                                                                        \
+        x >>= G_SHIFT;                                                  \
+        t = (x & MASK) * ((a >> G_SHIFT) & MASK);                       \
+        t |= (x & R_MASK) * (a >> A_SHIFT);                             \
+        t += RB_ONE_HALF;                                               \
+        t = t + ((t >> G_SHIFT) & RB_MASK);                             \
+        x = r | (t & AG_MASK);                                          \
+    } while (0)
+
+/*
+  x_c = (x_c * a) / 255 + y
+*/
+#define FbByteMulAddC(x, a, y) do {                                     \
+        comp4_t t;                                                      \
+        comp4_t r = (x & MASK) * (a & MASK);                            \
+        r |= (x & R_MASK) * ((a >> R_SHIFT) & MASK);                    \
+        r += RB_ONE_HALF;                                               \
+        r = (r + ((r >> G_SHIFT) & RB_MASK)) >> G_SHIFT;                \
+        r &= RB_MASK;                                                   \
+        r += y & RB_MASK;                                               \
+        r |= RB_MASK_PLUS_ONE - ((r >> G_SHIFT) & RB_MASK);             \
+        r &= RB_MASK;                                                   \
+                                                                        \
+        x >>= G_SHIFT;                                                  \
+        t = (x & MASK) * ((a >> G_SHIFT) & MASK);                       \
+        t |= (x & R_MASK) * (a >> A_SHIFT);                             \
+        t += RB_ONE_HALF;                                               \
+        t = (t + ((t >> G_SHIFT) & RB_MASK)) >> G_SHIFT;                \
+        t &= RB_MASK;                                                   \
+        t += (y >> G_SHIFT) & RB_MASK;                                  \
+        t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK);             \
+        t &= RB_MASK;                                                   \
+        x = r | (t << G_SHIFT);                                         \
+    } while (0)
+
+/*
+  x_c = (x_c * a_c + y_c * b) / 255
+*/
+#define FbByteAddMulC(x, a, y, b) do {                                  \
+        comp4_t t;                                                      \
+        comp4_t r = (x >> A_SHIFT) * (a >> A_SHIFT) +                   \
+                     (y >> A_SHIFT) * b;                                \
+        r += (r >> G_SHIFT) + ONE_HALF;                                 \
+        r >>= G_SHIFT;                                                  \
+                                                                        \
+        t = (x & G_MASK) * ((a >> G_SHIFT) & MASK) + (y & G_MASK) * b;  \
+        t += (t >> G_SHIFT) + (ONE_HALF << G_SHIFT);                    \
+        t >>= R_SHIFT;                                                  \
+                                                                        \
+        t |= r << R_SHIFT;                                              \
+        t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK);             \
+        t &= RB_MASK;                                                   \
+        t <<= G_SHIFT;                                                  \
+                                                                        \
+        r = ((x >> R_SHIFT) & MASK) * ((a >> R_SHIFT) & MASK) +         \
+            ((y >> R_SHIFT) & MASK) * b + ONE_HALF;                     \
+        r += (r >> G_SHIFT);                                            \
+        r >>= G_SHIFT;                                                  \
+                                                                        \
+        x = (x & MASK) * (a & MASK) + (y & MASK) * b + ONE_HALF;        \
+        x += (x >> G_SHIFT);                                            \
+        x >>= G_SHIFT;                                                  \
+        x |= r << R_SHIFT;                                              \
+        x |= RB_MASK_PLUS_ONE - ((x >> G_SHIFT) & RB_MASK);             \
+        x &= RB_MASK;                                                   \
+        x |= t;                                                         \
+    } while (0)
+
+/*
+  x_c = min(x_c + y_c, 255)
+*/
+#define FbByteAdd(x, y) do {                                            \
+        comp4_t t;                                                      \
+        comp4_t r = (x & RB_MASK) + (y & RB_MASK);                      \
+        r |= RB_MASK_PLUS_ONE - ((r >> G_SHIFT) & RB_MASK);             \
+        r &= RB_MASK;                                                   \
+                                                                        \
+        t = ((x >> G_SHIFT) & RB_MASK) + ((y >> G_SHIFT) & RB_MASK);    \
+        t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK);             \
+        r |= (t & RB_MASK) << G_SHIFT;                                  \
+        x = r;                                                          \
+    } while (0)
+
commit d7234efc9a5d6a371692287555820fcd0f7ba48d
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sun Jun 21 09:44:22 2009 -0400

    Only use force_align_arg_pointer on gcc/x86-32

diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 47174d4..0709a3b 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -4949,9 +4949,10 @@ static const FastPathInfo sse2_fast_paths[] =
 /*
  * Work around GCC bug causing crashes in Mozilla with SSE2
  * 
- * When using SSE2 intrinsics, gcc assumes that the stack is 16 byte
- * aligned. Unfortunately some code, such as Mozilla and Mono contain
- * code that aligns the stack to 4 bytes.
+ * When using -msse, gcc generates movdqa instructions assuming that
+ * the stack is 16 byte aligned. Unfortunately some applications, such
+ * as Mozilla and Mono, end up aligning the stack to 4 bytes, which
+ * causes the movdqa instructions to fail.
  *
  * The __force_align_arg_pointer__ makes gcc generate a prologue that
  * realigns the stack pointer to 16 bytes.
@@ -4961,7 +4962,9 @@ static const FastPathInfo sse2_fast_paths[] =
  *
  * See https://bugs.freedesktop.org/show_bug.cgi?id=15693
  */
+#if defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
 __attribute__((__force_align_arg_pointer__))
+#endif
 static void
 sse2_composite (pixman_implementation_t *imp,
 		pixman_op_t     op,
@@ -4995,7 +4998,9 @@ sse2_composite (pixman_implementation_t *imp,
 				      width, height);
 }
 
+#if defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
 __attribute__((__force_align_arg_pointer__))
+#endif
 static pixman_bool_t
 sse2_blt (pixman_implementation_t *imp,
 	  uint32_t *src_bits,
@@ -5022,7 +5027,9 @@ sse2_blt (pixman_implementation_t *imp,
     return TRUE;
 }
 
+#if defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
 __attribute__((__force_align_arg_pointer__))
+#endif
 static pixman_bool_t
 sse2_fill (pixman_implementation_t *imp,
 	   uint32_t *bits,
commit 093112a1b720c3a74b28b7b4289feb16fbe4afd1
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sat Jun 20 20:28:36 2009 -0400

    Rename pixman-pict.c to pixman.c
    
    There are no traces of fbpict.c in it anymore.

diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index c75ff87..46bfcf8 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -18,7 +18,7 @@ libpixman_1_la_SOURCES =			\
 	pixman-combine64.c			\
 	pixman-combine64.h			\
 	pixman-general.c			\
-	pixman-pict.c				\
+	pixman.c				\
 	pixman-fast-path.c			\
 	pixman-solid-fill.c			\
 	pixman-conical-gradient.c		\
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
deleted file mode 100644
index 17bd566..0000000
--- a/pixman/pixman-pict.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/* -*- Mode: c; c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t; -*- */
-/*
- * Copyright © 2000 SuSE, Inc.
- * Copyright © 2007 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  SuSE makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author:  Keith Packard, SuSE, Inc.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "pixman-private.h"
-
-/*
- * Operator optimizations based on source or destination opacity
- */
-typedef struct
-{
-    pixman_op_t			op;
-    pixman_op_t			opSrcDstOpaque;
-    pixman_op_t			opSrcOpaque;
-    pixman_op_t			opDstOpaque;
-} OptimizedOperatorInfo;
-
-static const OptimizedOperatorInfo optimized_operators[] =
-{
-    /* Input Operator           SRC&DST Opaque          SRC Opaque              DST Opaque      */
-    { PIXMAN_OP_OVER,           PIXMAN_OP_SRC,          PIXMAN_OP_SRC,          PIXMAN_OP_OVER },
-    { PIXMAN_OP_OVER_REVERSE,   PIXMAN_OP_DST,          PIXMAN_OP_OVER_REVERSE, PIXMAN_OP_DST },
-    { PIXMAN_OP_IN,             PIXMAN_OP_SRC,          PIXMAN_OP_IN,           PIXMAN_OP_SRC },
-    { PIXMAN_OP_IN_REVERSE,     PIXMAN_OP_DST,          PIXMAN_OP_DST,          PIXMAN_OP_IN_REVERSE },
-    { PIXMAN_OP_OUT,            PIXMAN_OP_CLEAR,        PIXMAN_OP_OUT,          PIXMAN_OP_CLEAR },
-    { PIXMAN_OP_OUT_REVERSE,    PIXMAN_OP_CLEAR,        PIXMAN_OP_CLEAR,        PIXMAN_OP_OUT_REVERSE },
-    { PIXMAN_OP_ATOP,           PIXMAN_OP_SRC,          PIXMAN_OP_IN,           PIXMAN_OP_OVER },
-    { PIXMAN_OP_ATOP_REVERSE,   PIXMAN_OP_DST,          PIXMAN_OP_OVER_REVERSE, PIXMAN_OP_IN_REVERSE },
-    { PIXMAN_OP_XOR,            PIXMAN_OP_CLEAR,        PIXMAN_OP_OUT,          PIXMAN_OP_OUT_REVERSE },
-    { PIXMAN_OP_SATURATE,       PIXMAN_OP_DST,          PIXMAN_OP_OVER_REVERSE, PIXMAN_OP_DST },
-    { PIXMAN_OP_NONE }
-};
-
-/*
- * Check if the current operator could be optimized
- */
-static const OptimizedOperatorInfo*
-pixman_operator_can_be_optimized(pixman_op_t op)
-{
-    const OptimizedOperatorInfo *info;
-
-    for (info = optimized_operators; info->op != PIXMAN_OP_NONE; info++)
-    {
-        if(info->op == op)
-            return info;
-    }
-    return NULL;
-}
-
-/*
- * Optimize the current operator based on opacity of source or destination
- * The output operator should be mathematically equivalent to the source.
- */
-static pixman_op_t
-pixman_optimize_operator(pixman_op_t op, pixman_image_t *pSrc, pixman_image_t *pMask, pixman_image_t *pDst )
-{
-    pixman_bool_t is_source_opaque;
-    pixman_bool_t is_dest_opaque;
-    const OptimizedOperatorInfo *info = pixman_operator_can_be_optimized(op);
-
-    if(!info || pMask)
-        return op;
-
-    is_source_opaque = pixman_image_is_opaque(pSrc);
-    is_dest_opaque = pixman_image_is_opaque(pDst);
-
-    if(is_source_opaque == FALSE && is_dest_opaque == FALSE)
-        return op;
-
-    if(is_source_opaque && is_dest_opaque)
-        return info->opSrcDstOpaque;
-    else if(is_source_opaque)
-        return info->opSrcOpaque;
-    else if(is_dest_opaque)
-        return info->opDstOpaque;
-
-    return op;
-
-}
-
-static pixman_implementation_t *imp;
-
-PIXMAN_EXPORT void
-pixman_image_composite (pixman_op_t      op,
-			pixman_image_t * src,
-			pixman_image_t * mask,
-			pixman_image_t * dest,
-			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)
-{
-    /*
-     * Check if we can replace our operator by a simpler one if the src or dest are opaque
-     * The output operator should be mathematically equivalent to the source.
-     */
-    op = pixman_optimize_operator(op, src, mask, dest);
-    if(op == PIXMAN_OP_DST)
-        return;
-
-    if (!imp)
-	imp = _pixman_choose_implementation();
-
-    _pixman_implementation_composite (imp, op,
-				      src, mask, dest,
-				      src_x, src_y,
-				      mask_x, mask_y,
-				      dest_x, dest_y,
-				      width, height);
-}
-
-PIXMAN_EXPORT pixman_bool_t
-pixman_blt (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)
-{
-    if (!imp)
-	imp = _pixman_choose_implementation();
-    
-    return _pixman_implementation_blt (imp, src_bits, dst_bits, src_stride, dst_stride,
-				       src_bpp, dst_bpp,
-				       src_x, src_y,
-				       dst_x, dst_y,
-				       width, height);
-}
-
-PIXMAN_EXPORT pixman_bool_t
-pixman_fill (uint32_t *bits,
-	     int stride,
-	     int bpp,
-	     int x,
-	     int y,
-	     int width,
-	     int height,
-	     uint32_t xor)
-{
-    if (!imp)
-	imp = _pixman_choose_implementation();
-
-    return _pixman_implementation_fill (imp, bits, stride, bpp, x, y, width, height, xor);
-}
diff --git a/pixman/pixman.c b/pixman/pixman.c
new file mode 100644
index 0000000..17bd566
--- /dev/null
+++ b/pixman/pixman.c
@@ -0,0 +1,175 @@
+/* -*- Mode: c; c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t; -*- */
+/*
+ * Copyright © 2000 SuSE, Inc.
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  SuSE makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author:  Keith Packard, SuSE, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "pixman-private.h"
+
+/*
+ * Operator optimizations based on source or destination opacity
+ */
+typedef struct
+{
+    pixman_op_t			op;
+    pixman_op_t			opSrcDstOpaque;
+    pixman_op_t			opSrcOpaque;
+    pixman_op_t			opDstOpaque;
+} OptimizedOperatorInfo;
+
+static const OptimizedOperatorInfo optimized_operators[] =
+{
+    /* Input Operator           SRC&DST Opaque          SRC Opaque              DST Opaque      */
+    { PIXMAN_OP_OVER,           PIXMAN_OP_SRC,          PIXMAN_OP_SRC,          PIXMAN_OP_OVER },
+    { PIXMAN_OP_OVER_REVERSE,   PIXMAN_OP_DST,          PIXMAN_OP_OVER_REVERSE, PIXMAN_OP_DST },
+    { PIXMAN_OP_IN,             PIXMAN_OP_SRC,          PIXMAN_OP_IN,           PIXMAN_OP_SRC },
+    { PIXMAN_OP_IN_REVERSE,     PIXMAN_OP_DST,          PIXMAN_OP_DST,          PIXMAN_OP_IN_REVERSE },
+    { PIXMAN_OP_OUT,            PIXMAN_OP_CLEAR,        PIXMAN_OP_OUT,          PIXMAN_OP_CLEAR },
+    { PIXMAN_OP_OUT_REVERSE,    PIXMAN_OP_CLEAR,        PIXMAN_OP_CLEAR,        PIXMAN_OP_OUT_REVERSE },
+    { PIXMAN_OP_ATOP,           PIXMAN_OP_SRC,          PIXMAN_OP_IN,           PIXMAN_OP_OVER },
+    { PIXMAN_OP_ATOP_REVERSE,   PIXMAN_OP_DST,          PIXMAN_OP_OVER_REVERSE, PIXMAN_OP_IN_REVERSE },
+    { PIXMAN_OP_XOR,            PIXMAN_OP_CLEAR,        PIXMAN_OP_OUT,          PIXMAN_OP_OUT_REVERSE },
+    { PIXMAN_OP_SATURATE,       PIXMAN_OP_DST,          PIXMAN_OP_OVER_REVERSE, PIXMAN_OP_DST },
+    { PIXMAN_OP_NONE }
+};
+
+/*
+ * Check if the current operator could be optimized
+ */
+static const OptimizedOperatorInfo*
+pixman_operator_can_be_optimized(pixman_op_t op)
+{
+    const OptimizedOperatorInfo *info;
+
+    for (info = optimized_operators; info->op != PIXMAN_OP_NONE; info++)
+    {
+        if(info->op == op)
+            return info;
+    }
+    return NULL;
+}
+
+/*
+ * Optimize the current operator based on opacity of source or destination
+ * The output operator should be mathematically equivalent to the source.
+ */
+static pixman_op_t
+pixman_optimize_operator(pixman_op_t op, pixman_image_t *pSrc, pixman_image_t *pMask, pixman_image_t *pDst )
+{
+    pixman_bool_t is_source_opaque;
+    pixman_bool_t is_dest_opaque;
+    const OptimizedOperatorInfo *info = pixman_operator_can_be_optimized(op);
+
+    if(!info || pMask)
+        return op;
+
+    is_source_opaque = pixman_image_is_opaque(pSrc);
+    is_dest_opaque = pixman_image_is_opaque(pDst);
+
+    if(is_source_opaque == FALSE && is_dest_opaque == FALSE)
+        return op;
+
+    if(is_source_opaque && is_dest_opaque)
+        return info->opSrcDstOpaque;
+    else if(is_source_opaque)
+        return info->opSrcOpaque;
+    else if(is_dest_opaque)
+        return info->opDstOpaque;
+
+    return op;
+
+}
+
+static pixman_implementation_t *imp;
+
+PIXMAN_EXPORT void
+pixman_image_composite (pixman_op_t      op,
+			pixman_image_t * src,
+			pixman_image_t * mask,
+			pixman_image_t * dest,
+			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)
+{
+    /*
+     * Check if we can replace our operator by a simpler one if the src or dest are opaque
+     * The output operator should be mathematically equivalent to the source.
+     */
+    op = pixman_optimize_operator(op, src, mask, dest);
+    if(op == PIXMAN_OP_DST)
+        return;
+
+    if (!imp)
+	imp = _pixman_choose_implementation();
+
+    _pixman_implementation_composite (imp, op,
+				      src, mask, dest,
+				      src_x, src_y,
+				      mask_x, mask_y,
+				      dest_x, dest_y,
+				      width, height);
+}
+
+PIXMAN_EXPORT pixman_bool_t
+pixman_blt (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)
+{
+    if (!imp)
+	imp = _pixman_choose_implementation();
+    
+    return _pixman_implementation_blt (imp, src_bits, dst_bits, src_stride, dst_stride,
+				       src_bpp, dst_bpp,
+				       src_x, src_y,
+				       dst_x, dst_y,
+				       width, height);
+}
+
+PIXMAN_EXPORT pixman_bool_t
+pixman_fill (uint32_t *bits,
+	     int stride,
+	     int bpp,
+	     int x,
+	     int y,
+	     int width,
+	     int height,
+	     uint32_t xor)
+{
+    if (!imp)
+	imp = _pixman_choose_implementation();
+
+    return _pixman_implementation_fill (imp, bits, stride, bpp, x, y, width, height, xor);
+}


More information about the xorg-commit mailing list