From 933f9f190d419a828a2480198d58125c18c0aeac Mon Sep 17 00:00:00 2001 From: Bradford Hovinen Date: Mon, 17 Dec 2001 17:03:42 +0000 Subject: [PATCH] Make sure the pixmap is masked correctly 2001-12-17 Bradford Hovinen * applier.c (applier_get_preview_widget): Make sure the pixmap is masked correctly --- libbackground/ChangeLog | 5 +++++ libbackground/applier.c | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/libbackground/ChangeLog b/libbackground/ChangeLog index 1540e71d1..a0ac9d1b3 100644 --- a/libbackground/ChangeLog +++ b/libbackground/ChangeLog @@ -1,3 +1,8 @@ +2001-12-17 Bradford Hovinen + + * applier.c (applier_get_preview_widget): Make sure the pixmap is + masked correctly + 2001-12-07 Bradford Hovinen * preferences.c (read_color_from_string): Check if string is diff --git a/libbackground/applier.c b/libbackground/applier.c index 1dc6dfdb5..b26dc3193 100644 --- a/libbackground/applier.c +++ b/libbackground/applier.c @@ -416,7 +416,7 @@ GtkWidget * applier_get_preview_widget (Applier *applier) { GdkPixbuf *pixbuf; - GdkPixmap *pixmap, *pixmap1; + GdkPixmap *pixmap; GdkBitmap *mask; GdkVisual *visual; GdkColormap *colormap; @@ -447,16 +447,27 @@ applier_get_preview_widget (Applier *applier) gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), visual->depth); + mask = gdk_pixmap_new (GDK_ROOT_PARENT (), + gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf), + 1); + gc = gdk_gc_new (GDK_ROOT_PARENT ()); + gdk_pixbuf_render_threshold_alpha (pixbuf, mask, + 0, 0, 0, 0, + gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf), + 1); + + gdk_gc_set_clip_mask (gc, mask); + gdk_pixbuf_render_to_drawable (pixbuf, pixmap, gc, 0, 0, 0, 0, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), GDK_RGB_DITHER_MAX, 0, 0); - gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap1, &mask, 0); - applier->p->preview_widget = gtk_pixmap_new (pixmap, mask); gtk_widget_show (applier->p->preview_widget); gdk_pixbuf_unref (pixbuf); @@ -465,8 +476,6 @@ applier_get_preview_widget (Applier *applier) gtk_widget_pop_visual (); gtk_widget_pop_colormap (); - gdk_pixmap_unref (pixmap1); - return applier->p->preview_widget; }