[gtk+/rendering-cleanup] testgtk: Use Cairo to load XBM image



commit 45901cdc7dff8cfd5308dda24d8a16e9a84065a6
Author: Benjamin Otte <otte redhat com>
Date:   Fri Aug 6 22:37:34 2010 +0200

    testgtk: Use Cairo to load XBM image
    
    This should really use GdkPixbuf, but apparently we can't load XBM
    images. And I'm too lazy to convert it.

 tests/testgtk.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/tests/testgtk.c b/tests/testgtk.c
index e64664a..d15f82d 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -7437,8 +7437,9 @@ create_wmhints (GtkWidget *widget)
   GtkWidget *button;
   GtkWidget *box1;
   GtkWidget *box2;
-
   GdkBitmap *circles;
+  cairo_surface_t *image;
+  cairo_t *cr;
 
   if (!window)
     {
@@ -7456,10 +7457,17 @@ create_wmhints (GtkWidget *widget)
 
       gtk_widget_realize (window);
       
-      circles = gdk_bitmap_create_from_data (window->window,
-					     (gchar *) circles_bits,
-					     circles_width,
-					     circles_height);
+      circles = gdk_pixmap_new (window->window, circles_width, circles_height, 1);
+      cr = gdk_cairo_create (circles);
+      image = cairo_image_surface_create_for_data (circles_bits, CAIRO_FORMAT_A1,
+                                                   circles_width, circles_height,
+                                                   circles_width / 8);
+      cairo_set_source_surface (cr, image, 0, 0);
+      cairo_surface_destroy (image);
+      cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+      cairo_paint (cr);
+      cairo_destroy (cr);
+
       gdk_window_set_icon (window->window, NULL,
 			   circles, circles);
       



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