Remove the class field from source_image_t
authorSøren Sandmann Pedersen <ssp@redhat.com>
Wed, 20 Oct 2010 20:09:44 +0000 (16:09 -0400)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Wed, 20 Oct 2010 20:09:44 +0000 (16:09 -0400)
The linear gradient was the only image type that relied on the class
being stored in the image struct itself. With the previous changes, it
doesn't need that anymore, so we can delete the field.

pixman/pixman-image.c
pixman/pixman-linear-gradient.c
pixman/pixman-private.h
pixman/pixman-solid-fill.c

index 7a9c423..fabcd63 100644 (file)
@@ -48,7 +48,6 @@ _pixman_init_gradient (gradient_t *                  gradient,
     gradient->n_stops = n_stops;
 
     gradient->stop_range = 0xffff;
-    gradient->common.class = SOURCE_IMAGE_CLASS_UNKNOWN;
 
     return TRUE;
 }
index c6ac980..b048e7b 100644 (file)
@@ -44,8 +44,9 @@ linear_gradient_classify (pixman_image_t *image,
     pixman_fixed_32_32_t l;
     pixman_fixed_48_16_t dx, dy;
     double inc;
+    source_image_class_t class;
 
-    source->class = SOURCE_IMAGE_CLASS_UNKNOWN;
+    class = SOURCE_IMAGE_CLASS_UNKNOWN;
 
     if (source->common.transform)
     {
@@ -54,7 +55,7 @@ linear_gradient_classify (pixman_image_t *image,
            source->common.transform->matrix[2][1] != 0 ||
            source->common.transform->matrix[2][2] == 0)
        {
-           return source->class;
+           return class;
        }
 
        v.vector[0] = source->common.transform->matrix[0][1];
@@ -74,7 +75,7 @@ linear_gradient_classify (pixman_image_t *image,
     l = dx * dx + dy * dy;
 
     if (l == 0)
-       return source->class;   
+       return class;   
 
     /*
      * compute how much the input of the gradient walked changes
@@ -86,9 +87,9 @@ linear_gradient_classify (pixman_image_t *image,
 
     /* check that casting to integer would result in 0 */
     if (-1 < inc && inc < 1)
-       source->class = SOURCE_IMAGE_CLASS_HORIZONTAL;
+       class = SOURCE_IMAGE_CLASS_HORIZONTAL;
 
-    return source->class;
+    return class;
 }
 
 static void
@@ -253,7 +254,6 @@ pixman_image_create_linear_gradient (pixman_point_fixed_t *        p1,
     linear->p2 = *p2;
 
     image->type = LINEAR;
-    image->source.class = SOURCE_IMAGE_CLASS_UNKNOWN;
     image->common.classify = linear_gradient_classify;
     image->common.property_changed = linear_gradient_property_changed;
 
index 77f629a..c43172b 100644 (file)
@@ -111,7 +111,6 @@ struct image_common
 struct source_image
 {
     image_common_t common;
-    source_image_class_t class;
 };
 
 struct solid_fill
index 44f3362..1d911e9 100644 (file)
@@ -66,7 +66,7 @@ solid_fill_classify (pixman_image_t *image,
                      int             width,
                      int             height)
 {
-    return (image->source.class = SOURCE_IMAGE_CLASS_HORIZONTAL);
+    return SOURCE_IMAGE_CLASS_HORIZONTAL;
 }
 
 static void
@@ -109,7 +109,6 @@ pixman_image_create_solid_fill (pixman_color_t *color)
     img->solid.color_32 = color_to_uint32 (color);
     img->solid.color_64 = color_to_uint64 (color);
 
-    img->source.class = SOURCE_IMAGE_CLASS_UNKNOWN;
     img->common.classify = solid_fill_classify;
     img->common.property_changed = solid_fill_property_changed;