diff options
-rw-r--r-- | tests/testgtk.c | 20 | ||||
-rw-r--r-- | tests/testrgb.c | 12 |
2 files changed, 21 insertions, 11 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c index c38c6d45ed..47da568701 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -256,6 +256,7 @@ on_alpha_drawing_expose (GtkWidget *widget, int width = widget->allocation.width; int height = widget->allocation.height; GdkPixbuf *pixbuf; + cairo_t *cr; guchar *buffer; guchar *p; int i, j; @@ -283,11 +284,15 @@ on_alpha_drawing_expose (GtkWidget *widget, pixbuf = gdk_pixbuf_new_from_data (buffer, GDK_COLORSPACE_RGB, TRUE, 8, 64, 64, 4 * 64, NULL, NULL); + cr = gdk_cairo_create (widget->window); - gdk_draw_pixbuf (widget->window, widget->style->black_gc, pixbuf, - 0, 0, x + width - 18 - 64, y + (height - 64) /2, - 64, 64, GDK_RGB_DITHER_NORMAL, 0, 0); + gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); + cairo_rectangle (cr, + x + width - 18 - 64, y + (height - 64) /2, + 64, 64); + cairo_fill (cr); + cairo_destroy (cr); g_object_unref (pixbuf); g_free (buffer); @@ -2755,14 +2760,17 @@ on_rotated_text_expose (GtkWidget *widget, if (tile_pixbuf) { GdkPixmap *tile; + cairo_t *cr; gint width = gdk_pixbuf_get_width (tile_pixbuf); gint height = gdk_pixbuf_get_height (tile_pixbuf); tile = gdk_pixmap_new (widget->window, width, height, -1); - gdk_draw_pixbuf (tile, gc, tile_pixbuf, - 0, 0, 0, 0, width, height, - GDK_RGB_DITHER_NORMAL, 0, 0); + + cr = gdk_cairo_create (tile); + gdk_cairo_set_source_pixbuf (cr, tile_pixbuf, 0, 0); + cairo_paint (cr); + cairo_destroy (cr); gdk_gc_set_tile (gc, tile); gdk_gc_set_fill (gc, GDK_TILED); diff --git a/tests/testrgb.c b/tests/testrgb.c index f4fdbc2cff..b05018359d 100644 --- a/tests/testrgb.c +++ b/tests/testrgb.c @@ -147,15 +147,17 @@ testrgb_rgb_test (GtkWidget *drawing_area) start_time = g_timer_elapsed (timer, NULL); for (i = 0; i < NUM_ITERS; i++) { + cairo_t *cr; + offset = (rand () % (WIDTH * HEIGHT * 4)) & -4; pixbuf = gdk_pixbuf_new_from_data (buf + offset, GDK_COLORSPACE_RGB, TRUE, 8, WIDTH, HEIGHT, WIDTH * 4, NULL, NULL); - gdk_draw_pixbuf (drawing_area->window, drawing_area->style->black_gc, - pixbuf, - 0, 0, 0, 0, WIDTH, HEIGHT, - GDK_RGB_DITHER_NORMAL, - 0, 0); + cr = gdk_cairo_create (drawing_area->window); + gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); + cairo_rectangle (cr, 0, 0, WIDTH, HEIGHT); + cairo_fill (cr); + cairo_destroy (cr); g_object_unref (pixbuf); } gdk_flush (); |