gdk: Get rid of gdk_draw_pixbuf() call

Use Cairo code instead.
This commit is contained in:
Benjamin Otte 2010-07-12 13:27:41 +02:00
parent 610e29892e
commit 7b213d5604

View File

@ -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)