Move read and write functions to the bits_image_t struct.
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Sat, 18 Jul 2009 02:40:41 +0000 (22:40 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Sat, 18 Jul 2009 02:40:41 +0000 (22:40 -0400)
Those fields were duplicated between image_common and bits_image_t
before.

pixman/pixman-access.c
pixman/pixman-accessor.h
pixman/pixman-bits-image.c
pixman/pixman-edge.c
pixman/pixman-fast-path.c
pixman/pixman-general.c
pixman/pixman-image.c
pixman/pixman-private.h
pixman/pixman-utils.c

index 64f3b7f..19f70d7 100644 (file)
@@ -3444,7 +3444,7 @@ _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)
+    if (image->read_func || image->write_func)
        _pixman_bits_image_setup_raw_accessors_accessors (image);
     else
        setup_accessors (image);
index a72c52a..90c8ea7 100644 (file)
@@ -3,9 +3,9 @@
 #define ACCESS(sym) sym##_accessors
 
 #define READ(img, ptr)                                                 \
-    ((img)->common.read_func ((ptr), sizeof(*(ptr))))
+    (((bits_image_t *)(img))->read_func ((ptr), sizeof(*(ptr))))
 #define WRITE(img, ptr,val)                                            \
-    ((img)->common.write_func ((ptr), (val), sizeof (*(ptr))))
+    (((bits_image_t *)(img))->write_func ((ptr), (val), sizeof (*(ptr))))
 
 #define MEMCPY_WRAPPED(img, dst, src, size)                            \
     do {                                                               \
index e366c85..75c5d3a 100644 (file)
@@ -954,6 +954,8 @@ pixman_image_create_bits (pixman_format_code_t format,
     image->bits.height = height;
     image->bits.bits = bits;
     image->bits.free_me = free_me;
+    image->bits.read_func = NULL;
+    image->bits.write_func = NULL;
 
     /* The rowstride is stored in number of uint32_t */
     image->bits.rowstride = rowstride_bytes / (int) sizeof (uint32_t);
index 80e1e5c..81a2e96 100644 (file)
@@ -370,7 +370,9 @@ pixman_rasterize_edges (pixman_image_t *image,
                         pixman_fixed_t  t,
                         pixman_fixed_t  b)
 {
-    if (image->common.read_func || image->common.write_func)
+    return_if_fail (image->type == BITS);
+    
+    if (image->bits.read_func || image->bits.write_func)
        pixman_rasterize_edges_accessors (image, l, r, t, b);
     else
        pixman_rasterize_edges_no_accessors (image, l, r, t, b);
index e27bd8c..8de922f 100644 (file)
@@ -1217,8 +1217,8 @@ fast_path_composite (pixman_implementation_t *imp,
         && (src->common.filter == PIXMAN_FILTER_NEAREST)
         && PIXMAN_FORMAT_BPP (dest->bits.format) == 32
         && src->bits.format == dest->bits.format
-        && !src->common.read_func && !src->common.write_func
-        && !dest->common.read_func && !dest->common.write_func)
+        && !src->bits.read_func && !src->bits.write_func
+        && !dest->bits.read_func && !dest->bits.write_func)
     {
        /* ensure that the transform matrix only has a scale */
        if (src->common.transform->matrix[0][1] == 0 &&
index df98b98..898474f 100644 (file)
@@ -134,7 +134,7 @@ general_composite_rect  (pixman_implementation_t *imp,
      */
     if (!wide &&
         !dest->common.alpha_map &&
-        !dest->common.write_func &&
+        !dest->bits.write_func &&
         (op == PIXMAN_OP_ADD || op == PIXMAN_OP_OVER) &&
         (dest->bits.format == PIXMAN_a8r8g8b8 ||
          dest->bits.format == PIXMAN_x8r8g8b8))
index f6bda58..8b4fb64 100644 (file)
@@ -115,8 +115,6 @@ _pixman_image_allocate (void)
        common->alpha_map = NULL;
        common->component_alpha = FALSE;
        common->ref_count = 1;
-       common->read_func = NULL;
-       common->write_func = NULL;
        common->classify = NULL;
        common->client_clip = FALSE;
        common->destroy_func = NULL;
@@ -450,10 +448,13 @@ pixman_image_set_accessors (pixman_image_t *           image,
 {
     return_if_fail (image != NULL);
 
-    image->common.read_func = read_func;
-    image->common.write_func = write_func;
+    if (image->type == BITS)
+    {
+       image->bits.read_func = read_func;
+       image->bits.write_func = write_func;
 
-    image_property_changed (image);
+       image_property_changed (image);
+    }
 }
 
 PIXMAN_EXPORT uint32_t *
index 07259a0..052f3a9 100644 (file)
@@ -88,8 +88,6 @@ struct image_common
     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;
     classify_func_t             classify;
     property_changed_func_t     property_changed;
     fetch_scanline_t            get_scanline_32;
index b011601..3dfacde 100644 (file)
@@ -678,11 +678,11 @@ _pixman_run_fast_path (const pixman_fast_path_t *paths,
         && (!mask || (mask->common.filter != PIXMAN_FILTER_CONVOLUTION &&
                       mask->common.repeat != PIXMAN_REPEAT_PAD &&
                       mask->common.repeat != PIXMAN_REPEAT_REFLECT))
-        && !src->common.read_func && !src->common.write_func
-        && !(mask && mask->common.read_func)
-        && !(mask && mask->common.write_func)
-        && !dest->common.read_func
-        && !dest->common.write_func)
+        && !src->bits.read_func && !src->bits.write_func
+        && !(mask && mask->bits.read_func)
+        && !(mask && mask->bits.write_func)
+        && !dest->bits.read_func
+        && !dest->bits.write_func)
     {
        const pixman_fast_path_t *info;
        pixman_bool_t pixbuf;