Make separate gray scanline storers.
authorSøren Sandmann Pedersen <ssp@redhat.com>
Sun, 30 May 2010 22:26:28 +0000 (18:26 -0400)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Sat, 19 Jun 2010 00:33:02 +0000 (20:33 -0400)
For gray formats the palettes are indexed by luminance, not RGB, so we
can't use the color storers for gray too.

pixman/pixman-access.c
test/blitters-test.c

index 9f2af26..9708b10 100644 (file)
@@ -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 */
index 29c2515..2673968 100644 (file)
@@ -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);
 }