summaryrefslogtreecommitdiff
path: root/gdk/gdkpixbuf-render.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@gnome.org>2008-02-06 23:08:07 +0000
committerChristian Persch <chpe@src.gnome.org>2008-02-06 23:08:07 +0000
commit08856e5af93b83adfed431c493d03b7a1f03225d (patch)
tree7b41a02de757944fca9fa300eb169ef4bc10d970 /gdk/gdkpixbuf-render.c
parent6e03989a4c4cf52d95df7e97d67e381d8b5f1286 (diff)
downloadgtk+-08856e5af93b83adfed431c493d03b7a1f03225d.tar.gz
If the pixbuf has an alpha channel, use gdk_draw_rgb_32_image to draw it
2008-02-07 Christian Persch <chpe@gnome.org> * gdk/gdkpixbuf-render.c: (gdk_pixbuf_render_pixmap_and_mask_for_colormap): If the pixbuf has an alpha channel, use gdk_draw_rgb_32_image to draw it to the pixmap; otherwise there will be random pixel values in the semi-transparent area of the pixbuf within the mask. Bug #487865. svn path=/trunk/; revision=19488
Diffstat (limited to 'gdk/gdkpixbuf-render.c')
-rw-r--r--gdk/gdkpixbuf-render.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/gdk/gdkpixbuf-render.c b/gdk/gdkpixbuf-render.c
index 2904e712f1..0c883a4f92 100644
--- a/gdk/gdkpixbuf-render.c
+++ b/gdk/gdkpixbuf-render.c
@@ -305,11 +305,24 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf,
gdk_drawable_set_colormap (GDK_DRAWABLE (*pixmap_return), colormap);
gc = _gdk_drawable_get_scratch_gc (*pixmap_return, FALSE);
- gdk_draw_pixbuf (*pixmap_return, gc, pixbuf,
- 0, 0, 0, 0,
- gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
+
+ /* If the pixbuf has an alpha channel, using gdk_pixbuf_draw would give
+ * random pixel values in the area that are within the mask, but semi-
+ * transparent. So we treat the pixbuf like a pixbuf without alpha channel;
+ * see bug #487865.
+ */
+ if (gdk_pixbuf_get_has_alpha (pixbuf))
+ gdk_draw_rgb_32_image (*pixmap_return, gc,
+ 0, 0,
+ gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
+ GDK_RGB_DITHER_NORMAL,
+ gdk_pixbuf_get_pixels (pixbuf), gdk_pixbuf_get_rowstride (pixbuf));
+ else
+ gdk_draw_pixbuf (*pixmap_return, gc, pixbuf,
+ 0, 0, 0, 0,
+ gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
+ GDK_RGB_DITHER_NORMAL,
+ 0, 0);
}
if (mask_return)