[Pixman] [PATCH] Make separate gray scanline storers from the color ones.

Søren Sandmann Pedersen sandmann at daimi.au.dk
Thu Jun 10 14:58:29 PDT 2010


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

For gray formats the palettes are indexed by luminance, not RGB, so we
can't reuse the color storers for gray formats.
---
 pixman/pixman-access.c |   40 +++++++++++++++++++++++++++++++++++++---
 test/blitters-test.c   |    2 +-
 2 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 9f2af26..9708b10 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -2385,6 +2385,22 @@ store_scanline_c8 (bits_image_t *  image,
 }
 
 static void
+store_scanline_g8 (bits_image_t *  image,
+                   int             x,
+                   int             y,
+                   int             width,
+                   const uint32_t *values)
+{
+    uint32_t *bits = image->bits + image->rowstride * y;
+    uint8_t *pixel = ((uint8_t *) bits) + x;
+    const pixman_indexed_t *indexed = image->indexed;
+    int i;
+
+    for (i = 0; i < width; ++i)
+	WRITE (image, pixel++, RGB24_TO_ENTRY_Y (indexed,values[i]));
+}
+
+static void
 store_scanline_x4a4 (bits_image_t *  image,
                      int             x,
                      int             y,
@@ -2555,6 +2571,26 @@ store_scanline_c4 (bits_image_t *  image,
 }
 
 static void
+store_scanline_g4 (bits_image_t *  image,
+                   int             x,
+                   int             y,
+                   int             width,
+                   const uint32_t *values)
+{
+    uint32_t *bits = image->bits + image->rowstride * y;
+    const pixman_indexed_t *indexed = image->indexed;
+    int i;
+    
+    for (i = 0; i < width; ++i)
+    {
+	uint32_t pixel;
+	
+	pixel = RGB24_TO_ENTRY_Y (indexed, values[i]);
+	STORE_4 (image, bits, i + x, pixel);
+    }
+}
+
+static void
 store_scanline_a1 (bits_image_t *  image,
                    int             x,
                    int             y,
@@ -2746,7 +2782,6 @@ static const format_info_t accessors[] =
     
 #define fetch_scanline_g8 fetch_scanline_c8
 #define fetch_pixel_g8 fetch_pixel_c8
-#define store_scanline_g8 store_scanline_c8
     FORMAT_INFO (g8),
     
 #define fetch_scanline_x4c4 fetch_scanline_c8
@@ -2756,7 +2791,7 @@ static const format_info_t accessors[] =
     
 #define fetch_scanline_x4g4 fetch_scanline_c8
 #define fetch_pixel_x4g4 fetch_pixel_c8
-#define store_scanline_x4g4 store_scanline_c8
+#define store_scanline_x4g4 store_scanline_g8
     FORMAT_INFO (x4g4),
     
     FORMAT_INFO (x4a4),
@@ -2772,7 +2807,6 @@ static const format_info_t accessors[] =
     
 #define fetch_scanline_g4 fetch_scanline_c4
 #define fetch_pixel_g4 fetch_pixel_c4
-#define store_scanline_g4 store_scanline_c4
     FORMAT_INFO (g4),
     
 /* 1bpp formats */
diff --git a/test/blitters-test.c b/test/blitters-test.c
index 29c2515..2673968 100644
--- a/test/blitters-test.c
+++ b/test/blitters-test.c
@@ -426,6 +426,6 @@ main (int argc, const char *argv[])
 {
     initialize_palette();
 
-    return fuzzer_test_main("blitters", 2000000, 0xF3A16994,
+    return fuzzer_test_main("blitters", 2000000, 0xD09B1C03,
 			    test_composite, argc, argv);
 }
-- 
1.6.0.6



More information about the Pixman mailing list