pixman: Branch 'master' - 5 commits

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Tue Jun 23 02:43:52 PDT 2009


 pixman/Makefile.am               |    1 
 pixman/pixman-access.c           |    1 
 pixman/pixman-accessor.h         |   40 ++++++++++
 pixman/pixman-bits-image.c       |   61 ++++++++--------
 pixman/pixman-conical-gradient.c |   52 +++++--------
 pixman/pixman-edge.c             |    1 
 pixman/pixman-fast-path.c        |   35 +++------
 pixman/pixman-general.c          |   16 +---
 pixman/pixman-image.c            |   67 +++--------------
 pixman/pixman-linear-gradient.c  |   43 +++--------
 pixman/pixman-private.h          |  106 ++++++----------------------
 pixman/pixman-radial-gradient.c  |  147 ++++++++++++++++++---------------------
 pixman/pixman-solid-fill.c       |    7 -
 13 files changed, 242 insertions(+), 335 deletions(-)

New commits:
commit 9668e8ce1012c366f8234d9438ac2a75ad7a2c60
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Tue Jun 23 05:40:52 2009 -0400

    remove mask argument

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index 82a480b..46e1c17 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -508,8 +508,7 @@ bits_image_fetch_filtered (bits_image_t *pict, uint32_t *buffer, int n_pixels)
 }
 
 static void
-bits_image_fetch_transformed (bits_image_t * pict, int x, int y, int width,
-			      uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
+bits_image_fetch_transformed (pixman_image_t *pict, int x, int y, int width, uint32_t *buffer)
 {
     uint32_t     *bits;
     int32_t    stride;
@@ -520,8 +519,8 @@ bits_image_fetch_transformed (bits_image_t * pict, int x, int y, int width,
     int32_t *coords;
     int i;
 
-    bits = pict->bits;
-    stride = pict->rowstride;
+    bits = pict->bits.bits;
+    stride = pict->bits.rowstride;
 
     /* reference point is the center of the pixel */
     v.vector[0] = pixman_int_to_fixed(x) + pixman_fixed_1 / 2;
@@ -594,7 +593,7 @@ bits_image_fetch_transformed (bits_image_t * pict, int x, int y, int width,
 	    v.vector[1] += unit.vector[1];
 	}
 
-	bits_image_fetch_filtered (pict, tmp_buffer, n_pixels);
+	bits_image_fetch_filtered (&pict->bits, tmp_buffer, n_pixels);
 	
 	for (j = 0; j < n_pixels; ++j)
 	    buffer[i++] = tmp_buffer[j];
@@ -602,10 +601,9 @@ bits_image_fetch_transformed (bits_image_t * pict, int x, int y, int width,
 }
 
 static void
-bits_image_fetch_solid_32 (bits_image_t * image,
+bits_image_fetch_solid_32 (pixman_image_t * image,
 			   int x, int y, int width,
-			   uint32_t *buffer,
-			   uint32_t *mask, uint32_t maskBits)
+			   uint32_t *buffer)
 {
     uint32_t color[2];
     uint32_t *end;
@@ -613,7 +611,7 @@ bits_image_fetch_solid_32 (bits_image_t * image,
     color[0] = 0;
     color[1] = 0;
     
-    image->fetch_pixels_raw_32 (image, color, 1);
+    image->bits.fetch_pixels_raw_32 (&image->bits, color, 1);
     
     end = buffer + width;
     while (buffer < end)
@@ -621,18 +619,19 @@ bits_image_fetch_solid_32 (bits_image_t * image,
 }
 
 static void
-bits_image_fetch_solid_64 (bits_image_t * image,
+bits_image_fetch_solid_64 (pixman_image_t * image,
 			   int x, int y, int width,
-			   uint64_t *buffer, void *unused, uint32_t unused2)
+			   uint32_t *b)
 {
     uint32_t color[2];
     uint64_t *end;
     uint32_t *coords = (uint32_t *)color;
+    uint64_t *buffer = (uint64_t *)b;
 
     coords[0] = 0;
     coords[1] = 1;
     
-    image->fetch_pixels_raw_64 (image, (uint64_t *)color, 1);
+    image->bits.fetch_pixels_raw_64 (&image->bits, (uint64_t *)color, 1);
     
     end = buffer + width;
     while (buffer < end)
@@ -713,30 +712,30 @@ bits_image_fetch_untransformed_repeat_normal (bits_image_t *image, pixman_bool_t
 }
 
 static void
-bits_image_fetch_untransformed_32 (bits_image_t * image,
+bits_image_fetch_untransformed_32 (pixman_image_t * image,
 				   int x, int y, int width,
-				   uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
+				   uint32_t *buffer)
 {
     if (image->common.repeat == PIXMAN_REPEAT_NONE)
-	bits_image_fetch_untransformed_repeat_none (image, FALSE, x, y, width, buffer);
+	bits_image_fetch_untransformed_repeat_none (&image->bits, FALSE, x, y, width, buffer);
     else
-	bits_image_fetch_untransformed_repeat_normal (image, FALSE, x, y, width, buffer);
+	bits_image_fetch_untransformed_repeat_normal (&image->bits, FALSE, x, y, width, buffer);
 }
 
 static void
-bits_image_fetch_untransformed_64 (bits_image_t * image,
+bits_image_fetch_untransformed_64 (pixman_image_t * image,
 				   int x, int y, int width,
-				   uint64_t *buffer, void *unused, uint32_t unused2)
+				   uint32_t *buffer)
 {
     if (image->common.repeat == PIXMAN_REPEAT_NONE)
     {
-	bits_image_fetch_untransformed_repeat_none (image, FALSE, x, y,
-						    width, (uint32_t *)buffer);
+	bits_image_fetch_untransformed_repeat_none (&image->bits, TRUE, x, y,
+						    width, buffer);
     }
     else
     {
-	bits_image_fetch_untransformed_repeat_normal (image, FALSE, x, y,
-						      width, (uint32_t *)buffer);
+	bits_image_fetch_untransformed_repeat_normal (&image->bits, TRUE, x, y,
+						      width, buffer);
     }
 }
 
@@ -750,16 +749,16 @@ bits_image_property_changed (pixman_image_t *image)
     if (bits->common.alpha_map)
     {
 	image->common.get_scanline_64 =
-	    (scanFetchProc)_pixman_image_get_scanline_64_generic;
+	    _pixman_image_get_scanline_64_generic;
 	image->common.get_scanline_32 =
-	    (scanFetchProc)bits_image_fetch_transformed;
+	    bits_image_fetch_transformed;
     }
     else if ((bits->common.repeat != PIXMAN_REPEAT_NONE) &&
 	    bits->width == 1 &&
 	    bits->height == 1)
     {
-	image->common.get_scanline_64 = (scanFetchProc)bits_image_fetch_solid_64;
-	image->common.get_scanline_32 = (scanFetchProc)bits_image_fetch_solid_32;
+	image->common.get_scanline_64 = bits_image_fetch_solid_64;
+	image->common.get_scanline_32 = bits_image_fetch_solid_32;
     }
     else if (!bits->common.transform &&
 	     bits->common.filter != PIXMAN_FILTER_CONVOLUTION &&
@@ -767,16 +766,16 @@ bits_image_property_changed (pixman_image_t *image)
 	      bits->common.repeat == PIXMAN_REPEAT_NORMAL))
     {
 	image->common.get_scanline_64 =
-	    (scanFetchProc)bits_image_fetch_untransformed_64;
+	    bits_image_fetch_untransformed_64;
 	image->common.get_scanline_32 =
-	    (scanFetchProc)bits_image_fetch_untransformed_32;
+	    bits_image_fetch_untransformed_32;
     }
     else
     {
 	image->common.get_scanline_64 =
-	    (scanFetchProc)_pixman_image_get_scanline_64_generic;
+	    _pixman_image_get_scanline_64_generic;
 	image->common.get_scanline_32 =
-	    (scanFetchProc)bits_image_fetch_transformed;
+	    bits_image_fetch_transformed;
     }
 
     bits->store_scanline_64 = bits_image_store_scanline_64;
diff --git a/pixman/pixman-conical-gradient.c b/pixman/pixman-conical-gradient.c
index ba01509..e91ef59 100644
--- a/pixman/pixman-conical-gradient.c
+++ b/pixman/pixman-conical-gradient.c
@@ -30,7 +30,7 @@
 
 static void
 conical_gradient_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
-				  uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
+				  uint32_t *buffer)
 {
     source_image_t *source = (source_image_t *)image;
     gradient_t *gradient = (gradient_t *)source;
@@ -70,20 +70,15 @@ conical_gradient_get_scanline_32 (pixman_image_t *image, int x, int y, int width
 	rx -= conical->center.x/65536.;
 	ry -= conical->center.y/65536.;
 	
-	while (buffer < end) {
+	while (buffer < end)
+	{
 	    double angle;
+	    pixman_fixed_48_16_t   t;
 	    
-	    if (!mask || *mask++ & maskBits)
-	    {
-		pixman_fixed_48_16_t   t;
-		
-		angle = atan2(ry, rx) + a;
-		t     = (pixman_fixed_48_16_t) (angle * (65536. / (2*M_PI)));
-		
-		*(buffer) = _pixman_gradient_walker_pixel (&walker, t);
-	    }
+	    angle = atan2(ry, rx) + a;
+	    t     = (pixman_fixed_48_16_t) (angle * (65536. / (2*M_PI)));
 	    
-	    ++buffer;
+	    *buffer++ = _pixman_gradient_walker_pixel (&walker, t);
 	    rx += cx;
 	    ry += cy;
 	}
@@ -92,23 +87,20 @@ conical_gradient_get_scanline_32 (pixman_image_t *image, int x, int y, int width
 	    double x, y;
 	    double angle;
 	    
-	    if (!mask || *mask++ & maskBits)
-	    {
-		pixman_fixed_48_16_t  t;
-		
-		if (rz != 0) {
-		    x = rx/rz;
-		    y = ry/rz;
-		} else {
-		    x = y = 0.;
-		}
-		x -= conical->center.x/65536.;
-		y -= conical->center.y/65536.;
-		angle = atan2(y, x) + a;
-		t     = (pixman_fixed_48_16_t) (angle * (65536. / (2*M_PI)));
-		
-		*(buffer) = _pixman_gradient_walker_pixel (&walker, t);
+	    pixman_fixed_48_16_t  t;
+	    
+	    if (rz != 0) {
+		x = rx/rz;
+		y = ry/rz;
+	    } else {
+		x = y = 0.;
 	    }
+	    x -= conical->center.x/65536.;
+	    y -= conical->center.y/65536.;
+	    angle = atan2(y, x) + a;
+	    t     = (pixman_fixed_48_16_t) (angle * (65536. / (2*M_PI)));
+	    
+	    *(buffer) = _pixman_gradient_walker_pixel (&walker, t);
 	    
 	    ++buffer;
 	    rx += cx;
@@ -121,8 +113,8 @@ conical_gradient_get_scanline_32 (pixman_image_t *image, int x, int y, int width
 static void
 conical_gradient_property_changed (pixman_image_t *image)
 {
-    image->common.get_scanline_32 = (scanFetchProc)conical_gradient_get_scanline_32;
-    image->common.get_scanline_64 = (scanFetchProc)_pixman_image_get_scanline_64_generic;
+    image->common.get_scanline_32 = conical_gradient_get_scanline_32;
+    image->common.get_scanline_64 = _pixman_image_get_scanline_64_generic;
 }
 
 PIXMAN_EXPORT pixman_image_t *
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 3bd850a..55d0b6b 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -187,8 +187,7 @@ general_composite_rect  (pixman_implementation_t *imp,
 	    {
 		/* fetch mask before source so that fetching of
 		   source can be optimized */
-		fetchMask (mask, mask_x, mask_y + i,
-			   width, (void *)mask_buffer, 0, 0);
+		fetchMask (mask, mask_x, mask_y + i, width, (void *)mask_buffer);
 		
 		if (maskClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
 		    fetchMask = NULL;
@@ -196,29 +195,24 @@ general_composite_rect  (pixman_implementation_t *imp,
 	    
 	    if (srcClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
 	    {
-		fetchSrc (src, src_x, src_y + i,
-			  width, (void *)src_buffer, 0, 0);
+		fetchSrc (src, src_x, src_y + i, width, (void *)src_buffer);
 		fetchSrc = NULL;
 	    }
 	    else
 	    {
-		fetchSrc (src, src_x, src_y + i,
-			  width, (void *)src_buffer, (void *)mask_buffer,
-			  0xffffffff);
+		fetchSrc (src, src_x, src_y + i, width, (void *)src_buffer);
 	    }
 	}
 	else if (fetchMask)
 	{
-	    fetchMask (mask, mask_x, mask_y + i,
-		       width, (void *)mask_buffer, 0, 0);
+	    fetchMask (mask, mask_x, mask_y + i, width, (void *)mask_buffer);
 	}
 	
 	if (store)
 	{
 	    /* fill dest into second half of scanline */
 	    if (fetchDest)
-		fetchDest (dest, dest_x, dest_y + i,
-			   width, (void *)dest_buffer, 0, 0);
+		fetchDest (dest, dest_x, dest_y + i, width, (void *)dest_buffer);
 	    
 	    /* blend */
 	    compose (imp->toplevel, op, (void *)dest_buffer, (void *)src_buffer, (void *)mask_buffer, width);
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 9558ccb..0c49035 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -61,31 +61,17 @@ _pixman_init_gradient (gradient_t     *gradient,
  * types can plug in a better scanline getter if they want to. For example
  * we  could produce smoother gradients by evaluating them at higher color depth, but
  * that's a project for the future.
+ *
+ * Despite being declared uint32_t, @buffer is actually a 64 bit buffer.
  */
 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)
+_pixman_image_get_scanline_64_generic (pixman_image_t * pict, int x, int y, int width, uint32_t *buffer)
 {
-    uint32_t *mask8 = NULL;
-
-    // Contract the mask image, if one exists, so that the 32-bit fetch function
-    // can use it.
-    if (mask) {
-        mask8 = pixman_malloc_ab(width, sizeof(uint32_t));
-	if (!mask8)
-	    return;
-	
-        pixman_contract(mask8, mask, width);
-    }
-
-    // Fetch the source image into the first half of buffer.
-    _pixman_image_get_scanline_32 (pict, x, y, width, (uint32_t*)buffer, mask8,
-				   maskBits);
-
-    // Expand from 32bpp to 64bpp in place.
-    pixman_expand(buffer, (uint32_t*)buffer, PIXMAN_a8r8g8b8, width);
-
-    free(mask8);
+    /* Fetch the source image into the first half of buffer. */
+    _pixman_image_get_scanline_32 (pict, x, y, width, buffer);
+    
+    /* Expand from 32bpp to 64bpp in place. */
+    pixman_expand ((uint64_t *)buffer, buffer, PIXMAN_a8r8g8b8, width);
 }
 
 pixman_image_t *
@@ -135,9 +121,9 @@ _pixman_image_classify (pixman_image_t *image,
 
 void
 _pixman_image_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
-			       uint32_t *buffer, uint32_t *mask, uint32_t mask_bits)
+			       uint32_t *buffer)
 {
-    image->common.get_scanline_32 (image, x, y, width, buffer, mask, mask_bits);
+    image->common.get_scanline_32 (image, x, y, width, buffer);
 }
 
 /* Even thought the type of buffer is uint32_t *, the function actually expects
@@ -145,9 +131,9 @@ _pixman_image_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
  */
 void
 _pixman_image_get_scanline_64 (pixman_image_t *image, int x, int y, int width,
-			       uint32_t *buffer, uint32_t *unused, uint32_t unused2)
+			       uint32_t *buffer)
 {
-    image->common.get_scanline_64 (image, x, y, width, buffer, unused, unused2);
+    image->common.get_scanline_64 (image, x, y, width, buffer);
 }
 
 static void
@@ -189,21 +175,12 @@ pixman_image_unref (pixman_image_t *image)
 	if (common->alpha_map)
 	    pixman_image_unref ((pixman_image_t *)common->alpha_map);
 
-#if 0
-	if (image->type == BITS && image->bits.indexed)
-	    free (image->bits.indexed);
-#endif
-
-#if 0
-	memset (image, 0xaa, sizeof (pixman_image_t));
-#endif
 	if (image->type == LINEAR || image->type == RADIAL || image->type == CONICAL)
 	{
 	    if (image->gradient.stops)
 		free (image->gradient.stops);
 	}
 
-
 	if (image->type == BITS && image->bits.free_me)
 	    free (image->bits.free_me);
 
@@ -517,7 +494,7 @@ _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);
+    _pixman_image_get_scanline_32 (image, 0, 0, 1, &result);
     
     /* If necessary, convert RGB <--> BGR. */
     if (PIXMAN_FORMAT_TYPE (format) != PIXMAN_TYPE_ARGB)
diff --git a/pixman/pixman-linear-gradient.c b/pixman/pixman-linear-gradient.c
index 947c66b..26dc699 100644
--- a/pixman/pixman-linear-gradient.c
+++ b/pixman/pixman-linear-gradient.c
@@ -147,22 +147,10 @@ linear_gradient_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
 	}
 	else
 	{
-	    if (!mask) {
-		while (buffer < end)
-		{
-		    *(buffer) = _pixman_gradient_walker_pixel (&walker, t);
-		    buffer += 1;
-		    t      += inc;
-		}
-	    } else {
-		while (buffer < end) {
-		    if (*mask++ & maskBits)
-		    {
-			*(buffer) = _pixman_gradient_walker_pixel (&walker, t);
-		    }
-		    buffer += 1;
-		    t      += inc;
-		}
+	    while (buffer < end)
+	    {
+		*buffer++ = _pixman_gradient_walker_pixel (&walker, t);
+		t      += inc;
 	    }
 	}
     }
@@ -195,18 +183,15 @@ linear_gradient_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
 	{
 	    while (buffer < end)
 	    {
-		if (!mask || *mask++ & maskBits)
-		{
-		    if (v.vector[2] == 0) {
-			t = 0;
-		    } else {
-			pixman_fixed_48_16_t x, y;
-			x = ((pixman_fixed_48_16_t)v.vector[0] << 16) / v.vector[2];
-			y = ((pixman_fixed_48_16_t)v.vector[1] << 16) / v.vector[2];
-			t = ((a*x + b*y) >> 16) + off;
-		    }
-		    *(buffer) = _pixman_gradient_walker_pixel (&walker, t);
+		if (v.vector[2] == 0) {
+		    t = 0;
+		} else {
+		    pixman_fixed_48_16_t x, y;
+		    x = ((pixman_fixed_48_16_t)v.vector[0] << 16) / v.vector[2];
+		    y = ((pixman_fixed_48_16_t)v.vector[1] << 16) / v.vector[2];
+		    t = ((a*x + b*y) >> 16) + off;
 		}
+		*(buffer) = _pixman_gradient_walker_pixel (&walker, t);
 		++buffer;
 		v.vector[0] += unit.vector[0];
 		v.vector[1] += unit.vector[1];
@@ -219,8 +204,8 @@ linear_gradient_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
 static void
 linear_gradient_property_changed (pixman_image_t *image)
 {
-    image->common.get_scanline_32 = (scanFetchProc)linear_gradient_get_scanline_32;
-    image->common.get_scanline_64 = (scanFetchProc)_pixman_image_get_scanline_64_generic;
+    image->common.get_scanline_32 = linear_gradient_get_scanline_32;
+    image->common.get_scanline_64 = _pixman_image_get_scanline_64_generic;
 }
 
 PIXMAN_EXPORT pixman_image_t *
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 3ac27a2..0c29d1c 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -50,8 +50,7 @@ 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);
+				       int, int, int, uint32_t *);
 
 typedef enum
 {
@@ -216,9 +215,7 @@ _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);
+					uint32_t       *buffer);
 
 source_pict_class_t
 _pixman_image_classify (pixman_image_t *image,
@@ -229,16 +226,14 @@ _pixman_image_classify (pixman_image_t *image,
 
 void
 _pixman_image_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
-			       uint32_t *buffer, uint32_t *mask,
-			       uint32_t mask_bits);
+			       uint32_t *buffer);
 
 /* Even thought the type of buffer is uint32_t *, the function actually expects
  * a uint64_t *buffer.
  */
 void
 _pixman_image_get_scanline_64 (pixman_image_t *image, int x, int y, int width,
-			       uint32_t *buffer,
-			       uint32_t *unused, uint32_t unused2);
+			       uint32_t *buffer);
 
 void
 _pixman_image_store_scanline_32 (bits_image_t *image, int x, int y, int width,
diff --git a/pixman/pixman-radial-gradient.c b/pixman/pixman-radial-gradient.c
index cb81173..8df9a87 100644
--- a/pixman/pixman-radial-gradient.c
+++ b/pixman/pixman-radial-gradient.c
@@ -32,8 +32,7 @@
 #include "pixman-private.h"
 
 static void
-radial_gradient_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
-				 uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
+radial_gradient_get_scanline_32 (pixman_image_t *image, int x, int y, int width, uint32_t *buffer)
 {
     /*
      * In the radial gradient problem we are given two circles (c₁,r₁) and
@@ -183,97 +182,93 @@ radial_gradient_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
 	affine = source->common.transform->matrix[2][0] == 0 && v.vector[2] == pixman_fixed_1;
     }
     
-    if (affine) {
-	while (buffer < end) {
-	    if (!mask || *mask++ & maskBits)
-	    {
-		double pdx, pdy;
-		double B, C;
-		double det;
-		double c1x = radial->c1.x / 65536.0;
-		double c1y = radial->c1.y / 65536.0;
-		double r1  = radial->c1.radius / 65536.0;
-		pixman_fixed_48_16_t t;
-		
-		pdx = rx - c1x;
-		pdy = ry - c1y;
-		
-		B = -2 * (  pdx * radial->cdx
-			    + pdy * radial->cdy
-			    + r1 * radial->dr);
-		C = (pdx * pdx + pdy * pdy - r1 * r1);
-		
-		det = (B * B) - (4 * radial->A * C);
-		if (det < 0.0)
-		    det = 0.0;
-		
-		if (radial->A < 0)
-		    t = (pixman_fixed_48_16_t) ((- B - sqrt(det)) / (2.0 * radial->A) * 65536);
-		else
-		    t = (pixman_fixed_48_16_t) ((- B + sqrt(det)) / (2.0 * radial->A) * 65536);
-		
-		*(buffer) = _pixman_gradient_walker_pixel (&walker, t);
-	    }
-	    ++buffer;
+    if (affine)
+    {
+	while (buffer < end)
+	{
+	    double pdx, pdy;
+	    double B, C;
+	    double det;
+	    double c1x = radial->c1.x / 65536.0;
+	    double c1y = radial->c1.y / 65536.0;
+	    double r1  = radial->c1.radius / 65536.0;
+	    pixman_fixed_48_16_t t;
+	    
+	    pdx = rx - c1x;
+	    pdy = ry - c1y;
+	    
+	    B = -2 * (  pdx * radial->cdx
+			+ pdy * radial->cdy
+			+ r1 * radial->dr);
+	    C = (pdx * pdx + pdy * pdy - r1 * r1);
+	    
+	    det = (B * B) - (4 * radial->A * C);
+	    if (det < 0.0)
+		det = 0.0;
+	    
+	    if (radial->A < 0)
+		t = (pixman_fixed_48_16_t) ((- B - sqrt(det)) / (2.0 * radial->A) * 65536);
+	    else
+		t = (pixman_fixed_48_16_t) ((- B + sqrt(det)) / (2.0 * radial->A) * 65536);
+	    
+	    *(buffer++) = _pixman_gradient_walker_pixel (&walker, t);
 	    
 	    rx += cx;
 	    ry += cy;
 	}
-    } else {
+    }
+    else
+    {
 	/* projective */
-	while (buffer < end) {
-	    if (!mask || *mask++ & maskBits)
-	    {
-		double pdx, pdy;
-		double B, C;
-		double det;
-		double c1x = radial->c1.x / 65536.0;
-		double c1y = radial->c1.y / 65536.0;
-		double r1  = radial->c1.radius / 65536.0;
-		pixman_fixed_48_16_t t;
-		double x, y;
-		
-		if (rz != 0) {
-		    x = rx/rz;
-		    y = ry/rz;
-		} else {
-		    x = y = 0.;
-		}
-		
-		pdx = x - c1x;
-		pdy = y - c1y;
-		
-		B = -2 * (  pdx * radial->cdx
-			    + pdy * radial->cdy
-			    + r1 * radial->dr);
-		C = (pdx * pdx + pdy * pdy - r1 * r1);
-		
-		det = (B * B) - (4 * radial->A * C);
-		if (det < 0.0)
-		    det = 0.0;
-		
-		if (radial->A < 0)
-		    t = (pixman_fixed_48_16_t) ((- B - sqrt(det)) / (2.0 * radial->A) * 65536);
-		else
-		    t = (pixman_fixed_48_16_t) ((- B + sqrt(det)) / (2.0 * radial->A) * 65536);
-		
-		*(buffer) = _pixman_gradient_walker_pixel (&walker, t);
+	while (buffer < end)
+	{
+	    double pdx, pdy;
+	    double B, C;
+	    double det;
+	    double c1x = radial->c1.x / 65536.0;
+	    double c1y = radial->c1.y / 65536.0;
+	    double r1  = radial->c1.radius / 65536.0;
+	    pixman_fixed_48_16_t t;
+	    double x, y;
+	    
+	    if (rz != 0) {
+		x = rx/rz;
+		y = ry/rz;
+	    } else {
+		x = y = 0.;
 	    }
-	    ++buffer;
+	    
+	    pdx = x - c1x;
+	    pdy = y - c1y;
+	    
+	    B = -2 * (  pdx * radial->cdx
+			+ pdy * radial->cdy
+			+ r1 * radial->dr);
+	    C = (pdx * pdx + pdy * pdy - r1 * r1);
+	    
+	    det = (B * B) - (4 * radial->A * C);
+	    if (det < 0.0)
+		det = 0.0;
+	    
+	    if (radial->A < 0)
+		t = (pixman_fixed_48_16_t) ((- B - sqrt(det)) / (2.0 * radial->A) * 65536);
+	    else
+		t = (pixman_fixed_48_16_t) ((- B + sqrt(det)) / (2.0 * radial->A) * 65536);
+	    
+	    *buffer++ = _pixman_gradient_walker_pixel (&walker, t);
 	    
 	    rx += cx;
 	    ry += cy;
 	    rz += cz;
 	}
     }
-    
 }
 
 static void
 radial_gradient_property_changed (pixman_image_t *image)
 {
-    image->common.get_scanline_32 = (scanFetchProc)radial_gradient_get_scanline_32;
-    image->common.get_scanline_64 = (scanFetchProc)_pixman_image_get_scanline_64_generic;
+    image->common.get_scanline_32 = radial_gradient_get_scanline_32;
+    image->common.get_scanline_64 = _pixman_image_get_scanline_64_generic;
 }
 
 PIXMAN_EXPORT pixman_image_t *
diff --git a/pixman/pixman-solid-fill.c b/pixman/pixman-solid-fill.c
index 1805600..e53ed74 100644
--- a/pixman/pixman-solid-fill.c
+++ b/pixman/pixman-solid-fill.c
@@ -25,8 +25,7 @@
 #include "pixman-private.h"
 
 static void
-solid_fill_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
-			    uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
+solid_fill_get_scanline_32 (pixman_image_t *image, int x, int y, int width, uint32_t *buffer)
 {
     uint32_t *end = buffer + width;
     register uint32_t color = ((solid_fill_t *)image)->color;
@@ -50,8 +49,8 @@ solid_fill_classify (pixman_image_t *image,
 static void
 solid_fill_property_changed (pixman_image_t *image)
 {
-    image->common.get_scanline_32 = (scanFetchProc)solid_fill_get_scanline_32;
-    image->common.get_scanline_64 = (scanFetchProc)_pixman_image_get_scanline_64_generic;
+    image->common.get_scanline_32 = solid_fill_get_scanline_32;
+    image->common.get_scanline_64 = _pixman_image_get_scanline_64_generic;
 }
 
 static uint32_t
commit 2c70814b6bff2091bcc55ae4252fe82ae53439e4
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Mon Jun 22 20:43:08 2009 -0400

    Delete unused _pixman_image_get_fetcher() function

diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 3a0d0f8..9558ccb 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -140,6 +140,9 @@ _pixman_image_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
     image->common.get_scanline_32 (image, x, y, width, buffer, mask, mask_bits);
 }
 
+/* Even thought the type of buffer is uint32_t *, the function actually expects
+ * a uint64_t *buffer.
+ */
 void
 _pixman_image_get_scanline_64 (pixman_image_t *image, int x, int y, int width,
 			       uint32_t *buffer, uint32_t *unused, uint32_t unused2)
@@ -147,23 +150,6 @@ _pixman_image_get_scanline_64 (pixman_image_t *image, int x, int y, int width,
     image->common.get_scanline_64 (image, x, y, width, buffer, unused, unused2);
 }
 
-/* Even thought the type of buffer is uint32_t *, the function actually expects
- * a uint64_t *buffer.
- */
-
-scanFetchProc
-_pixman_image_get_fetcher (pixman_image_t *image,
-			   int             wide)
-{
-    assert (image->common.get_scanline_64);
-    assert (image->common.get_scanline_32);
-    
-    if (wide)
-	return image->common.get_scanline_64;
-    else
-	return image->common.get_scanline_32;
-}
-
 static void
 image_property_changed (pixman_image_t *image)
 {
commit b3bd7394477a64ca0460655ca3a8e5326c402167
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Mon Jun 22 19:51:13 2009 -0400

    Move accessor macros to their own header.
    
    Also rearrange some things in pixman-private.h

diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index 42ebe39..04e96cb 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -4,6 +4,7 @@ libpixman_1_la_LIBADD = @DEP_LIBS@ -lm
 libpixman_1_la_CFLAGS = -DPIXMAN_DISABLE_DEPRECATED
 libpixman_1_la_SOURCES =			\
 	pixman.h				\
+	pixman-accessor.h			\
 	pixman-access.c				\
 	pixman-access-accessors.c		\
 	pixman-cpu.c				\
diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 737d492..51dd5ef 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -33,6 +33,7 @@
 #include <assert.h>
 
 #include "pixman-private.h"
+#include "pixman-accessor.h"
 
 #define CvtR8G8B8toY15(s)       (((((s) >> 16) & 0xff) * 153 + \
                                   (((s) >>  8) & 0xff) * 301 +		\
diff --git a/pixman/pixman-accessor.h b/pixman/pixman-accessor.h
new file mode 100644
index 0000000..a72c52a
--- /dev/null
+++ b/pixman/pixman-accessor.h
@@ -0,0 +1,40 @@
+#ifdef PIXMAN_FB_ACCESSORS
+
+#define ACCESS(sym) sym##_accessors
+
+#define READ(img, ptr)							\
+    ((img)->common.read_func ((ptr), sizeof(*(ptr))))
+#define WRITE(img, ptr,val)						\
+    ((img)->common.write_func ((ptr), (val), sizeof (*(ptr))))
+
+#define MEMCPY_WRAPPED(img, dst, src, size)				\
+    do {								\
+	size_t _i;							\
+	uint8_t *_dst = (uint8_t*)(dst), *_src = (uint8_t*)(src);	\
+	for(_i = 0; _i < size; _i++) {					\
+	    WRITE((img), _dst +_i, READ((img), _src + _i));		\
+	}								\
+    } while (0)
+
+#define MEMSET_WRAPPED(img, dst, val, size)				\
+    do {								\
+	size_t _i;							\
+	uint8_t *_dst = (uint8_t*)(dst);				\
+	for(_i = 0; _i < (size_t) size; _i++) {				\
+	    WRITE((img), _dst +_i, (val));				\
+	}								\
+    } while (0)
+
+#else
+
+#define ACCESS(sym) sym
+
+#define READ(img, ptr)		(*(ptr))
+#define WRITE(img, ptr, val)	(*(ptr) = (val))
+#define MEMCPY_WRAPPED(img, dst, src, size)				\
+    memcpy(dst, src, size)
+#define MEMSET_WRAPPED(img, dst, val, size)				\
+    memset(dst, val, size)
+
+#endif
+
diff --git a/pixman/pixman-edge.c b/pixman/pixman-edge.c
index e69a8a1..f5bfc06 100644
--- a/pixman/pixman-edge.c
+++ b/pixman/pixman-edge.c
@@ -27,6 +27,7 @@
 #include <string.h>
 
 #include "pixman-private.h"
+#include "pixman-accessor.h"
 
 /*
  * Step across a small sample grid gap
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 131d6b0..3ac27a2 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -274,6 +274,17 @@ uint32_t
 _pixman_image_get_solid (pixman_image_t *image,
 			pixman_format_code_t format);
 
+#define fbComposeGetStart(pict,x,y,type,out_stride,line,mul) do {	\
+	uint32_t	*__bits__;					\
+	int		__stride__;					\
+									\
+	__bits__ = pict->bits.bits;					\
+	__stride__ = pict->bits.rowstride;				\
+	(out_stride) = __stride__ * (int) sizeof (uint32_t) / (int) sizeof (type); \
+	(line) = ((type *) __bits__) +					\
+	    (out_stride) * (y) + (mul) * (x);				\
+    } while (0)
+
 /*
  * Gradient walker
  */
@@ -315,65 +326,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 cvt8888to0565(s)    ((((s) >> 3) & 0x001f) | \
-			     (((s) >> 5) & 0x07e0) | \
-			     (((s) >> 8) & 0xf800))
-#define cvt0565to0888(s)    (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
-			     ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
-			     ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
-
-#ifdef PIXMAN_FB_ACCESSORS
-
-#define ACCESS(sym) sym##_accessors
-
-#define READ(img, ptr)							\
-    ((img)->common.read_func ((ptr), sizeof(*(ptr))))
-#define WRITE(img, ptr,val)						\
-    ((img)->common.write_func ((ptr), (val), sizeof (*(ptr))))
-
-#define MEMCPY_WRAPPED(img, dst, src, size)				\
-    do {								\
-	size_t _i;							\
-	uint8_t *_dst = (uint8_t*)(dst), *_src = (uint8_t*)(src);	\
-	for(_i = 0; _i < size; _i++) {					\
-	    WRITE((img), _dst +_i, READ((img), _src + _i));		\
-	}								\
-    } while (0)
-
-#define MEMSET_WRAPPED(img, dst, val, size)				\
-    do {								\
-	size_t _i;							\
-	uint8_t *_dst = (uint8_t*)(dst);				\
-	for(_i = 0; _i < (size_t) size; _i++) {				\
-	    WRITE((img), _dst +_i, (val));				\
-	}								\
-    } while (0)
-
-#else
-
-#define ACCESS(sym) sym
-
-#define READ(img, ptr)		(*(ptr))
-#define WRITE(img, ptr, val)	(*(ptr) = (val))
-#define MEMCPY_WRAPPED(img, dst, src, size)				\
-    memcpy(dst, src, size)
-#define MEMSET_WRAPPED(img, dst, val, size)				\
-    memset(dst, val, size)
-
-#endif
-
-#define fbComposeGetStart(pict,x,y,type,out_stride,line,mul) do {	\
-	uint32_t	*__bits__;					\
-	int		__stride__;					\
-									\
-	__bits__ = pict->bits.bits;					\
-	__stride__ = pict->bits.rowstride;				\
-	(out_stride) = __stride__ * (int) sizeof (uint32_t) / (int) sizeof (type);	\
-	(line) = ((type *) __bits__) +					\
-	    (out_stride) * (y) + (mul) * (x);				\
-    } while (0)
-
-
 #define PIXMAN_FORMAT_16BPC(f)	(PIXMAN_FORMAT_A(f) > 8 || \
 				 PIXMAN_FORMAT_R(f) > 8 || \
 				 PIXMAN_FORMAT_G(f) > 8 || \
@@ -695,6 +647,14 @@ pixman_region16_copy_from_region32 (pixman_region16_t *dst,
 
 #define CLIP(v,low,high) ((v) < (low) ? (low) : ((v) > (high) ? (high) : (v)))
 
+/* Conversion between 8888 and 0565 */
+
+#define cvt8888to0565(s)    ((((s) >> 3) & 0x001f) | \
+			     (((s) >> 5) & 0x07e0) | \
+			     (((s) >> 8) & 0xf800))
+#define cvt0565to0888(s)    (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
+			     ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
+			     ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
 
 /*
  * Various debugging code
commit fe8ef09e9835f90b669a2b1ddfda49e839d6de53
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Mon Jun 22 19:38:58 2009 -0400

    Move FbGet8() macro into pixman-bits-image.c
    
    It is only used for bilinear filtering now. Also some formatting
    changes in pixman-private.h

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index 97acb0c..82a480b 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -339,6 +339,8 @@ bits_image_fetch_bilinear_pixels (bits_image_t *image, uint32_t *buffer, int n_p
 
 	    idistx = 256 - distx;
 	    idisty = 256 - disty;
+
+#define FbGet8(v,i)   ((uint16_t) (uint8_t) ((v) >> i))
 	    
 	    ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
 	    fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 8201545..131d6b0 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -307,15 +307,13 @@ uint32_t
 _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 			       pixman_fixed_32_32_t  x);
 
-#define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) )
+#define FbIntMult(a,b,t) ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8))
 #define FbIntDiv(a,b)	 (((uint16_t) (a) * 255) / (b))
-
 #define FbIntAdd(x,y,t) (						\
 	(t) = x + y,							\
 	(uint32_t) (uint8_t) ((t) | (0 - ((t) >> 8))))
-
-#define FbGet8(v,i)   ((uint16_t) (uint8_t) ((v) >> i))
-
+#define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8)
+#define div_65535(x) (((x) + 0x8000 + (((x) + 0x8000) >> 16)) >> 16)
 
 #define cvt8888to0565(s)    ((((s) >> 3) & 0x001f) | \
 			     (((s) >> 5) & 0x07e0) | \
@@ -324,17 +322,6 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 			     ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
 			     ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
 
-/*
- * 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.
- */
-
-#define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8)
-#define div_65535(x) (((x) + 0x8000 + (((x) + 0x8000) >> 16)) >> 16)
-
 #ifdef PIXMAN_FB_ACCESSORS
 
 #define ACCESS(sym) sym##_accessors
commit 03587764455bd41684bf29bbecb657ba45b0c341
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Mon Jun 22 19:35:11 2009 -0400

    Delete FbInOverC macro

diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 53f57fd..48c9a87 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -366,7 +366,6 @@ fbCompositeSolidMask_nx8888x8888C (pixman_implementation_t *imp,
     uint32_t	*maskLine, *mask, ma;
     int	dstStride, maskStride;
     uint16_t	w;
-    uint32_t	m, n, o, p;
 
     src = _pixman_image_get_solid(pSrc, pDst->bits.format);
 
@@ -398,22 +397,15 @@ fbCompositeSolidMask_nx8888x8888C (pixman_implementation_t *imp,
 	    else if (ma)
 	    {
 		d = *dst;
-#define FbInOverC(src,srca,msk,dst,i,result) { \
-    uint16_t  __a = FbGet8(msk,i); \
-    uint32_t  __t, __ta; \
-    uint32_t  __i; \
-    __t = FbIntMult (FbGet8(src,i), __a,__i); \
-    __ta = (uint8_t) ~FbIntMult (srca, __a,__i); \
-    __t = __t + FbIntMult(FbGet8(dst,i),__ta,__i); \
-    __t = (uint32_t) (uint8_t) (__t | (-(__t >> 8))); \
-    result = __t << (i); \
-}
-		FbInOverC (src, srca, ma, d, 0, m);
-		FbInOverC (src, srca, ma, d, 8, n);
-		FbInOverC (src, srca, ma, d, 16, o);
-		FbInOverC (src, srca, ma, d, 24, p);
-		*dst = m|n|o|p;
+
+		FbByteMulC (src, ma);
+		FbByteMul (ma, srca);
+		ma = ~ma;
+		FbByteMulAddC (d, ma, src);
+
+		*dst = d;
 	    }
+
 	    dst++;
 	}
     }
@@ -568,7 +560,6 @@ fbCompositeSolidMask_nx8888x0565C (pixman_implementation_t *imp,
     uint32_t	*maskLine, *mask, ma;
     int	dstStride, maskStride;
     uint16_t	w;
-    uint32_t	m, n, o;
 
     src = _pixman_image_get_solid(pSrc, pDst->bits.format);
 
@@ -609,10 +600,12 @@ fbCompositeSolidMask_nx8888x0565C (pixman_implementation_t *imp,
 	    {
 		d = *dst;
 		d = cvt0565to0888(d);
-		FbInOverC (src, srca, ma, d, 0, m);
-		FbInOverC (src, srca, ma, d, 8, n);
-		FbInOverC (src, srca, ma, d, 16, o);
-		d = m|n|o;
+
+		FbByteMulC (src, ma);
+		FbByteMul (ma, srca);
+		ma = ~ma;
+		FbByteMulAddC (d, ma, src);
+		
 		*dst = cvt8888to0565(d);
 	    }
 	    dst++;


More information about the xorg-commit mailing list