Fix for #119722, reported by Olexiy Avramchenko, patch by Owen Taylor.
Tue Feb 17 23:02:58 2004 Soeren Sandmann <sandmann@daimi.au.dk> Fix for #119722, reported by Olexiy Avramchenko, patch by Owen Taylor. * gdk/x11/gdkprivate-x11.h (struct _GdkGCX11): Add a depth field * gdk/x11/gdkgc-x11.c (_gdk_x11_gc_new): Keep track of the GC's depth. * gdk/x11/gdkgc-x11.c (_gdk_gc_x11_get_fg_xft_color): First query the colormap, if no colormap, special case depth 1, * gdk/x11/gdkgc-x11.c (_gdk_x11_gc_get_fg_picture): Use _gdk_gc_x11_get_fg_xft_color() to get the foreground color. * gdk/x11/gdkdrawable-x11.c (gdk_x11_drawable_get_xft_draw): Special-case bitmaps without a colormap. * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_pixbuf): Use inherited draw_pixbuf() implementation in the bitmap case.
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
fe956696a3
commit
6c8430c0c4
@ -312,22 +312,29 @@ gdk_x11_drawable_get_xft_draw (GdkDrawable *drawable)
|
||||
if (impl->xft_draw == NULL)
|
||||
{
|
||||
GdkColormap *colormap = gdk_drawable_get_colormap (drawable);
|
||||
GdkVisual *visual;
|
||||
|
||||
if (!colormap)
|
||||
|
||||
if (colormap)
|
||||
{
|
||||
GdkVisual *visual;
|
||||
|
||||
visual = gdk_colormap_get_visual (colormap);
|
||||
|
||||
impl->xft_draw = XftDrawCreate (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid,
|
||||
GDK_VISUAL_XVISUAL (visual), GDK_COLORMAP_XCOLORMAP (colormap));
|
||||
}
|
||||
else if (gdk_drawable_get_depth (drawable) == 1)
|
||||
{
|
||||
impl->xft_draw = XftDrawCreateBitmap (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Using Xft rendering requires the drawable argument to\n"
|
||||
"have a specified colormap. All windows have a colormap,\n"
|
||||
"however, pixmaps only have colormap by default if they\n"
|
||||
"were created with a non-NULL window argument. Otherwise\n"
|
||||
"a colormap must be set on them with gdk_drawable_set_colormap");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
visual = gdk_colormap_get_visual (colormap);
|
||||
|
||||
impl->xft_draw = XftDrawCreate (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid,
|
||||
GDK_VISUAL_XVISUAL (visual), GDK_COLORMAP_XCOLORMAP (colormap));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return impl->xft_draw;
|
||||
@ -1421,6 +1428,7 @@ gdk_x11_draw_pixbuf (GdkDrawable *drawable,
|
||||
|
||||
if (format_type == 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) ||
|
||||
gdk_x11_drawable_get_picture (drawable) == None)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user