pixman: Branch 'master' - 4 commits

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Thu Jul 16 07:49:30 PDT 2009


 pixman/pixman-access.c           |   12 ++--
 pixman/pixman-combine.c.template |    2 
 pixman/pixman-fast-path.c        |   56 ++++++++++---------
 pixman/pixman-mmx.c              |    2 
 pixman/pixman-trap.c             |    2 
 test/composite-test.c            |  113 ++++++++++++++++++++++-----------------
 6 files changed, 108 insertions(+), 79 deletions(-)

New commits:
commit ecc54a7f02dbb6f57043e51173584f96c42fd2cc
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Thu Jul 16 10:38:22 2009 -0400

    Fix combine_src_ca() to fill out all of the destination line.

diff --git a/pixman/pixman-combine.c.template b/pixman/pixman-combine.c.template
index 2cbdb64..4a0e2bd 100644
--- a/pixman/pixman-combine.c.template
+++ b/pixman/pixman-combine.c.template
@@ -1587,7 +1587,7 @@ combine_src_ca (pixman_implementation_t *imp,
 
 	combine_mask_value_ca (&s, &m);
 
-	*(dest) = s;
+	*(dest + i) = s;
     }
 }
 
commit 4df925bb28196974617804d680380522c048dedd
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Thu Jul 16 09:34:22 2009 -0400

    Change composite test to use a rainbow gradient as source.
    
    Also make the destination a yellow patch. This makes the output a bit
    more comparable to the image in the PDF specification.

diff --git a/test/composite-test.c b/test/composite-test.c
index f34b466..49e0220 100644
--- a/test/composite-test.c
+++ b/test/composite-test.c
@@ -10,39 +10,39 @@
 typedef struct {
     const char *name;
     pixman_op_t op;
-} Operator;
-
-static const Operator operators[] = {
-    { "CLEAR", PIXMAN_OP_CLEAR },
-    { "SRC", PIXMAN_OP_SRC },
-    { "DST", PIXMAN_OP_DST },
-    { "OVER", PIXMAN_OP_OVER },
-    { "OVER_REVERSE", PIXMAN_OP_OVER_REVERSE },
-    { "IN", PIXMAN_OP_IN },
-    { "IN_REVERSE", PIXMAN_OP_IN_REVERSE },
-    { "OUT", PIXMAN_OP_OUT },
-    { "OUT_REVERSE", PIXMAN_OP_OUT_REVERSE },
-    { "ATOP", PIXMAN_OP_ATOP },
-    { "ATOP_REVERSE", PIXMAN_OP_ATOP_REVERSE },
-    { "XOR", PIXMAN_OP_XOR },
-    { "ADD", PIXMAN_OP_ADD },
-    { "SATURATE", PIXMAN_OP_SATURATE },
-
-    { "MULTIPLY", PIXMAN_OP_MULTIPLY },
-    { "SCREEN", PIXMAN_OP_SCREEN },
-    { "OVERLAY", PIXMAN_OP_OVERLAY },
-    { "DARKEN", PIXMAN_OP_DARKEN },
-    { "LIGHTEN", PIXMAN_OP_LIGHTEN },
-    { "COLOR_DODGE", PIXMAN_OP_COLOR_DODGE },
-    { "COLOR_BURN", PIXMAN_OP_COLOR_BURN },
-    { "HARD_LIGHT", PIXMAN_OP_HARD_LIGHT },
-    { "SOFT_LIGHT", PIXMAN_OP_SOFT_LIGHT },
-    { "DIFFERENCE", PIXMAN_OP_DIFFERENCE },
-    { "EXCLUSION", PIXMAN_OP_EXCLUSION },
-    { "HSL_HUE", PIXMAN_OP_HSL_HUE },
-    { "HSL_SATURATION", PIXMAN_OP_HSL_SATURATION },
-    { "HSL_COLOR", PIXMAN_OP_HSL_COLOR },
-    { "HSL_LUMINOSITY", PIXMAN_OP_HSL_LUMINOSITY },
+} operator_t;
+
+static const operator_t operators[] = {
+    { "CLEAR",		PIXMAN_OP_CLEAR },
+    { "SRC",		PIXMAN_OP_SRC },
+    { "DST",		PIXMAN_OP_DST },
+    { "OVER",		PIXMAN_OP_OVER },
+    { "OVER_REVERSE",	PIXMAN_OP_OVER_REVERSE },
+    { "IN",		PIXMAN_OP_IN },
+    { "IN_REVERSE",	PIXMAN_OP_IN_REVERSE },
+    { "OUT",		PIXMAN_OP_OUT },
+    { "OUT_REVERSE",	PIXMAN_OP_OUT_REVERSE },
+    { "ATOP",		PIXMAN_OP_ATOP },
+    { "ATOP_REVERSE",	PIXMAN_OP_ATOP_REVERSE },
+    { "XOR",		PIXMAN_OP_XOR },
+    { "ADD",		PIXMAN_OP_ADD },
+    { "SATURATE",	PIXMAN_OP_SATURATE },
+
+    { "MULTIPLY",	PIXMAN_OP_MULTIPLY },
+    { "SCREEN",		PIXMAN_OP_SCREEN },
+    { "OVERLAY",	PIXMAN_OP_OVERLAY },
+    { "DARKEN",		PIXMAN_OP_DARKEN },
+    { "LIGHTEN",	PIXMAN_OP_LIGHTEN },
+    { "COLOR_DODGE",	PIXMAN_OP_COLOR_DODGE },
+    { "COLOR_BURN",	PIXMAN_OP_COLOR_BURN },
+    { "HARD_LIGHT",	PIXMAN_OP_HARD_LIGHT },
+    { "SOFT_LIGHT",	PIXMAN_OP_SOFT_LIGHT },
+    { "DIFFERENCE",	PIXMAN_OP_DIFFERENCE },
+    { "EXCLUSION",	PIXMAN_OP_EXCLUSION },
+    { "HSL_HUE",	PIXMAN_OP_HSL_HUE },
+    { "HSL_SATURATION",	PIXMAN_OP_HSL_SATURATION },
+    { "HSL_COLOR",	PIXMAN_OP_HSL_COLOR },
+    { "HSL_LUMINOSITY",	PIXMAN_OP_HSL_LUMINOSITY },
 };
 
 static uint32_t
@@ -83,12 +83,30 @@ writer (void *src, uint32_t value, int size)
 int
 main (int argc, char **argv)
 {
+#define d2f pixman_double_to_fixed
+    
     GtkWidget *window, *swindow;
     GtkWidget *table;
     uint32_t *dest = malloc (WIDTH * HEIGHT * 4);
     uint32_t *src = malloc (WIDTH * HEIGHT * 4);
     pixman_image_t *src_img;
     pixman_image_t *dest_img;
+    pixman_point_fixed_t p1 = { -10 << 0, 0 };
+    pixman_point_fixed_t p2 = { WIDTH << 16, (HEIGHT - 10) << 16 };
+    uint16_t full = 0xcfff;
+    uint16_t low  = 0x5000;
+    uint16_t alpha = 0xffff;
+    pixman_gradient_stop_t stops[6] =
+    {
+	{ d2f (0.0), { full, low, low, alpha } },
+	{ d2f (0.25), { full, full, low, alpha } },
+	{ d2f (0.4), { low, full, low, alpha } },
+	{ d2f (0.5), { low, full, full, alpha } },
+	{ d2f (0.8), { low, low, full, alpha } },
+	{ d2f (1.0), { full, low, full, alpha } },
+    };
+	
+	    
     int i;
 
     gtk_init (&argc, &argv);
@@ -102,27 +120,24 @@ main (int argc, char **argv)
 		      NULL);
     table = gtk_table_new (G_N_ELEMENTS (operators) / 6, 6, TRUE);
 
-    for (i = 0; i < WIDTH * HEIGHT; ++i)
-        src[i] = 0x7f7f0000; /* red */
-
-    src_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
-					WIDTH, HEIGHT,
-					src,
-					WIDTH * 4);
-    pixman_image_set_accessors (src_img, reader, writer);
+    src_img = pixman_image_create_linear_gradient (&p1, &p2, stops,
+						   sizeof (stops) / sizeof (stops[0]));
 
+    pixman_image_set_repeat (src_img, PIXMAN_REPEAT_PAD);
+    
     dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
 					 WIDTH, HEIGHT,
 					 dest,
 					 WIDTH * 4);
     pixman_image_set_accessors (dest_img, reader, writer);
 
-    for (i = 0; i < G_N_ELEMENTS (operators); ++i) {
-        int j;
+    for (i = 0; i < G_N_ELEMENTS (operators); ++i)
+    {
 	GtkWidget *image;
 	GdkPixbuf *pixbuf;
 	GtkWidget *vbox;
 	GtkWidget *label;
+	int j, k;
 
 	vbox = gtk_vbox_new (FALSE, 0);
 
@@ -130,9 +145,11 @@ main (int argc, char **argv)
 	gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 6);
 	gtk_widget_show (label);
 
-	for (j = 0; j < WIDTH * HEIGHT; ++j)
-	    dest[j] = 0x7f00007f; /* blue */
-
+	for (j = 0; j < HEIGHT; ++j)
+	{
+	    for (k = 0; k < WIDTH; ++k)
+		dest[j * WIDTH + k] = 0x7f6f6f00;
+	}
 	pixman_image_composite (operators[i].op, src_img, NULL, dest_img,
 				0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
 	pixbuf = pixbuf_from_argb32 (pixman_image_get_data (dest_img), TRUE,
@@ -155,7 +172,9 @@ main (int argc, char **argv)
 
     swindow = gtk_scrolled_window_new (NULL, NULL);
     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
-				    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+				    GTK_POLICY_AUTOMATIC,
+				    GTK_POLICY_AUTOMATIC);
+    
     gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (swindow), table);
     gtk_widget_show (table);
 
commit 4f369faffa7670e0e57c83c298359992223a998b
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Thu Jul 16 06:23:25 2009 -0400

    Various minor formatting changes

diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 8b819ca..e27bd8c 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -147,7 +147,9 @@ fast_composite_over_x888_8_8888 (pixman_implementation_t *imp,
 		s = *src | 0xff000000;
 
 		if (m == 0xff)
+		{
 		    *dst = s;
+		}
 		else
 		{
 		    d = in (s, m);
@@ -202,14 +204,12 @@ fast_composite_in_n_8_8 (pixman_implementation_t *imp,
 	    while (w--)
 	    {
 		m = *mask++;
+
 		if (m == 0)
-		{
 		    *dst = 0;
-		}
 		else if (m != 0xff)
-		{
 		    *dst = MUL_UN8 (m, *dst, t);
-		}
+
 		dst++;
 	    }
 	}
@@ -228,14 +228,12 @@ fast_composite_in_n_8_8 (pixman_implementation_t *imp,
 	    {
 		m = *mask++;
 		m = MUL_UN8 (m, srca, t);
+
 		if (m == 0)
-		{
 		    *dst = 0;
-		}
 		else if (m != 0xff)
-		{
 		    *dst = MUL_UN8 (m, *dst, t);
-		}
+
 		dst++;
 	    }
 	}
@@ -278,14 +276,12 @@ fast_composite_in_8_8 (pixman_implementation_t *imp,
 	while (w--)
 	{
 	    s = *src++;
+
 	    if (s == 0)
-	    {
 		*dst = 0;
-	    }
 	    else if (s != 0xff)
-	    {
 		*dst = MUL_UN8 (s, *dst, t);
-	    }
+
 	    dst++;
 	}
     }
@@ -459,7 +455,9 @@ fast_composite_over_n_8_0888 (pixman_implementation_t *imp,
 	    if (m == 0xff)
 	    {
 		if (srca == 0xff)
+		{
 		    d = src;
+		}
 		else
 		{
 		    d = fetch_24 (dst);
@@ -522,7 +520,9 @@ fast_composite_over_n_8_0565 (pixman_implementation_t *imp,
 	    if (m == 0xff)
 	    {
 		if (srca == 0xff)
+		{
 		    d = src;
+		}
 		else
 		{
 		    d = *dst;
@@ -662,19 +662,19 @@ fast_composite_over_8888_8888 (pixman_implementation_t *imp,
 }
 
 static void
-fast_composite_src_8888_0888 (pixman_implementation_t *imp,
-                              pixman_op_t              op,
-                              pixman_image_t *         src_image,
-                              pixman_image_t *         mask_image,
-                              pixman_image_t *         dst_image,
-                              int32_t                  src_x,
-                              int32_t                  src_y,
-                              int32_t                  mask_x,
-                              int32_t                  mask_y,
-                              int32_t                  dest_x,
-                              int32_t                  dest_y,
-                              int32_t                  width,
-                              int32_t                  height)
+fast_composite_over_8888_0888 (pixman_implementation_t *imp,
+			       pixman_op_t              op,
+			       pixman_image_t *         src_image,
+			       pixman_image_t *         mask_image,
+			       pixman_image_t *         dst_image,
+			       int32_t                  src_x,
+			       int32_t                  src_y,
+			       int32_t                  mask_x,
+			       int32_t                  mask_y,
+			       int32_t                  dest_x,
+			       int32_t                  dest_y,
+			       int32_t                  width,
+			       int32_t                  height)
 {
     uint8_t     *dst_line, *dst;
     uint32_t d;
@@ -752,7 +752,9 @@ fast_composite_over_8888_0565 (pixman_implementation_t *imp,
 	    if (s)
 	    {
 		if (a == 0xff)
+		{
 		    d = s;
+		}
 		else
 		{
 		    d = *dst;
@@ -983,10 +985,14 @@ fast_composite_solid_fill (pixman_implementation_t *imp,
     src = _pixman_image_get_solid (src_image, dst_image->bits.format);
 
     if (dst_image->bits.format == PIXMAN_a8)
+    {
 	src = src >> 24;
+    }
     else if (dst_image->bits.format == PIXMAN_r5g6b5 ||
              dst_image->bits.format == PIXMAN_b5g6r5)
+    {
 	src = CONVERT_8888_TO_0565 (src);
+    }
 
     pixman_fill (dst_image->bits.bits, dst_image->bits.rowstride,
                  PIXMAN_FORMAT_BPP (dst_image->bits.format),
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 713b9f0..7d4ec4f 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -3206,7 +3206,9 @@ mmx_composite_over_x888_8_8888 (pixman_implementation_t *imp,
 		__m64 s = load8888 (*src | 0xff000000);
 
 		if (m == 0xff)
+		{
 		    *dst = store8888 (s);
+		}
 		else
 		{
 		    __m64 sa = expand_alpha (s);
diff --git a/pixman/pixman-trap.c b/pixman/pixman-trap.c
index 5cb83f5..4d7a90a 100644
--- a/pixman/pixman-trap.c
+++ b/pixman/pixman-trap.c
@@ -284,6 +284,7 @@ pixman_add_traps (pixman_image_t * image,
     }
 }
 
+#if 0
 static void
 dump_image (pixman_image_t *image,
             const char *    title)
@@ -309,6 +310,7 @@ dump_image (pixman_image_t *image,
 	printf ("\n");
     }
 }
+#endif
 
 PIXMAN_EXPORT void
 pixman_add_trapezoids (pixman_image_t *          image,
commit 3d3baa3c5e76a4f851614a7794d92d15a56ac04e
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Thu Jul 16 06:06:17 2009 -0400

    Change name of macro from RGB16_TO_ENTRY to RGB15_TO_ENTRY

diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index d21c587..64f3b7f 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -45,11 +45,11 @@
      (((s) >> 6) & 0x03e0) |                                            \
      (((s) >> 9) & 0x7c00))
 
-#define RGB16_TO_ENTRY(mif,rgb15)					\
+#define RGB15_TO_ENTRY(mif,rgb15)					\
     ((mif)->ent[rgb15])
 
 #define RGB24_TO_ENTRY(mif,rgb24)					\
-    RGB16_TO_ENTRY (mif,CONVERT_RGB24_TO_RGB15 (rgb24))
+    RGB15_TO_ENTRY (mif,CONVERT_RGB24_TO_RGB15 (rgb24))
 
 #define RGB24_TO_ENTRY_Y(mif,rgb24)					\
     ((mif)->ent[CONVERT_RGB24_TO_Y15 (rgb24)])
@@ -86,7 +86,7 @@
     ((uint8_t *) ((bits) + offset0 +                                    \
                   ((stride) >> 1) * ((line) >> 1)))
 
-/*********************************** Fetch ************************************/
+/********************************** Fetch ************************************/
 
 static void
 fetch_scanline_a8r8g8b8 (pixman_image_t *image,
@@ -161,9 +161,9 @@ fetch_scanline_x8b8g8r8 (pixman_image_t *image,
     {
 	uint32_t p = READ (image, pixel++);
 	
-	*buffer++ = 0xff000000 |
-	    (p & 0x0000ff00) |
-	    ((p >> 16) & 0xff) |
+	*buffer++ = 0xff000000		|
+	    (p & 0x0000ff00)		|
+	    ((p >> 16) & 0xff)		|
 	    ((p & 0xff) << 16);
     }
 }


More information about the xorg-commit mailing list