diff options
author | Benjamin Otte <otte@redhat.com> | 2010-07-15 18:18:27 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-07-26 16:42:48 +0200 |
commit | 6dd7e5af083577e0b138a3e2f9fe3738a717f50c (patch) | |
tree | bb1c14a6d9eae51539eb5127db9ffdc22ab7256f /tests/testoffscreen.c | |
parent | a625e587a3d651392691f039319d37022866b7b3 (diff) | |
download | gtk+-6dd7e5af083577e0b138a3e2f9fe3738a717f50c.tar.gz |
tests: Make testoffscreen use Cairo
Diffstat (limited to 'tests/testoffscreen.c')
-rw-r--r-- | tests/testoffscreen.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/testoffscreen.c b/tests/testoffscreen.c index 65ef83d6ef..ac711f5c26 100644 --- a/tests/testoffscreen.c +++ b/tests/testoffscreen.c @@ -24,13 +24,12 @@ layout_expose_handler (GtkWidget *widget, GdkEventExpose *event) { GtkLayout *layout = GTK_LAYOUT (widget); - GdkWindow *bin_window; + GdkWindow *bin_window = gtk_layout_get_bin_window (layout); + cairo_t *cr; gint i,j; gint imin, imax, jmin, jmax; - bin_window = gtk_layout_get_bin_window (layout); - if (event->window != bin_window) return FALSE; @@ -40,14 +39,18 @@ layout_expose_handler (GtkWidget *widget, jmin = (event->area.y) / 10; jmax = (event->area.y + event->area.height + 9) / 10; + cr = gdk_cairo_create (bin_window); + for (i = imin; i < imax; i++) for (j = jmin; j < jmax; j++) if ((i + j) % 2) - gdk_draw_rectangle (bin_window, - widget->style->black_gc, - TRUE, - 10 * i, 10 * j, - 1 + i % 10, 1 + j % 10); + cairo_rectangle (cr, + 10 * i, 10 * j, + 1 + i % 10, 1 + j % 10); + + cairo_fill (cr); + + cairo_destroy (cr); return FALSE; } |