From 7b213d5604675f708c3d14e1a76fafb673d3b662 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 12 Jul 2010 13:27:41 +0200 Subject: [PATCH] gdk: Get rid of gdk_draw_pixbuf() call Use Cairo code instead. --- gdk/gdkpixbuf-render.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/gdk/gdkpixbuf-render.c b/gdk/gdkpixbuf-render.c index bd94aaf4d8..fae5b12f2d 100644 --- a/gdk/gdkpixbuf-render.c +++ b/gdk/gdkpixbuf-render.c @@ -208,13 +208,11 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf, if (pixmap_return) { - GdkGC *gc; *pixmap_return = 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 (GDK_DRAWABLE (*pixmap_return), colormap); - gc = _gdk_drawable_get_scratch_gc (*pixmap_return, FALSE); /* 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- @@ -222,17 +220,21 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf, * 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)); + { + GdkGC *gc = _gdk_drawable_get_scratch_gc (*pixmap_return, FALSE); + 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); + { + cairo_t *cr = gdk_cairo_create (*pixmap_return); + gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); + cairo_paint (cr); + cairo_destroy (cr); + } } if (mask_return)