pixman: Branch 'master' - 5 commits

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Tue May 27 11:38:10 PDT 2008


 pixman/combine.inc          |    2 
 pixman/pixman-access.c      |   10 +++-
 pixman/pixman-compose.c     |   92 +++++++++++++++++++++++++++++++-------------
 pixman/pixman-image.c       |    4 +
 pixman/pixman-pict.c        |   17 --------
 pixman/pixman-private.h     |   52 ++++++++++++++----------
 pixman/pixman-transformed.c |   49 ++++++++++++-----------
 7 files changed, 136 insertions(+), 90 deletions(-)

New commits:
commit 9a6d3a1dcf89fc04f71a9dfed1aeeda1e3fb83bc
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Fri May 2 17:33:17 2008 -0700

    Fix wide alpha fetch macro.
    
    Signed-off-by: Soren Sandmann Pedersen <sandmann at redhat.com>

diff --git a/pixman/combine.inc b/pixman/combine.inc
index c3a57eb..63a3fe1 100644
--- a/pixman/combine.inc
+++ b/pixman/combine.inc
@@ -6,6 +6,8 @@
 
 #include "pixman-private.h"
 
+#define Alpha(x) ((x) >> A_SHIFT)
+
 /*
  * Helper macros.
  */
diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 4a11bc0..29b846c 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -31,6 +31,10 @@
 
 #include "pixman-private.h"
 
+#define Red(x) (((x) >> 16) & 0xff)
+#define Green(x) (((x) >> 8) & 0xff)
+#define Blue(x) ((x) & 0xff)
+
 /*
  * YV12 setup and access macros
  */
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 30c294b..f34053c 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -30,6 +30,8 @@
 
 #include "pixman-private.h"
 
+#define Alpha(x) ((x) >> 24)
+
 static void
 init_source_image (source_image_t *image)
 {
@@ -800,4 +802,4 @@ pixman_image_is_opaque(pixman_image_t *image)
     }
 
      return TRUE;
-}
\ No newline at end of file
+}
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 8792027..4a6e045 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -419,11 +419,6 @@ union pixman_image
      WRITE(img, (a)+2, (uint8_t) ((v) >> 16))))
 #endif
 
-#define Alpha(x) ((x) >> 24)
-#define Red(x) (((x) >> 16) & 0xff)
-#define Green(x) (((x) >> 8) & 0xff)
-#define Blue(x) ((x) & 0xff)
-
 #define CvtR8G8B8toY15(s)       (((((s) >> 16) & 0xff) * 153 + \
                                   (((s) >>  8) & 0xff) * 301 +		\
                                   (((s)      ) & 0xff) * 58) >> 2)
diff --git a/pixman/pixman-transformed.c b/pixman/pixman-transformed.c
index 3f176d6..569fcae 100644
--- a/pixman/pixman-transformed.c
+++ b/pixman/pixman-transformed.c
@@ -31,6 +31,11 @@
 
 #include "pixman-private.h"
 
+#define Alpha(x) ((x) >> 24)
+#define Red(x) (((x) >> 16) & 0xff)
+#define Green(x) (((x) >> 8) & 0xff)
+#define Blue(x) ((x) & 0xff)
+
 /*
  * Fetch from region strategies
  */
commit 86ed05b0f93505c136fb279fa4529596fc7c682a
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Wed Apr 23 17:30:14 2008 -0700

    Use wide compositing functions when wide == 1.
    
    Signed-off-by: Soren Sandmann Pedersen <sandmann at redhat.com>

diff --git a/pixman/pixman-compose.c b/pixman/pixman-compose.c
index 7daa45b..616fbc4 100644
--- a/pixman/pixman-compose.c
+++ b/pixman/pixman-compose.c
@@ -281,7 +281,9 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
 	data->mask->common.component_alpha &&
 	PIXMAN_FORMAT_RGB (data->mask->bits.format))
     {
-	CombineFuncC32 compose = pixman_composeFunctions.combineC[data->op];
+	CombineFuncC32 compose =
+	    wide ? (CombineFuncC32)pixman_composeFunctions64.combineC[data->op] :
+		   pixman_composeFunctions.combineC[data->op];
 	if (!compose)
 	    return;
 
@@ -346,7 +348,9 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
     {
 	void *src_mask_buffer = 0;
 	const int useMask = (fetchMask != NULL);
-	CombineFuncU32 compose = pixman_composeFunctions.combineU[data->op];
+	CombineFuncU32 compose =
+	    wide ? (CombineFuncU32)pixman_composeFunctions64.combineU[data->op] :
+		   pixman_composeFunctions.combineU[data->op];
 	if (!compose)
 	    return;
 
@@ -372,7 +376,11 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
 
 		    if (useMask)
 		    {
-			pixman_composeFunctions.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width);
+			if (wide)
+			    pixman_composeFunctions64.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width);
+			else
+			    pixman_composeFunctions.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width);
+
 			src_mask_buffer = mask_buffer;
 		    }
 		    else
@@ -386,10 +394,16 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
 			      data->width, src_buffer,
 			      useMask ? mask_buffer : NULL, 0xff000000);
 
-		    if (useMask)
-			pixman_composeFunctions.combineMaskU (src_buffer,
-							      mask_buffer,
-							      data->width);
+		    if (useMask) {
+			if (wide)
+			    pixman_composeFunctions64.combineMaskU (src_buffer,
+								    mask_buffer,
+								    data->width);
+			else
+			    pixman_composeFunctions.combineMaskU (src_buffer,
+								  mask_buffer,
+								  data->width);
+		    }
 
 		    src_mask_buffer = src_buffer;
 		}
@@ -399,7 +413,10 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
 		fetchMask (data->mask, data->xMask, data->yMask + i,
 			   data->width, mask_buffer, 0, 0);
 
-		pixman_composeFunctions.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width);
+		if (wide)
+		    pixman_composeFunctions64.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width);
+		else
+		    pixman_composeFunctions.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width);
 
 		src_mask_buffer = mask_buffer;
 	    }
commit 4e2d2546b79354a1accff8614d50eb8f75a15c98
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Tue Apr 15 13:58:27 2008 -0700

    Add infrastructure for allocating wide scanline buffers. Not yet used.
    
    Signed-off-by: Soren Sandmann Pedersen <sandmann at redhat.com>

diff --git a/pixman/pixman-compose.c b/pixman/pixman-compose.c
index 7230e08..7daa45b 100644
--- a/pixman/pixman-compose.c
+++ b/pixman/pixman-compose.c
@@ -145,7 +145,7 @@ static
 void
 PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
 			       void *src_buffer, void *mask_buffer, 
-			       void *dest_buffer)
+			       void *dest_buffer, const int wide)
 {
     int i;
     scanStoreProc store;
@@ -437,20 +437,22 @@ void
 pixman_composite_rect_general (const FbComposeData *data)
 {
     uint32_t _scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
-    uint32_t *scanline_buffer = _scanline_buffer;
-    uint32_t *src_buffer, *mask_buffer, *dest_buffer;
+    const int wide = 0;
+    const int Bpp = wide ? 8 : 4;
+    uint8_t *scanline_buffer = (uint8_t*)_scanline_buffer;
+    uint8_t *src_buffer, *mask_buffer, *dest_buffer;
 
-    if (data->width > SCANLINE_BUFFER_LENGTH)
+    if (data->width * Bpp > SCANLINE_BUFFER_LENGTH * sizeof(uint32_t))
     {
-	scanline_buffer = (uint32_t *)pixman_malloc_abc (data->width, 3, sizeof (uint32_t));
+	scanline_buffer = pixman_malloc_abc (data->width, 3, Bpp);
 
 	if (!scanline_buffer)
 	    return;
     }
 
     src_buffer = scanline_buffer;
-    mask_buffer = src_buffer + data->width;
-    dest_buffer = mask_buffer + data->width;
+    mask_buffer = src_buffer + data->width * Bpp;
+    dest_buffer = mask_buffer + data->width * Bpp;
 
     if (data->src->common.read_func			||
 	data->src->common.write_func			||
@@ -460,15 +462,16 @@ pixman_composite_rect_general (const FbComposeData *data)
 	data->dest->common.write_func)
     {
 	pixman_composite_rect_general_accessors (data, src_buffer, mask_buffer,
-						 dest_buffer);
+						 dest_buffer, wide);
     }
     else
     {
 	pixman_composite_rect_general_no_accessors (data, src_buffer,
-						    mask_buffer, dest_buffer);
+						    mask_buffer, dest_buffer,
+						    wide);
     }
 
-    if (scanline_buffer != _scanline_buffer)
+    if ((void*)scanline_buffer != (void*)_scanline_buffer)
 	free (scanline_buffer);
 }
 
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 588e23c..8792027 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -196,7 +196,8 @@ extern FbComposeFunctions64 pixman_composeFunctions64;
 void pixman_composite_rect_general_accessors (const FbComposeData *data,
                                               void *src_buffer,
                                               void *mask_buffer,
-                                              void *dest_buffer);
+                                              void *dest_buffer,
+                                              const int wide);
 void pixman_composite_rect_general (const FbComposeData *data);
 
 fetchProc32 pixman_fetchProcForPicture32 (bits_image_t *);
commit 598334a15723dc3857d1e932c17365a1f8c5f094
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Tue Apr 15 13:13:46 2008 -0700

    Split fetch/fetchPixel/store proc types into 32-bit and 64-bit versions.
    
    Signed-off-by: Soren Sandmann Pedersen <sandmann at redhat.com>

diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 5d91fca..4a11bc0 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -633,7 +633,7 @@ fbFetch_yv12 (bits_image_t *pict, int x, int line, int width, uint32_t *buffer)
     }
 }
 
-fetchProc ACCESS(pixman_fetchProcForPicture) (bits_image_t * pict)
+fetchProc32 ACCESS(pixman_fetchProcForPicture32) (bits_image_t * pict)
 {
     switch(pict->format) {
     case PIXMAN_a8r8g8b8: return fbFetch_a8r8g8b8;
@@ -1144,7 +1144,7 @@ fbFetchPixel_yv12 (bits_image_t *pict, int offset, int line)
 	(b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
 }
 
-fetchPixelProc ACCESS(pixman_fetchPixelProcForPicture) (bits_image_t * pict)
+fetchPixelProc32 ACCESS(pixman_fetchPixelProcForPicture32) (bits_image_t * pict)
 {
     switch(pict->format) {
     case PIXMAN_a8r8g8b8: return fbFetchPixel_a8r8g8b8;
@@ -1624,7 +1624,7 @@ fbStore_g1 (pixman_image_t *image,
 }
 
 
-storeProc ACCESS(pixman_storeProcForPicture) (bits_image_t * pict)
+storeProc32 ACCESS(pixman_storeProcForPicture32) (bits_image_t * pict)
 {
     switch(pict->format) {
     case PIXMAN_a8r8g8b8: return fbStore_a8r8g8b8;
diff --git a/pixman/pixman-compose.c b/pixman/pixman-compose.c
index de2378a..7230e08 100644
--- a/pixman/pixman-compose.c
+++ b/pixman/pixman-compose.c
@@ -105,7 +105,7 @@ static void fbFetchSolid(bits_image_t * pict, int x, int y, int width, uint32_t
 {
     uint32_t color;
     uint32_t *end;
-    fetchPixelProc fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
+    fetchPixelProc32 fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
 
     color = fetch(pict, 0, 0);
 
@@ -116,7 +116,7 @@ static void fbFetchSolid(bits_image_t * pict, int x, int y, int width, uint32_t
 
 static void fbFetch(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
 {
-    fetchProc fetch = ACCESS(pixman_fetchProcForPicture)(pict);
+    fetchProc32 fetch = ACCESS(pixman_fetchProcForPicture32)(pict);
 
     fetch(pict, x, y, width, buffer);
 }
@@ -126,7 +126,7 @@ fbStore(bits_image_t * pict, int x, int y, int width, uint32_t *buffer)
 {
     uint32_t *bits;
     int32_t stride;
-    storeProc store = ACCESS(pixman_storeProcForPicture)(pict);
+    storeProc32 store = ACCESS(pixman_storeProcForPicture32)(pict);
     const pixman_indexed_t * indexed = pict->indexed;
 
     bits = pict->bits;
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 96f6c21..588e23c 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -146,16 +146,22 @@ typedef struct point point_t;
 typedef FASTCALL void (*CombineMaskU32) (uint32_t *src, const uint32_t *mask, int width);
 typedef FASTCALL void (*CombineFuncU32) (uint32_t *dest, const uint32_t *src, int width);
 typedef FASTCALL void (*CombineFuncC32) (uint32_t *dest, uint32_t *src, uint32_t *mask, int width);
-typedef FASTCALL void (*fetchProc)(bits_image_t *pict, int x, int y, int width,
-                                   uint32_t *buffer);
-typedef FASTCALL uint32_t (*fetchPixelProc)(bits_image_t *pict, int offset, int line);
-typedef FASTCALL void (*storeProc)(pixman_image_t *, uint32_t *bits,
-                                   const uint32_t *values, int x, int width,
-                                   const pixman_indexed_t *);
+typedef FASTCALL void (*fetchProc32)(bits_image_t *pict, int x, int y, int width,
+                                     uint32_t *buffer);
+typedef FASTCALL uint32_t (*fetchPixelProc32)(bits_image_t *pict, int offset, int line);
+typedef FASTCALL void (*storeProc32)(pixman_image_t *, uint32_t *bits,
+                                     const uint32_t *values, int x, int width,
+                                     const pixman_indexed_t *);
 
 typedef FASTCALL void (*CombineMaskU64) (uint64_t *src, const uint64_t *mask, int width);
 typedef FASTCALL void (*CombineFuncU64) (uint64_t *dest, const uint64_t *src, int width);
 typedef FASTCALL void (*CombineFuncC64) (uint64_t *dest, uint64_t *src, uint64_t *mask, int width);
+typedef FASTCALL void (*fetchProc64)(bits_image_t *pict, int x, int y, int width,
+                                     uint64_t *buffer);
+typedef FASTCALL uint64_t (*fetchPixelProc64)(bits_image_t *pict, int offset, int line);
+typedef FASTCALL void (*storeProc64)(pixman_image_t *, uint32_t *bits,
+                                     const uint64_t *values, int x, int width,
+                                     const pixman_indexed_t *);
 
 typedef struct _FbComposeData {
     uint8_t	 op;
@@ -193,12 +199,19 @@ void pixman_composite_rect_general_accessors (const FbComposeData *data,
                                               void *dest_buffer);
 void pixman_composite_rect_general (const FbComposeData *data);
 
-fetchProc pixman_fetchProcForPicture (bits_image_t *);
-fetchPixelProc pixman_fetchPixelProcForPicture (bits_image_t *);
-storeProc pixman_storeProcForPicture (bits_image_t *);
-fetchProc pixman_fetchProcForPicture_accessors (bits_image_t *);
-fetchPixelProc pixman_fetchPixelProcForPicture_accessors (bits_image_t *);
-storeProc pixman_storeProcForPicture_accessors (bits_image_t *);
+fetchProc32 pixman_fetchProcForPicture32 (bits_image_t *);
+fetchPixelProc32 pixman_fetchPixelProcForPicture32 (bits_image_t *);
+storeProc32 pixman_storeProcForPicture32 (bits_image_t *);
+fetchProc32 pixman_fetchProcForPicture32_accessors (bits_image_t *);
+fetchPixelProc32 pixman_fetchPixelProcForPicture32_accessors (bits_image_t *);
+storeProc32 pixman_storeProcForPicture32_accessors (bits_image_t *);
+
+fetchProc64 pixman_fetchProcForPicture64 (bits_image_t *);
+fetchPixelProc64 pixman_fetchPixelProcForPicture64 (bits_image_t *);
+storeProc64 pixman_storeProcForPicture64 (bits_image_t *);
+fetchProc64 pixman_fetchProcForPicture64_accessors (bits_image_t *);
+fetchPixelProc64 pixman_fetchPixelProcForPicture64_accessors (bits_image_t *);
+storeProc64 pixman_storeProcForPicture64_accessors (bits_image_t *);
 
 void pixmanFetchSourcePict(source_image_t *, int x, int y, int width,
                            uint32_t *buffer, uint32_t *mask, uint32_t maskBits);
diff --git a/pixman/pixman-transformed.c b/pixman/pixman-transformed.c
index e3ef17e..3f176d6 100644
--- a/pixman/pixman-transformed.c
+++ b/pixman/pixman-transformed.c
@@ -34,16 +34,16 @@
 /*
  * Fetch from region strategies
  */
-typedef FASTCALL uint32_t (*fetchFromRegionProc)(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc fetch, pixman_box16_t *box);
+typedef FASTCALL uint32_t (*fetchFromRegionProc)(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box16_t *box);
 
 static inline uint32_t
-fbFetchFromNoRegion(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc fetch, pixman_box16_t *box)
+fbFetchFromNoRegion(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box16_t *box)
 {
     return fetch (pict, x, y);
 }
 
 static uint32_t
-fbFetchFromNRectangles(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc fetch, pixman_box16_t *box)
+fbFetchFromNRectangles(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box16_t *box)
 {
     pixman_box16_t box2;
     if (pixman_region_contains_point (pict->common.src_clip, x, y, &box2))
@@ -53,7 +53,7 @@ fbFetchFromNRectangles(bits_image_t *pict, int x, int y, uint32_t *buffer, fetch
 }
 
 static uint32_t
-fbFetchFromOneRectangle(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc fetch, pixman_box16_t *box)
+fbFetchFromOneRectangle(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box16_t *box)
 {
     pixman_box16_t box2 = *box;
     return ((x < box2.x1) | (x >= box2.x2) | (y < box2.y1) | (y >= box2.y2)) ?
@@ -67,12 +67,12 @@ static void
 fbFetchTransformed_Nearest_Normal(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
 {
     pixman_box16_t* box = NULL;
-    fetchPixelProc   fetch;
+    fetchPixelProc32   fetch;
     fetchFromRegionProc fetchFromRegion;
     int x, y, i;
 
     /* initialize the two function pointers */
-    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
 
     if(pixman_region_n_rects (pict->common.src_clip) == 1)
         fetchFromRegion = fbFetchFromNoRegion;
@@ -113,12 +113,12 @@ static void
 fbFetchTransformed_Nearest_Pad(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
 {
     pixman_box16_t *box = NULL;
-    fetchPixelProc   fetch;
+    fetchPixelProc32   fetch;
     fetchFromRegionProc fetchFromRegion;
     int x, y, i;
 
     /* initialize the two function pointers */
-    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
 
     if(pixman_region_n_rects (pict->common.src_clip) == 1)
         fetchFromRegion = fbFetchFromNoRegion;
@@ -160,12 +160,12 @@ static void
 fbFetchTransformed_Nearest_General(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
 {
     pixman_box16_t *box = NULL;
-    fetchPixelProc   fetch;
+    fetchPixelProc32   fetch;
     fetchFromRegionProc fetchFromRegion;
     int x, y, i;
 
     /* initialize the two function pointers */
-    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
 
     if(pixman_region_n_rects (pict->common.src_clip) == 1)
     {
@@ -203,12 +203,12 @@ static void
 fbFetchTransformed_Bilinear_Normal(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
 {
     pixman_box16_t *box = NULL;
-    fetchPixelProc   fetch;
+    fetchPixelProc32   fetch;
     fetchFromRegionProc fetchFromRegion;
     int i;
 
     /* initialize the two function pointers */
-    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
 
     if(pixman_region_n_rects (pict->common.src_clip) == 1)
         fetchFromRegion = fbFetchFromNoRegion;
@@ -280,12 +280,12 @@ static void
 fbFetchTransformed_Bilinear_Pad(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
 {
     pixman_box16_t *box = NULL;
-    fetchPixelProc   fetch;
+    fetchPixelProc32   fetch;
     fetchFromRegionProc fetchFromRegion;
     int i;
 
     /* initialize the two function pointers */
-    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
 
     if(pixman_region_n_rects (pict->common.src_clip) == 1)
         fetchFromRegion = fbFetchFromNoRegion;
@@ -357,12 +357,12 @@ static void
 fbFetchTransformed_Bilinear_General(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
 {
     pixman_box16_t *box = NULL;
-    fetchPixelProc   fetch;
+    fetchPixelProc32   fetch;
     fetchFromRegionProc fetchFromRegion;
     int i;
 
     /* initialize the two function pointers */
-    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
 
     if(pixman_region_n_rects (pict->common.src_clip) == 1)
     {
@@ -436,7 +436,7 @@ static void
 fbFetchTransformed_Convolution(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
 {
     pixman_box16_t dummy;
-    fetchPixelProc fetch;
+    fetchPixelProc32 fetch;
     int i;
 
     pixman_fixed_t *params = pict->common.filter_params;
@@ -444,7 +444,7 @@ fbFetchTransformed_Convolution(bits_image_t * pict, int width, uint32_t *buffer,
     int32_t cheight = pixman_fixed_to_int(params[1]);
     int xoff = (params[0] - pixman_fixed_1) >> 1;
     int yoff = (params[1] - pixman_fixed_1) >> 1;
-    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
 
     params += 2;
     for (i = 0; i < width; ++i) {
@@ -671,8 +671,8 @@ ACCESS(fbStoreExternalAlpha)(bits_image_t * pict, int x, int y, int width,
     uint32_t *bits, *alpha_bits;
     int32_t stride, astride;
     int ax, ay;
-    storeProc store;
-    storeProc astore;
+    storeProc32 store;
+    storeProc32 astore;
     const pixman_indexed_t * indexed = pict->indexed;
     const pixman_indexed_t * aindexed;
 
@@ -683,8 +683,8 @@ ACCESS(fbStoreExternalAlpha)(bits_image_t * pict, int x, int y, int width,
 	return;
     }
 
-    store = ACCESS(pixman_storeProcForPicture)(pict);
-    astore = ACCESS(pixman_storeProcForPicture)(pict->common.alpha_map);
+    store = ACCESS(pixman_storeProcForPicture32)(pict);
+    astore = ACCESS(pixman_storeProcForPicture32)(pict->common.alpha_map);
     aindexed = pict->common.alpha_map->indexed;
 
     ax = x;
commit 4a7e1676fd381bda53ece2f13204fbe568e07b0d
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Fri Apr 4 14:43:48 2008 -0700

    Move the scanline buffer allocation logic into pixman_composite_rect_general.
    
    Pass the src, mask, and dest buffers into pixman_composite_rect_general_* as
    void* pointers since those functions should not do pointer arithmetic.
    
    Signed-off-by: Soren Sandmann Pedersen <sandmann at redhat.com>

diff --git a/pixman/pixman-compose.c b/pixman/pixman-compose.c
index 09225c7..de2378a 100644
--- a/pixman/pixman-compose.c
+++ b/pixman/pixman-compose.c
@@ -144,10 +144,9 @@ static
 #endif
 void
 PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
-			       uint32_t *scanline_buffer)
+			       void *src_buffer, void *mask_buffer, 
+			       void *dest_buffer)
 {
-    uint32_t *src_buffer = scanline_buffer;
-    uint32_t *dest_buffer = src_buffer + data->width;
     int i;
     scanStoreProc store;
     scanFetchProc fetchSrc = NULL, fetchMask = NULL, fetchDest = NULL;
@@ -282,7 +281,6 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
 	data->mask->common.component_alpha &&
 	PIXMAN_FORMAT_RGB (data->mask->bits.format))
     {
-	uint32_t *mask_buffer = dest_buffer + data->width;
 	CombineFuncC32 compose = pixman_composeFunctions.combineC[data->op];
 	if (!compose)
 	    return;
@@ -346,14 +344,12 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
     }
     else
     {
-	uint32_t *src_mask_buffer = 0, *mask_buffer = 0;
+	void *src_mask_buffer = 0;
+	const int useMask = (fetchMask != NULL);
 	CombineFuncU32 compose = pixman_composeFunctions.combineU[data->op];
 	if (!compose)
 	    return;
 
-	if (fetchMask)
-	    mask_buffer = dest_buffer + data->width;
-
 	for (i = 0; i < data->height; ++i) {
 	    /* fill first half of scanline with source */
 	    if (fetchSrc)
@@ -374,7 +370,7 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
 		    fetchSrc (data->src, data->xSrc, data->ySrc + i,
 			      data->width, src_buffer, 0, 0);
 
-		    if (mask_buffer)
+		    if (useMask)
 		    {
 			pixman_composeFunctions.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width);
 			src_mask_buffer = mask_buffer;
@@ -387,10 +383,10 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
 		else
 		{
 		    fetchSrc (data->src, data->xSrc, data->ySrc + i,
-			      data->width, src_buffer, mask_buffer,
-			      0xff000000);
+			      data->width, src_buffer,
+			      useMask ? mask_buffer : NULL, 0xff000000);
 
-		    if (mask_buffer)
+		    if (useMask)
 			pixman_composeFunctions.combineMaskU (src_buffer,
 							      mask_buffer,
 							      data->width);
@@ -435,10 +431,27 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
 
 #ifndef PIXMAN_FB_ACCESSORS
 
+#define SCANLINE_BUFFER_LENGTH 2048
+
 void
-pixman_composite_rect_general (const FbComposeData *data,
-			       uint32_t *scanline_buffer)
+pixman_composite_rect_general (const FbComposeData *data)
 {
+    uint32_t _scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
+    uint32_t *scanline_buffer = _scanline_buffer;
+    uint32_t *src_buffer, *mask_buffer, *dest_buffer;
+
+    if (data->width > SCANLINE_BUFFER_LENGTH)
+    {
+	scanline_buffer = (uint32_t *)pixman_malloc_abc (data->width, 3, sizeof (uint32_t));
+
+	if (!scanline_buffer)
+	    return;
+    }
+
+    src_buffer = scanline_buffer;
+    mask_buffer = src_buffer + data->width;
+    dest_buffer = mask_buffer + data->width;
+
     if (data->src->common.read_func			||
 	data->src->common.write_func			||
 	(data->mask && data->mask->common.read_func)	||
@@ -446,12 +459,17 @@ pixman_composite_rect_general (const FbComposeData *data,
 	data->dest->common.read_func			||
 	data->dest->common.write_func)
     {
-	pixman_composite_rect_general_accessors (data, scanline_buffer);
+	pixman_composite_rect_general_accessors (data, src_buffer, mask_buffer,
+						 dest_buffer);
     }
     else
     {
-	pixman_composite_rect_general_no_accessors (data, scanline_buffer);
+	pixman_composite_rect_general_no_accessors (data, src_buffer,
+						    mask_buffer, dest_buffer);
     }
+
+    if (scanline_buffer != _scanline_buffer)
+	free (scanline_buffer);
 }
 
 #endif
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index 833d65a..1479670 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -1261,8 +1261,6 @@ pixman_walk_composite_region (pixman_op_t op,
     pixman_region_fini (&reg);
 }
 
-#define SCANLINE_BUFFER_LENGTH 2048
-
 static void
 pixman_image_composite_rect  (pixman_op_t                   op,
 			      pixman_image_t               *src,
@@ -1278,20 +1276,10 @@ pixman_image_composite_rect  (pixman_op_t                   op,
 			      uint16_t                      height)
 {
     FbComposeData compose_data;
-    uint32_t _scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
-    uint32_t *scanline_buffer = _scanline_buffer;
 
     return_if_fail (src != NULL);
     return_if_fail (dest != NULL);
 
-    if (width > SCANLINE_BUFFER_LENGTH)
-    {
-	scanline_buffer = (uint32_t *)pixman_malloc_abc (width, 3, sizeof (uint32_t));
-
-	if (!scanline_buffer)
-	    return;
-    }
-
     compose_data.op = op;
     compose_data.src = src;
     compose_data.mask = mask;
@@ -1305,10 +1293,7 @@ pixman_image_composite_rect  (pixman_op_t                   op,
     compose_data.width = width;
     compose_data.height = height;
 
-    pixman_composite_rect_general (&compose_data, scanline_buffer);
-
-    if (scanline_buffer != _scanline_buffer)
-	free (scanline_buffer);
+    pixman_composite_rect_general (&compose_data);
 }
 
 /* These "formats" both have depth 0, so they
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 869bc80..96f6c21 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -188,9 +188,10 @@ extern FbComposeFunctions32 pixman_composeFunctions;
 extern FbComposeFunctions64 pixman_composeFunctions64;
 
 void pixman_composite_rect_general_accessors (const FbComposeData *data,
-					      uint32_t *scanline_buffer);
-void pixman_composite_rect_general (const FbComposeData *data,
-				    uint32_t *scanline_buffer);
+                                              void *src_buffer,
+                                              void *mask_buffer,
+                                              void *dest_buffer);
+void pixman_composite_rect_general (const FbComposeData *data);
 
 fetchProc pixman_fetchProcForPicture (bits_image_t *);
 fetchPixelProc pixman_fetchPixelProcForPicture (bits_image_t *);


More information about the xorg-commit mailing list