Cleanup gdk_pixbuf_render_pixmap_and_mask_for_colormap()
This commit is contained in:
parent
d0d2a6f12c
commit
7fd148fc59
@ -180,14 +180,18 @@ gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
|
|||||||
alpha_threshold);
|
alpha_threshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GdkPixbuf *
|
||||||
remove_alpha_channel (GdkPixbuf *pixbuf)
|
remove_alpha_channel (GdkPixbuf *orig)
|
||||||
{
|
{
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
unsigned int x, y, width, height, stride;
|
unsigned int x, y, width, height, stride;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
|
|
||||||
if (!gdk_pixbuf_get_has_alpha (pixbuf))
|
if (!gdk_pixbuf_get_has_alpha (orig))
|
||||||
return;
|
return g_object_ref (orig);
|
||||||
|
|
||||||
|
pixbuf = gdk_pixbuf_copy (orig);
|
||||||
|
|
||||||
width = gdk_pixbuf_get_width (pixbuf);
|
width = gdk_pixbuf_get_width (pixbuf);
|
||||||
height = gdk_pixbuf_get_height (pixbuf);
|
height = gdk_pixbuf_get_height (pixbuf);
|
||||||
@ -203,6 +207,8 @@ remove_alpha_channel (GdkPixbuf *pixbuf)
|
|||||||
|
|
||||||
data += stride;
|
data += stride;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -259,17 +265,7 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf,
|
|||||||
* transparent. So we treat the pixbuf like a pixbuf without alpha channel;
|
* transparent. So we treat the pixbuf like a pixbuf without alpha channel;
|
||||||
* see bug #487865.
|
* see bug #487865.
|
||||||
*/
|
*/
|
||||||
if (gdk_pixbuf_get_has_alpha (pixbuf))
|
tmp_pixbuf = remove_alpha_channel (pixbuf);
|
||||||
{
|
|
||||||
int width, height;
|
|
||||||
|
|
||||||
width = gdk_pixbuf_get_width (pixbuf);
|
|
||||||
height = gdk_pixbuf_get_height (pixbuf);
|
|
||||||
tmp_pixbuf = gdk_pixbuf_copy (pixbuf);
|
|
||||||
remove_alpha_channel (tmp_pixbuf);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
tmp_pixbuf = g_object_ref (pixbuf);
|
|
||||||
|
|
||||||
cr = gdk_cairo_create (*pixmap_return);
|
cr = gdk_cairo_create (*pixmap_return);
|
||||||
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
|
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user