aboutsummaryrefslogtreecommitdiff
path: root/pixman/test/clip-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'pixman/test/clip-test.c')
-rw-r--r--pixman/test/clip-test.c70
1 files changed, 3 insertions, 67 deletions
diff --git a/pixman/test/clip-test.c b/pixman/test/clip-test.c
index 457e97a2b..900013718 100644
--- a/pixman/test/clip-test.c
+++ b/pixman/test/clip-test.c
@@ -1,70 +1,7 @@
#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 (pixman_image_t *img, int w, int h, int stride)
-{
- GdkPixbuf *pixbuf;
-
- GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- 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);
-
- gtk_widget_show (window);
-
- gtk_main ();
-}
+#include "utils.h"
#define WIDTH 200
#define HEIGHT 200
@@ -109,8 +46,6 @@ main (int argc, char **argv)
}
};
- gtk_init (&argc, &argv);
-
src_img = create_solid_bits (0xff0000ff);
c_inner.x = pixman_double_to_fixed (100.0);
@@ -136,6 +71,7 @@ main (int argc, char **argv)
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_has_client_clip (src_img, TRUE);
pixman_image_set_transform (src_img, &trans);
pixman_image_set_repeat (src_img, PIXMAN_REPEAT_NORMAL);
@@ -150,7 +86,7 @@ main (int argc, char **argv)
printf ("w, h: %x\n", src[(HEIGHT - 1) * 100 + (WIDTH - 1)]);
#endif
- show_window (dst_img, WIDTH, HEIGHT, WIDTH);
+ show_image (dst_img);
pixman_image_unref (gradient_img);
pixman_image_unref (src_img);