- pixmap = gdk_pixmap_new(widget->window, w, h, -1);
-
- gc = gdk_gc_new(widget->window);
- gdk_gc_copy(gc, widget->style->black_gc);
- gdk_draw_rectangle(pixmap, gc, TRUE, 0, 0, w, h);
- gdk_gc_copy(gc, widget->style->white_gc);
- gdk_draw_layout(pixmap, gc, 0, 0, layout);
- g_object_unref(gc);
-
- buffer = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, w, h);
- gdk_pixbuf_get_from_drawable(buffer, pixmap,
- gdk_drawable_get_colormap(widget->window),
- 0, 0, 0, 0, w, h);
- g_object_unref(pixmap);
+ source = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w, h);
+
+ cr = cairo_create (source);
+ cairo_set_source_rgb(cr, 0, 0, 0);
+ cairo_rectangle (cr, 0, 0, w, h);
+ cairo_fill (cr);
+ cairo_set_source_rgb(cr, 1, 1, 1);
+ pango_cairo_show_layout (cr, layout);
+ cairo_destroy (cr);
+
+ buffer = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (source),
+ GDK_COLORSPACE_RGB,
+ cairo_image_surface_get_format (source) == CAIRO_FORMAT_ARGB32,
+ 8,
+ cairo_image_surface_get_width (source),
+ cairo_image_surface_get_height (source),
+ cairo_image_surface_get_stride (source),
+ NULL,
+ NULL);