Move some code around - use image->fetch_pixel in FbFetchSolid
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Fri, 22 May 2009 12:15:35 +0000 (08:15 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Tue, 2 Jun 2009 20:54:09 +0000 (16:54 -0400)
pixman/pixman-bits-image.c

index 396688d..33f5a30 100644 (file)
 #define READ_ACCESS(f) ((image->common.read_func)? f##_accessors : f)
 #define WRITE_ACCESS(f) ((image->common.write_func)? f##_accessors : f)
 
+/* Store functions */
+
+static void
+bits_image_store_scanline_32 (bits_image_t *image, int x, int y, int width, uint32_t *buffer)
+{
+    uint32_t *bits;
+    int32_t stride;
+    const pixman_indexed_t * indexed = image->indexed;
+
+    bits = image->bits;
+    stride = image->rowstride;
+    bits += y*stride;
+
+    image->store_scanline_raw_32 ((pixman_image_t *)image, bits, buffer, x, width, indexed);
+
+    if (image->common.alpha_map)
+    {
+       x -= image->common.alpha_origin.x;
+       y -= image->common.alpha_origin.y;
+
+       bits_image_store_scanline_32 (image->common.alpha_map, x, y, width, buffer);
+    }
+}
+
+static void
+bits_image_store_scanline_64 (bits_image_t *image, int x, int y, int width, uint32_t *buffer)
+{
+    uint32_t *bits;
+    int32_t stride;
+    const pixman_indexed_t * indexed = image->indexed;
+
+    bits = image->bits;
+    stride = image->rowstride;
+    bits += y*stride;
+
+    image->store_scanline_raw_64 ((pixman_image_t *)image, bits, (uint64_t *)buffer, x, width, indexed);
+
+    if (image->common.alpha_map)
+    {
+       x -= image->common.alpha_origin.x;
+       y -= image->common.alpha_origin.y;
+
+       bits_image_store_scanline_64 (image->common.alpha_map, x, y, width, buffer);
+    }
+}
+
+void
+_pixman_image_store_scanline_32 (bits_image_t *image, int x, int y, int width,
+                                uint32_t *buffer)
+{
+    image->store_scanline_32 (image, x, y, width, buffer);
+}
+
+void
+_pixman_image_store_scanline_64 (bits_image_t *image, int x, int y, int width,
+                                uint32_t *buffer)
+{
+    image->store_scanline_64 (image, x, y, width, buffer);
+}
+
+/* Fetch functions */
 static void
 fbFetchSolid(bits_image_t * image,
             int x, int y, int width,
@@ -46,10 +107,8 @@ fbFetchSolid(bits_image_t * image,
 {
     uint32_t color;
     uint32_t *end;
-    fetchPixelProc32 fetch =
-       READ_ACCESS(pixman_fetchPixelProcForPicture32)(image);
     
-    color = fetch(image, 0, 0);
+    color = image->fetch_pixel(image, 0, 0);
     
     end = buffer + width;
     while (buffer < end)
@@ -63,10 +122,8 @@ fbFetchSolid64(bits_image_t * image,
 {
     uint64_t color;
     uint64_t *end;
-    fetchPixelProc64 fetch =
-       READ_ACCESS(pixman_fetchPixelProcForPicture64)(image);
     
-    color = fetch(image, 0, 0);
+    color = image->fetch_pixel(image, 0, 0);
     
     end = buffer + width;
     while (buffer < end)
@@ -89,49 +146,8 @@ fbFetch64(bits_image_t * image,
     image->fetch_scanline_raw_64(image, x, y, width, buffer);
 }
 
-static void
-bits_image_store_scanline_32 (bits_image_t *image, int x, int y, int width, uint32_t *buffer)
-{
-    uint32_t *bits;
-    int32_t stride;
-    const pixman_indexed_t * indexed = image->indexed;
 
-    bits = image->bits;
-    stride = image->rowstride;
-    bits += y*stride;
 
-    image->store_scanline_raw_32 ((pixman_image_t *)image, bits, buffer, x, width, indexed);
-
-    if (image->common.alpha_map)
-    {
-       x -= image->common.alpha_origin.x;
-       y -= image->common.alpha_origin.y;
-
-       bits_image_store_scanline_32 (image->common.alpha_map, x, y, width, buffer);
-    }
-}
-
-static void
-bits_image_store_scanline_64 (bits_image_t *image, int x, int y, int width, uint32_t *buffer)
-{
-    uint32_t *bits;
-    int32_t stride;
-    const pixman_indexed_t * indexed = image->indexed;
-
-    bits = image->bits;
-    stride = image->rowstride;
-    bits += y*stride;
-
-    image->store_scanline_raw_64 ((pixman_image_t *)image, bits, (uint64_t *)buffer, x, width, indexed);
-
-    if (image->common.alpha_map)
-    {
-       x -= image->common.alpha_origin.x;
-       y -= image->common.alpha_origin.y;
-
-       bits_image_store_scanline_64 (image->common.alpha_map, x, y, width, buffer);
-    }
-}
 
 /* On entry, @buffer should contain @n_pixels (x, y) coordinate pairs, where
  * x and y are both uint32_ts. On exit, buffer will contain the corresponding
@@ -745,21 +761,6 @@ bits_image_property_changed (pixman_image_t *image)
     bits->fetch_pixel = READ_ACCESS(pixman_fetchPixelProcForPicture32)(bits);
 }
 
-
-void
-_pixman_image_store_scanline_32 (bits_image_t *image, int x, int y, int width,
-                                uint32_t *buffer)
-{
-    image->store_scanline_32 (image, x, y, width, buffer);
-}
-
-void
-_pixman_image_store_scanline_64 (bits_image_t *image, int x, int y, int width,
-                                uint32_t *buffer)
-{
-    image->store_scanline_64 (image, x, y, width, buffer);
-}
-
 static uint32_t *
 create_bits (pixman_format_code_t format,
             int                  width,