pixman: Branch 'master' - 5 commits

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Sat Sep 6 22:56:07 PDT 2008


 RELEASING                   |    6 +
 TODO                        |    5 +
 configure.ac                |    2 
 pixman/pixman-image.c       |    4 +
 pixman/pixman-transformed.c |    3 
 test/Makefile.am            |    4 -
 test/clip-test.c            |  159 ++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 177 insertions(+), 6 deletions(-)

New commits:
commit bf76505cc6cc5e54c25eb145748e9e364fb367e9
Author: Søren Sandmann Pedersen <sandmann at daimi.au.dk>
Date:   Sun Sep 7 00:40:09 2008 -0400

    Update TODO

diff --git a/TODO b/TODO
index 9468021..47b9bc9 100644
--- a/TODO
+++ b/TODO
@@ -44,6 +44,11 @@
 
       - Possibly look into inlining the fetch functions
 
+  - There is a bug with source clipping demonstrated by clip-test in the
+    test directory. If we interprete source clipping as given in
+    destination coordinates, which is probably the only sane choice,
+    then the result should have two red bars down the sides.
+    
   - Test suite
 
   - Add a general way of dealing with architecture specific
diff --git a/pixman/pixman-transformed.c b/pixman/pixman-transformed.c
index 8dba26c..5ad92ae 100644
--- a/pixman/pixman-transformed.c
+++ b/pixman/pixman-transformed.c
@@ -593,7 +593,7 @@ ACCESS(fbFetchTransformed)(bits_image_t * pict, int x, int y, int width,
 
     /* This allows filtering code to pretend that pixels are located at integer coordinates */
     adjust (&v, &unit, -(pixman_fixed_1 / 2));
-    
+
     if (pict->common.filter == PIXMAN_FILTER_NEAREST || pict->common.filter == PIXMAN_FILTER_FAST)
     {
 	/* Round down to closest integer, ensuring that 0.5 rounds to 0, not 1 */
@@ -602,7 +602,6 @@ ACCESS(fbFetchTransformed)(bits_image_t * pict, int x, int y, int width,
         if (pict->common.repeat == PIXMAN_REPEAT_NORMAL)
         {
             fbFetchTransformed_Nearest_Normal(pict, width, buffer, mask, maskBits, affine, v, unit);
-
         }
         else if (pict->common.repeat == PIXMAN_REPEAT_PAD)
         {
commit da18a5675b3107c9bf99e228d85619d247fa19a6
Author: Søren Sandmann Pedersen <sandmann at daimi.au.dk>
Date:   Sun Sep 7 00:13:10 2008 -0400

    Extend clip-test to demonstrate a bug in source clipping

diff --git a/test/clip-test.c b/test/clip-test.c
index a52181f..457e97a 100644
--- a/test/clip-test.c
+++ b/test/clip-test.c
@@ -50,13 +50,13 @@ on_expose (GtkWidget *widget, GdkEventExpose *expose, gpointer data)
 }
 
 static void
-show_window (uint32_t *bits, int w, int h, int stride)
+show_window (pixman_image_t *img, int w, int h, int stride)
 {
     GdkPixbuf *pixbuf;
     
     GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
     
-    pixbuf = pixbuf_from_argb32 (bits, w, h, stride);
+    pixbuf = pixbuf_from_argb32 (pixman_image_get_data (img), w, h, stride);
     
     g_signal_connect (window, "expose_event", G_CALLBACK (on_expose), pixbuf);
     g_signal_connect (window, "delete_event", G_CALLBACK (gtk_main_quit), NULL);
@@ -66,16 +66,29 @@ show_window (uint32_t *bits, int w, int h, int stride)
     gtk_main ();
 }
 
-int
-main (int argc, char **argv)
-{
 #define WIDTH 200
 #define HEIGHT 200
     
-    uint32_t *src = malloc (WIDTH * HEIGHT * 4);
-    pixman_image_t *gradient_img;
-    pixman_image_t *src_img;
+static pixman_image_t *
+create_solid_bits (uint32_t pixel)
+{
+    uint32_t *pixels = malloc (WIDTH * HEIGHT * 4);
     int i;
+    
+    for (i = 0; i < WIDTH * HEIGHT; ++i)
+	pixels[i] = pixel;
+
+    return pixman_image_create_bits (PIXMAN_a8r8g8b8,
+				     WIDTH, HEIGHT, 
+				     pixels,
+				     WIDTH * 4);
+}
+
+int
+main (int argc, char **argv)
+{
+    pixman_image_t *gradient_img;
+    pixman_image_t *src_img, *dst_img;
     pixman_gradient_stop_t stops[2] =
 	{
 	    { pixman_int_to_fixed (0), { 0xffff, 0x0000, 0x0000, 0xffff } },
@@ -88,16 +101,17 @@ main (int argc, char **argv)
     pixman_point_fixed_t c_outer;
     pixman_fixed_t r_inner;
     pixman_fixed_t r_outer;
+    pixman_region32_t clip_region;
+    pixman_transform_t trans = {
+	{ { pixman_double_to_fixed (1.3), pixman_double_to_fixed (0), pixman_double_to_fixed (-0.5), },
+	  { pixman_double_to_fixed (0), pixman_double_to_fixed (1), pixman_double_to_fixed (-0.5), },
+	  { pixman_double_to_fixed (0), pixman_double_to_fixed (0), pixman_double_to_fixed (1.0) } 
+	}
+    };
     
     gtk_init (&argc, &argv);
     
-    for (i = 0; i < WIDTH * HEIGHT; ++i)
-	src[i] = 0xFF0000ff; /* pale blue */
-    
-    src_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
-					 WIDTH, HEIGHT, 
-					 src,
-					 WIDTH * 4);
+    src_img = create_solid_bits (0xff0000ff);
     
     c_inner.x = pixman_double_to_fixed (100.0);
     c_inner.y = pixman_double_to_fixed (100.0);
@@ -109,25 +123,37 @@ main (int argc, char **argv)
     gradient_img = pixman_image_create_radial_gradient (&c_inner, &c_outer,
 							r_inner, r_outer,
 							stops, 2);
-    
+
 #if 0
     gradient_img = pixman_image_create_linear_gradient  (&p1, &p2,
 							 stops, 2);
     
 #endif
-    
+
     pixman_image_composite (PIXMAN_OP_OVER, gradient_img, NULL, src_img,
 			    0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
     
+    pixman_region32_init_rect (&clip_region, 50, 0, 100, 200);
+    pixman_image_set_clip_region32 (src_img, &clip_region);
+    pixman_image_set_source_clipping (src_img, TRUE);
+    pixman_image_set_transform (src_img, &trans);
+    pixman_image_set_repeat (src_img, PIXMAN_REPEAT_NORMAL);
+    
+    dst_img = create_solid_bits (0xffff0000);
+    pixman_image_composite (PIXMAN_OP_OVER, src_img, NULL, dst_img,
+			    0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
+    
+
+#if 0
     printf ("0, 0: %x\n", src[0]);
     printf ("10, 10: %x\n", src[10 * 10 + 10]);
     printf ("w, h: %x\n", src[(HEIGHT - 1) * 100 + (WIDTH - 1)]);
+#endif
     
-    show_window (src, WIDTH, HEIGHT, WIDTH);
+    show_window (dst_img, WIDTH, HEIGHT, WIDTH);
     
     pixman_image_unref (gradient_img);
     pixman_image_unref (src_img);
-    free (src);
     
     return 0;
 }
commit 00f3d6ef22b5a062323208fd540a17ca65dca42b
Author: Søren Sandmann Pedersen <sandmann at daimi.au.dk>
Date:   Sat Sep 6 23:49:25 2008 -0400

    Fix bug in pixman_image_is_opaque()
    
    Non-repeating gradient images would be reported as opaque. Also add
    new test program to test source clipping.

diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 487a672..e80c479 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -818,6 +818,10 @@ pixman_image_is_opaque(pixman_image_t *image)
 
         if (image->common.transform)
             return FALSE;
+
+	/* Gradients do not necessarily cover the entire compositing area */
+	if (image->type == LINEAR || image->type == CONICAL || image->type == RADIAL)
+	    return FALSE;
     }
 
      return TRUE;
diff --git a/test/Makefile.am b/test/Makefile.am
index ced0579..33e2200 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,5 +1,6 @@
 if HAVE_GTK
-TESTPROGRAMS = \
+TESTPROGRAMS =			\
+	clip-test		\
 	composite-test		\
 	gradient-test		\
 	region-test		\
@@ -13,5 +14,6 @@ composite_test_LDADD =	$(top_builddir)/pixman/libpixman-1.la $(GTK_LIBS)
 gradient_test_LDADD = $(top_builddir)/pixman/libpixman-1.la $(GTK_LIBS)
 fetch_test_LDADD = $(top_builddir)/pixman/libpixman-1.la
 region_test_LDADD = $(top_builddir)/pixman/libpixman-1.la
+clip_test_LDADD = $(top_builddir)/pixman/libpixman-1.la $(GTK_LIBS)
 
 endif
diff --git a/test/clip-test.c b/test/clip-test.c
new file mode 100644
index 0000000..a52181f
--- /dev/null
+++ b/test/clip-test.c
@@ -0,0 +1,133 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <gtk/gtk.h>
+#include "pixman.h"
+
+GdkPixbuf *
+pixbuf_from_argb32 (uint32_t *bits,
+		    int width,
+		    int height,
+		    int stride)
+{
+    GdkPixbuf *pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE,
+					8, width, height);
+    int p_stride = gdk_pixbuf_get_rowstride (pixbuf);
+    guint32 *p_bits = (guint32 *)gdk_pixbuf_get_pixels (pixbuf);
+    int w, h;
+    
+    for (h = 0; h < height; ++h)
+    {
+	for (w = 0; w < width; ++w)
+	{
+	    uint32_t argb = bits[h * stride + w];
+	    guint32 abgr;
+	    
+	    abgr = (argb & 0xff000000) |
+		(argb & 0xff) << 16 |
+		(argb & 0x00ff00) |
+		(argb & 0xff0000) >> 16;
+	    
+	    p_bits[h * (p_stride / 4) + w] = abgr;
+	}
+    }
+    
+    return pixbuf;
+}
+
+static gboolean
+on_expose (GtkWidget *widget, GdkEventExpose *expose, gpointer data)
+{
+    GdkPixbuf *pixbuf = data;
+    
+    gdk_draw_pixbuf (widget->window, NULL,
+		     pixbuf, 0, 0, 0, 0,
+		     gdk_pixbuf_get_width (pixbuf),
+		     gdk_pixbuf_get_height (pixbuf),
+		     GDK_RGB_DITHER_NONE,
+		     0, 0);
+    
+    return TRUE;
+}
+
+static void
+show_window (uint32_t *bits, int w, int h, int stride)
+{
+    GdkPixbuf *pixbuf;
+    
+    GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+    
+    pixbuf = pixbuf_from_argb32 (bits, w, h, stride);
+    
+    g_signal_connect (window, "expose_event", G_CALLBACK (on_expose), pixbuf);
+    g_signal_connect (window, "delete_event", G_CALLBACK (gtk_main_quit), NULL);
+    
+    gtk_widget_show (window);
+    
+    gtk_main ();
+}
+
+int
+main (int argc, char **argv)
+{
+#define WIDTH 200
+#define HEIGHT 200
+    
+    uint32_t *src = malloc (WIDTH * HEIGHT * 4);
+    pixman_image_t *gradient_img;
+    pixman_image_t *src_img;
+    int i;
+    pixman_gradient_stop_t stops[2] =
+	{
+	    { pixman_int_to_fixed (0), { 0xffff, 0x0000, 0x0000, 0xffff } },
+	    { pixman_int_to_fixed (1), { 0xffff, 0xffff, 0x0000, 0xffff } }
+	};
+    pixman_point_fixed_t p1 = { 0, 0 };
+    pixman_point_fixed_t p2 = { pixman_int_to_fixed (WIDTH),
+				pixman_int_to_fixed (HEIGHT) };
+    pixman_point_fixed_t c_inner;
+    pixman_point_fixed_t c_outer;
+    pixman_fixed_t r_inner;
+    pixman_fixed_t r_outer;
+    
+    gtk_init (&argc, &argv);
+    
+    for (i = 0; i < WIDTH * HEIGHT; ++i)
+	src[i] = 0xFF0000ff; /* pale blue */
+    
+    src_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
+					 WIDTH, HEIGHT, 
+					 src,
+					 WIDTH * 4);
+    
+    c_inner.x = pixman_double_to_fixed (100.0);
+    c_inner.y = pixman_double_to_fixed (100.0);
+    c_outer.x = pixman_double_to_fixed (100.0);
+    c_outer.y = pixman_double_to_fixed (100.0);
+    r_inner = 0;
+    r_outer = pixman_double_to_fixed (100.0);
+    
+    gradient_img = pixman_image_create_radial_gradient (&c_inner, &c_outer,
+							r_inner, r_outer,
+							stops, 2);
+    
+#if 0
+    gradient_img = pixman_image_create_linear_gradient  (&p1, &p2,
+							 stops, 2);
+    
+#endif
+    
+    pixman_image_composite (PIXMAN_OP_OVER, gradient_img, NULL, src_img,
+			    0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
+    
+    printf ("0, 0: %x\n", src[0]);
+    printf ("10, 10: %x\n", src[10 * 10 + 10]);
+    printf ("w, h: %x\n", src[(HEIGHT - 1) * 100 + (WIDTH - 1)]);
+    
+    show_window (src, WIDTH, HEIGHT, WIDTH);
+    
+    pixman_image_unref (gradient_img);
+    pixman_image_unref (src_img);
+    free (src);
+    
+    return 0;
+}
commit d5b4fd7e11c2f2b2e8ab3cb95bef252ce142982e
Author: Søren Sandmann Pedersen <sandmann at daimi.au.dk>
Date:   Sat Sep 6 06:17:32 2008 -0400

    Update RELEASING

diff --git a/RELEASING b/RELEASING
index 121e0df..7040deb 100644
--- a/RELEASING
+++ b/RELEASING
@@ -37,7 +37,7 @@ Here are the steps to follow to create a new pixman release:
 
    and publish the tar files by running 
 
-	make GPGKEY=<your gpg key id> release-publish
+	make PREV=<last version> GPGKEY=<your gpg key id> release-publish
 
 6) Run 
 
commit 35fcdf352a29241f235f2bc7a692c20ad8baf240
Author: Søren Sandmann Pedersen <sandmann at daimi.au.dk>
Date:   Sat Sep 6 06:15:31 2008 -0400

    Bump release

diff --git a/RELEASING b/RELEASING
index 3ad0c2d..121e0df 100644
--- a/RELEASING
+++ b/RELEASING
@@ -17,7 +17,9 @@ Here are the steps to follow to create a new pixman release:
 
 	make PREV=<last version> release-check
 
-   and fix things until it passes.
+   and fix things until it passes. If your freedesktop username is
+   different from your local username, then also set the variable
+   USERNAME on the commandline.
 
    A very useful thing to do is to run the cairo test suite
    against pixman. This can be done by running the following
diff --git a/configure.ac b/configure.ac
index cddf1a7..3821dcc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,7 +54,7 @@ AC_PREREQ([2.57])
 
 m4_define([pixman_major], 0)
 m4_define([pixman_minor], 11)
-m4_define([pixman_micro], 9)
+m4_define([pixman_micro], 10)
 
 m4_define([pixman_version],[pixman_major.pixman_minor.pixman_micro])
 


More information about the xorg-commit mailing list