[gtk+] style: Don't use gdk_pixmap_create_from_xpm
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] style: Don't use gdk_pixmap_create_from_xpm
- Date: Tue, 10 Aug 2010 19:19:20 +0000 (UTC)
commit 7b9e2b941cc1c566fe140198a597351d4d7e2fe9
Author: Benjamin Otte <otte redhat com>
Date: Fri Aug 6 16:02:24 2010 +0200
style: Don't use gdk_pixmap_create_from_xpm
Instead, do what that code did manually.
gtk/gtkstyle.c | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index f5c745d..9b615d4 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -1247,9 +1247,33 @@ load_bg_image (GdkColormap *colormap,
return (GdkPixmap*) GDK_PARENT_RELATIVE;
else
{
- return gdk_pixmap_colormap_create_from_xpm (NULL, colormap, NULL,
- bg_color,
- filename);
+ GdkPixmap *pixmap;
+ GdkPixbuf *pixbuf;
+ cairo_t *cr;
+ GdkScreen *screen = gdk_colormap_get_screen (colormap);
+
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+ if (!pixbuf)
+ return NULL;
+
+ pixmap = gdk_pixmap_new (gdk_screen_get_root_window (screen),
+ gdk_pixbuf_get_width (pixbuf),
+ gdk_pixbuf_get_height (pixbuf),
+ gdk_colormap_get_visual (colormap)->depth);
+ gdk_drawable_set_colormap (pixmap, colormap);
+
+ cr = gdk_cairo_create (pixmap);
+
+ gdk_cairo_set_source_color (cr, bg_color);
+ cairo_paint (cr);
+
+ gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
+ cairo_paint (cr);
+
+ cairo_destroy (cr);
+ g_object_unref (pixbuf);
+
+ return pixmap;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]