gdkdrawable-x11: blend with RENDER except where GdkRGB does it better
This commit is contained in:
parent
e9d0d05ce7
commit
e782c550d5
3 changed files with 26 additions and 1 deletions
|
|
@ -374,6 +374,8 @@ gboolean _gdk_rgb_composite (GdkColormap *colormap,
|
|||
const guchar *rgba,
|
||||
gint rowstride,
|
||||
GdkRgbDither dither);
|
||||
gboolean _gdk_rgb_prefers_own_blending (GdkColormap *colormap,
|
||||
GdkRgbDither dither);
|
||||
|
||||
void _gdk_gc_update_context (GdkGC *gc,
|
||||
cairo_t *cr,
|
||||
|
|
|
|||
21
gdk/gdkrgb.c
21
gdk/gdkrgb.c
|
|
@ -2004,6 +2004,27 @@ _gdk_rgb_composite (GdkColormap *colormap,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* _gdk_rgb_prefers_own_blending:
|
||||
* @colormap: a colormap
|
||||
* @dither: the dithering asked for
|
||||
*
|
||||
* Whether pixbufs with alpha look better blended by GdkRGB than by
|
||||
* the RENDER extension: for palettes and gray levels, which RENDER
|
||||
* maps to its nearest colors, and for dithering, which RENDER doesn't do.
|
||||
*/
|
||||
gboolean
|
||||
_gdk_rgb_prefers_own_blending (GdkColormap *colormap,
|
||||
GdkRgbDither dither)
|
||||
{
|
||||
GdkRgbInfo *info = gdk_rgb_get_info_from_colormap (colormap);
|
||||
|
||||
if (!info->tables)
|
||||
return TRUE;
|
||||
|
||||
return dither == GDK_RGB_DITHER_MAX && info->ditherable;
|
||||
}
|
||||
|
||||
static GdkRgbInfo *
|
||||
gdk_rgb_get_info_from_drawable (GdkDrawable *drawable)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1476,6 +1476,7 @@ gdk_x11_draw_pixbuf (GdkDrawable *drawable,
|
|||
gint x_dither,
|
||||
gint y_dither)
|
||||
{
|
||||
GdkColormap *colormap = gdk_drawable_get_colormap (drawable);
|
||||
GdkX11FormatType format_type;
|
||||
XRenderPictFormat *format, *mask_format;
|
||||
gint rowstride;
|
||||
|
|
@ -1489,7 +1490,8 @@ gdk_x11_draw_pixbuf (GdkDrawable *drawable,
|
|||
if (format_type == GDK_X11_FORMAT_NONE ||
|
||||
!gdk_pixbuf_get_has_alpha (pixbuf) ||
|
||||
gdk_drawable_get_depth (drawable) == 1 ||
|
||||
(dither == GDK_RGB_DITHER_MAX && gdk_drawable_get_depth (drawable) != 24) ||
|
||||
(colormap ? _gdk_rgb_prefers_own_blending (colormap, dither)
|
||||
: dither == GDK_RGB_DITHER_MAX && gdk_drawable_get_depth (drawable) != 24) ||
|
||||
gdk_x11_drawable_get_picture (drawable) == None)
|
||||
{
|
||||
GdkDrawable *wrapper = GDK_DRAWABLE_IMPL_X11 (drawable)->wrapper;
|
||||
|
|
|
|||
Loading…
Reference in a new issue