[gtk+/rendering-cleanup: 75/113] tests: Make testoffscreen use Cairo



commit 793cffb05dd742558901875d2b5e3ab67781a9a4
Author: Benjamin Otte <otte redhat com>
Date:   Thu Jul 15 18:18:27 2010 +0200

    tests: Make testoffscreen use Cairo

 tests/testoffscreen.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/tests/testoffscreen.c b/tests/testoffscreen.c
index c29b67c..c6ccb92 100644
--- a/tests/testoffscreen.c
+++ b/tests/testoffscreen.c
@@ -24,6 +24,7 @@ layout_expose_handler (GtkWidget      *widget,
                        GdkEventExpose *event)
 {
   GtkLayout *layout = GTK_LAYOUT (widget);
+  cairo_t *cr;
 
   gint i,j;
   gint imin, imax, jmin, jmax;
@@ -37,14 +38,18 @@ layout_expose_handler (GtkWidget      *widget,
   jmin = (event->area.y) / 10;
   jmax = (event->area.y + event->area.height + 9) / 10;
 
+  cr = gdk_cairo_create (layout->bin_window);
+
   for (i = imin; i < imax; i++)
     for (j = jmin; j < jmax; j++)
-      if ((i + j) % 2)
-	gdk_draw_rectangle (layout->bin_window,
-                            widget->style->black_gc,
-                            TRUE,
-                            10 * i, 10 * j,
-                            1 + i % 10, 1 + j % 10);
+      if ((i + j) % 2) 
+          cairo_rectangle (cr,
+                           10 * i, 10 * j,
+                           1 + i % 10, 1 + j % 10);
+
+  cairo_fill (cr);
+
+  cairo_destroy (cr);
 
   return FALSE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]