summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-07-12 16:48:53 +0200
committerBenjamin Otte <otte@redhat.com>2010-08-07 15:35:50 +0200
commit970ae51e386ff6a585b469ae92846b876d892bb1 (patch)
tree039a13da522009d770b84ca9818bdbf99e51dd88 /demos
parent0ba97c7aae2defe5b43c08985971d2b2d3e32d86 (diff)
downloadgtk+-970ae51e386ff6a585b469ae92846b876d892bb1.tar.gz
demos: Use Cairo instead of gdk_draw_pixbuf()
Diffstat (limited to 'demos')
-rw-r--r--demos/testpixbuf-scale.c13
-rw-r--r--demos/testpixbuf.c13
2 files changed, 16 insertions, 10 deletions
diff --git a/demos/testpixbuf-scale.c b/demos/testpixbuf-scale.c
index d512513f6d..6d335e1cc0 100644
--- a/demos/testpixbuf-scale.c
+++ b/demos/testpixbuf-scale.c
@@ -35,6 +35,7 @@ gboolean
expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
GdkPixbuf *dest;
+ cairo_t *cr;
gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
@@ -48,11 +49,13 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
interp_type, overall_alpha,
event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
- gdk_draw_pixbuf (widget->window, widget->style->fg_gc[GTK_STATE_NORMAL], dest,
- 0, 0, event->area.x, event->area.y,
- event->area.width, event->area.height,
- GDK_RGB_DITHER_NORMAL, event->area.x, event->area.y);
-
+ cr = gdk_cairo_create (event->window);
+
+ gdk_cairo_set_source_pixbuf (cr, dest, 0, 0);
+ gdk_cairo_rectangle (cr, &event->area);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
g_object_unref (dest);
return TRUE;
diff --git a/demos/testpixbuf.c b/demos/testpixbuf.c
index 64357c11a5..2c4ee01d44 100644
--- a/demos/testpixbuf.c
+++ b/demos/testpixbuf.c
@@ -322,6 +322,7 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
if (gdk_pixbuf_get_has_alpha (pixbuf)) {
GdkPixbuf *dest;
+ cairo_t *cr;
gdk_window_set_back_pixmap (drawing_area->window, NULL, FALSE);
@@ -335,11 +336,13 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
GDK_INTERP_BILINEAR, 255,
event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
- gdk_draw_pixbuf (drawing_area->window, drawing_area->style->fg_gc[GTK_STATE_NORMAL], dest,
- 0, 0, event->area.x, event->area.y,
- event->area.width, event->area.height,
- GDK_RGB_DITHER_NORMAL, event->area.x, event->area.y);
-
+ cr = gdk_cairo_create (drawing_area->window);
+
+ gdk_cairo_set_source_pixbuf (cr, dest, 0, 0);
+ gdk_cairo_rectangle (cr, &event->area);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
g_object_unref (dest);
} else {
gdk_draw_rgb_image (drawing_area->window,