diff options
author | Benjamin Otte <otte@redhat.com> | 2010-07-19 12:15:58 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-07-26 16:42:48 +0200 |
commit | 188884a9b19697f2902b82baad17e42284086b07 (patch) | |
tree | e35b566a32da4214eb5ebcdaf140926f7dff6123 /demos/gtk-demo/drawingarea.c | |
parent | 831afa2159957b737e9ee62d7d1230778e70befa (diff) | |
download | gtk+-188884a9b19697f2902b82baad17e42284086b07.tar.gz |
gtk-demo: Blit backing pixmap using Cairo
Diffstat (limited to 'demos/gtk-demo/drawingarea.c')
-rw-r--r-- | demos/gtk-demo/drawingarea.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/demos/gtk-demo/drawingarea.c b/demos/gtk-demo/drawingarea.c index 5e80449c73..b84004ecca 100644 --- a/demos/gtk-demo/drawingarea.c +++ b/demos/gtk-demo/drawingarea.c @@ -53,18 +53,15 @@ scribble_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer data) { - /* We use the "foreground GC" for the widget since it already exists, - * but honestly any GC would work. The only thing to worry about - * is whether the GC has an inappropriate clip region set. - */ + cairo_t *cr; - gdk_draw_drawable (widget->window, - widget->style->fg_gc[gtk_widget_get_state (widget)], - pixmap, - /* Only copy the area that was exposed. */ - event->area.x, event->area.y, - event->area.x, event->area.y, - event->area.width, event->area.height); + cr = gdk_cairo_create (widget->window); + + gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0); + gdk_cairo_rectangle (cr, &event->area); + cairo_fill (cr); + + cairo_destroy (cr); return FALSE; } @@ -172,8 +169,6 @@ checkerboard_expose (GtkWidget *da, ycount = xcount % 2; /* start with even/odd depending on row */ while (j < da->allocation.height) { - GdkGC *gc; - if (ycount % 2) cairo_set_source_rgb (cr, 0.45777, 0, 0.45777); else |