[Pixman] [PATCH] Delete the source_image_t struct.

Søren Sandmann sandmann at daimi.au.dk
Sat Oct 30 22:44:34 PDT 2010


From: Søren Sandmann Pedersen <ssp at redhat.com>

It serves no purpose anymore now that the source_class_t field is gone.
---
 pixman/pixman-conical-gradient.c |   17 ++++++++---------
 pixman/pixman-linear-gradient.c  |   30 ++++++++++++++----------------
 pixman/pixman-private.h          |   11 ++---------
 pixman/pixman-radial-gradient.c  |   19 +++++++++----------
 4 files changed, 33 insertions(+), 44 deletions(-)

diff --git a/pixman/pixman-conical-gradient.c b/pixman/pixman-conical-gradient.c
index 897948b..a3685d1 100644
--- a/pixman/pixman-conical-gradient.c
+++ b/pixman/pixman-conical-gradient.c
@@ -58,8 +58,7 @@ conical_gradient_get_scanline_32 (pixman_image_t *image,
                                   uint32_t *      buffer,
                                   const uint32_t *mask)
 {
-    source_image_t *source = (source_image_t *)image;
-    gradient_t *gradient = (gradient_t *)source;
+    gradient_t *gradient = (gradient_t *)image;
     conical_gradient_t *conical = (conical_gradient_t *)image;
     uint32_t       *end = buffer + width;
     pixman_gradient_walker_t walker;
@@ -71,9 +70,9 @@ conical_gradient_get_scanline_32 (pixman_image_t *image,
     double ry = y + 0.5;
     double rz = 1.;
 
-    _pixman_gradient_walker_init (&walker, gradient, source->common.repeat);
+    _pixman_gradient_walker_init (&walker, gradient, image->common.repeat);
 
-    if (source->common.transform)
+    if (image->common.transform)
     {
 	pixman_vector_t v;
 
@@ -82,19 +81,19 @@ conical_gradient_get_scanline_32 (pixman_image_t *image,
 	v.vector[1] = pixman_int_to_fixed (y) + pixman_fixed_1 / 2;
 	v.vector[2] = pixman_fixed_1;
 
-	if (!pixman_transform_point_3d (source->common.transform, &v))
+	if (!pixman_transform_point_3d (image->common.transform, &v))
 	    return;
 
-	cx = source->common.transform->matrix[0][0] / 65536.;
-	cy = source->common.transform->matrix[1][0] / 65536.;
-	cz = source->common.transform->matrix[2][0] / 65536.;
+	cx = image->common.transform->matrix[0][0] / 65536.;
+	cy = image->common.transform->matrix[1][0] / 65536.;
+	cz = image->common.transform->matrix[2][0] / 65536.;
 
 	rx = v.vector[0] / 65536.;
 	ry = v.vector[1] / 65536.;
 	rz = v.vector[2] / 65536.;
 
 	affine =
-	    source->common.transform->matrix[2][0] == 0 &&
+	    image->common.transform->matrix[2][0] == 0 &&
 	    v.vector[2] == pixman_fixed_1;
     }
 
diff --git a/pixman/pixman-linear-gradient.c b/pixman/pixman-linear-gradient.c
index b048e7b..1547882 100644
--- a/pixman/pixman-linear-gradient.c
+++ b/pixman/pixman-linear-gradient.c
@@ -38,7 +38,6 @@ linear_gradient_classify (pixman_image_t *image,
                           int             width,
                           int             height)
 {
-    source_image_t *source = (source_image_t *)image;
     linear_gradient_t *linear = (linear_gradient_t *)image;
     pixman_vector_t v;
     pixman_fixed_32_32_t l;
@@ -48,19 +47,19 @@ linear_gradient_classify (pixman_image_t *image,
 
     class = SOURCE_IMAGE_CLASS_UNKNOWN;
 
-    if (source->common.transform)
+    if (image->common.transform)
     {
 	/* projective transformation */
-	if (source->common.transform->matrix[2][0] != 0 ||
-	    source->common.transform->matrix[2][1] != 0 ||
-	    source->common.transform->matrix[2][2] == 0)
+	if (image->common.transform->matrix[2][0] != 0 ||
+	    image->common.transform->matrix[2][1] != 0 ||
+	    image->common.transform->matrix[2][2] == 0)
 	{
 	    return class;
 	}
 
-	v.vector[0] = source->common.transform->matrix[0][1];
-	v.vector[1] = source->common.transform->matrix[1][1];
-	v.vector[2] = source->common.transform->matrix[2][2];
+	v.vector[0] = image->common.transform->matrix[0][1];
+	v.vector[1] = image->common.transform->matrix[1][1];
+	v.vector[2] = image->common.transform->matrix[2][2];
     }
     else
     {
@@ -104,26 +103,25 @@ linear_gradient_get_scanline_32 (pixman_image_t *image,
     pixman_fixed_32_32_t l;
     pixman_fixed_48_16_t dx, dy;
     gradient_t *gradient = (gradient_t *)image;
-    source_image_t *source = (source_image_t *)image;
     linear_gradient_t *linear = (linear_gradient_t *)image;
     uint32_t *end = buffer + width;
     pixman_gradient_walker_t walker;
 
-    _pixman_gradient_walker_init (&walker, gradient, source->common.repeat);
+    _pixman_gradient_walker_init (&walker, gradient, image->common.repeat);
 
     /* reference point is the center of the pixel */
     v.vector[0] = pixman_int_to_fixed (x) + pixman_fixed_1 / 2;
     v.vector[1] = pixman_int_to_fixed (y) + pixman_fixed_1 / 2;
     v.vector[2] = pixman_fixed_1;
 
-    if (source->common.transform)
+    if (image->common.transform)
     {
-	if (!pixman_transform_point_3d (source->common.transform, &v))
+	if (!pixman_transform_point_3d (image->common.transform, &v))
 	    return;
-	
-	unit.vector[0] = source->common.transform->matrix[0][0];
-	unit.vector[1] = source->common.transform->matrix[1][0];
-	unit.vector[2] = source->common.transform->matrix[2][0];
+
+	unit.vector[0] = image->common.transform->matrix[0][0];
+	unit.vector[1] = image->common.transform->matrix[1][0];
+	unit.vector[2] = image->common.transform->matrix[2][0];
     }
     else
     {
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 497c3fb..b37d9c8 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -20,7 +20,6 @@
  * Images
  */
 typedef struct image_common image_common_t;
-typedef struct source_image source_image_t;
 typedef struct solid_fill solid_fill_t;
 typedef struct gradient gradient_t;
 typedef struct linear_gradient linear_gradient_t;
@@ -108,14 +107,9 @@ struct image_common
     pixman_format_code_t	extended_format_code;
 };
 
-struct source_image
-{
-    image_common_t common;
-};
-
 struct solid_fill
 {
-    source_image_t common;
+    image_common_t common;
     pixman_color_t color;
     
     uint32_t	   color_32;
@@ -124,7 +118,7 @@ struct solid_fill
 
 struct gradient
 {
-    source_image_t          common;
+    image_common_t	    common;
     int                     n_stops;
     pixman_gradient_stop_t *stops;
     int                     stop_range;
@@ -193,7 +187,6 @@ union pixman_image
     image_type_t       type;
     image_common_t     common;
     bits_image_t       bits;
-    source_image_t     source;
     gradient_t         gradient;
     linear_gradient_t  linear;
     conical_gradient_t conical;
diff --git a/pixman/pixman-radial-gradient.c b/pixman/pixman-radial-gradient.c
index f0dcc96..b595ba7 100644
--- a/pixman/pixman-radial-gradient.c
+++ b/pixman/pixman-radial-gradient.c
@@ -219,7 +219,6 @@ radial_gradient_get_scanline_32 (pixman_image_t *image,
      */
 
     gradient_t *gradient = (gradient_t *)image;
-    source_image_t *source = (source_image_t *)image;
     radial_gradient_t *radial = (radial_gradient_t *)image;
     uint32_t *end = buffer + width;
     pixman_gradient_walker_t walker;
@@ -230,16 +229,16 @@ radial_gradient_get_scanline_32 (pixman_image_t *image,
     v.vector[1] = pixman_int_to_fixed (y) + pixman_fixed_1 / 2;
     v.vector[2] = pixman_fixed_1;
 
-    _pixman_gradient_walker_init (&walker, gradient, source->common.repeat);
+    _pixman_gradient_walker_init (&walker, gradient, image->common.repeat);
 
-    if (source->common.transform)
+    if (image->common.transform)
     {
-	if (!pixman_transform_point_3d (source->common.transform, &v))
+	if (!pixman_transform_point_3d (image->common.transform, &v))
 	    return;
 	
-	unit.vector[0] = source->common.transform->matrix[0][0];
-	unit.vector[1] = source->common.transform->matrix[1][0];
-	unit.vector[2] = source->common.transform->matrix[2][0];
+	unit.vector[0] = image->common.transform->matrix[0][0];
+	unit.vector[1] = image->common.transform->matrix[1][0];
+	unit.vector[2] = image->common.transform->matrix[2][0];
     }
     else
     {
@@ -309,7 +308,7 @@ radial_gradient_get_scanline_32 (pixman_image_t *image,
 						radial->delta.radius,
 						radial->mindr,
 						&walker,
-						source->common.repeat);
+						image->common.repeat);
 	    }
 
 	    b += db;
@@ -354,14 +353,14 @@ radial_gradient_get_scanline_32 (pixman_image_t *image,
 						    radial->delta.radius,
 						    radial->mindr,
 						    &walker,
-						    source->common.repeat);
+						    image->common.repeat);
 		}
 		else
 		{
 		    *buffer = 0;
 		}
 	    }
-	    
+
 	    ++buffer;
 
 	    v.vector[0] += unit.vector[0];
-- 
1.6.0.6



More information about the Pixman mailing list