tests: Remove gdk_draw_pixbuf() with Cairo equivalent

This commit is contained in:
Benjamin Otte 2010-07-12 15:45:12 +02:00
parent c1c9b7dfc8
commit 6d4bae5ccc
2 changed files with 21 additions and 11 deletions

View File

@ -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);

View File

@ -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 ();