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
22
ChangeLog
22
ChangeLog
@ -1,3 +1,25 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2004-02-17 Mark McLoughlin <mark@skynet.ie>
|
2004-02-17 Mark McLoughlin <mark@skynet.ie>
|
||||||
|
|
||||||
* modules/input/Makefile.am: only reference input method
|
* modules/input/Makefile.am: only reference input method
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2004-02-17 Mark McLoughlin <mark@skynet.ie>
|
2004-02-17 Mark McLoughlin <mark@skynet.ie>
|
||||||
|
|
||||||
* modules/input/Makefile.am: only reference input method
|
* modules/input/Makefile.am: only reference input method
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2004-02-17 Mark McLoughlin <mark@skynet.ie>
|
2004-02-17 Mark McLoughlin <mark@skynet.ie>
|
||||||
|
|
||||||
* modules/input/Makefile.am: only reference input method
|
* modules/input/Makefile.am: only reference input method
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2004-02-17 Mark McLoughlin <mark@skynet.ie>
|
2004-02-17 Mark McLoughlin <mark@skynet.ie>
|
||||||
|
|
||||||
* modules/input/Makefile.am: only reference input method
|
* modules/input/Makefile.am: only reference input method
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2004-02-17 Mark McLoughlin <mark@skynet.ie>
|
2004-02-17 Mark McLoughlin <mark@skynet.ie>
|
||||||
|
|
||||||
* modules/input/Makefile.am: only reference input method
|
* modules/input/Makefile.am: only reference input method
|
||||||
|
@ -312,22 +312,29 @@ gdk_x11_drawable_get_xft_draw (GdkDrawable *drawable)
|
|||||||
if (impl->xft_draw == NULL)
|
if (impl->xft_draw == NULL)
|
||||||
{
|
{
|
||||||
GdkColormap *colormap = gdk_drawable_get_colormap (drawable);
|
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"
|
g_warning ("Using Xft rendering requires the drawable argument to\n"
|
||||||
"have a specified colormap. All windows have a colormap,\n"
|
"have a specified colormap. All windows have a colormap,\n"
|
||||||
"however, pixmaps only have colormap by default if they\n"
|
"however, pixmaps only have colormap by default if they\n"
|
||||||
"were created with a non-NULL window argument. Otherwise\n"
|
"were created with a non-NULL window argument. Otherwise\n"
|
||||||
"a colormap must be set on them with gdk_drawable_set_colormap");
|
"a colormap must be set on them with gdk_drawable_set_colormap");
|
||||||
return NULL;
|
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 impl->xft_draw;
|
return impl->xft_draw;
|
||||||
@ -1421,6 +1428,7 @@ gdk_x11_draw_pixbuf (GdkDrawable *drawable,
|
|||||||
|
|
||||||
if (format_type == FORMAT_NONE ||
|
if (format_type == FORMAT_NONE ||
|
||||||
!gdk_pixbuf_get_has_alpha (pixbuf) ||
|
!gdk_pixbuf_get_has_alpha (pixbuf) ||
|
||||||
|
gdk_drawable_get_depth (drawable) == 1 ||
|
||||||
(dither == GDK_RGB_DITHER_MAX && gdk_drawable_get_depth (drawable) != 24) ||
|
(dither == GDK_RGB_DITHER_MAX && gdk_drawable_get_depth (drawable) != 24) ||
|
||||||
gdk_x11_drawable_get_picture (drawable) == None)
|
gdk_x11_drawable_get_picture (drawable) == None)
|
||||||
{
|
{
|
||||||
|
@ -143,6 +143,8 @@ _gdk_x11_gc_new (GdkDrawable *drawable,
|
|||||||
|
|
||||||
private->screen = GDK_DRAWABLE_IMPL_X11 (drawable)->screen;
|
private->screen = GDK_DRAWABLE_IMPL_X11 (drawable)->screen;
|
||||||
|
|
||||||
|
private->depth = gdk_drawable_get_depth (drawable);
|
||||||
|
|
||||||
if (values_mask & (GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN))
|
if (values_mask & (GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN))
|
||||||
{
|
{
|
||||||
values_mask &= ~(GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN);
|
values_mask &= ~(GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN);
|
||||||
@ -857,9 +859,8 @@ Picture
|
|||||||
_gdk_x11_gc_get_fg_picture (GdkGC *gc)
|
_gdk_x11_gc_get_fg_picture (GdkGC *gc)
|
||||||
{
|
{
|
||||||
GdkGCX11 *x11_gc;
|
GdkGCX11 *x11_gc;
|
||||||
GdkColormap *cmap;
|
|
||||||
gboolean new = FALSE;
|
gboolean new = FALSE;
|
||||||
GdkColor color;
|
XftColor xftcolor;
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_GC_X11 (gc), None);
|
g_return_val_if_fail (GDK_IS_GC_X11 (gc), None);
|
||||||
|
|
||||||
@ -867,7 +868,6 @@ _gdk_x11_gc_get_fg_picture (GdkGC *gc)
|
|||||||
return None;
|
return None;
|
||||||
|
|
||||||
x11_gc = GDK_GC_X11 (gc);
|
x11_gc = GDK_GC_X11 (gc);
|
||||||
cmap = gdk_gc_get_colormap (gc);
|
|
||||||
|
|
||||||
if (x11_gc->fg_picture == None)
|
if (x11_gc->fg_picture == None)
|
||||||
{
|
{
|
||||||
@ -891,17 +891,16 @@ _gdk_x11_gc_get_fg_picture (GdkGC *gc)
|
|||||||
new = TRUE;
|
new = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_colormap_query_color (cmap, x11_gc->fg_pixel, &color);
|
_gdk_gc_x11_get_fg_xft_color (gc, &xftcolor);
|
||||||
|
|
||||||
if (new ||
|
if (new ||
|
||||||
x11_gc->fg_picture_color.red != color.red ||
|
x11_gc->fg_picture_color.red != xftcolor.color.red ||
|
||||||
x11_gc->fg_picture_color.green != color.green ||
|
x11_gc->fg_picture_color.green != xftcolor.color.green ||
|
||||||
x11_gc->fg_picture_color.blue != color.blue)
|
x11_gc->fg_picture_color.blue != xftcolor.color.blue)
|
||||||
{
|
{
|
||||||
x11_gc->fg_picture_color.red = color.red;
|
x11_gc->fg_picture_color.red = xftcolor.color.red;
|
||||||
x11_gc->fg_picture_color.green = color.green;
|
x11_gc->fg_picture_color.green = xftcolor.color.green;
|
||||||
x11_gc->fg_picture_color.blue = color.blue;
|
x11_gc->fg_picture_color.blue = xftcolor.color.blue;
|
||||||
x11_gc->fg_picture_color.alpha = 0xffff;
|
|
||||||
|
|
||||||
XRenderFillRectangle (GDK_GC_XDISPLAY (gc), PictOpSrc,
|
XRenderFillRectangle (GDK_GC_XDISPLAY (gc), PictOpSrc,
|
||||||
x11_gc->fg_picture, &x11_gc->fg_picture_color,
|
x11_gc->fg_picture, &x11_gc->fg_picture_color,
|
||||||
@ -929,13 +928,46 @@ _gdk_gc_x11_get_fg_xft_color (GdkGC *gc,
|
|||||||
g_return_if_fail (GDK_IS_GC_X11 (gc));
|
g_return_if_fail (GDK_IS_GC_X11 (gc));
|
||||||
|
|
||||||
x11_gc = GDK_GC_X11 (gc);
|
x11_gc = GDK_GC_X11 (gc);
|
||||||
|
|
||||||
cmap = gdk_gc_get_colormap (gc);
|
cmap = gdk_gc_get_colormap (gc);
|
||||||
|
|
||||||
xftcolor->pixel = x11_gc->fg_pixel;
|
xftcolor->pixel = x11_gc->fg_pixel;
|
||||||
|
|
||||||
gdk_colormap_query_color (cmap, xftcolor->pixel, &color);
|
if (cmap)
|
||||||
xftcolor->color.red = color.red;
|
{
|
||||||
xftcolor->color.green = color.green;
|
gdk_colormap_query_color (cmap, xftcolor->pixel, &color);
|
||||||
xftcolor->color.blue = color.blue;
|
xftcolor->color.alpha = 0xffff;
|
||||||
xftcolor->color.alpha = 0xffff;
|
xftcolor->color.red = color.red;
|
||||||
|
xftcolor->color.green = color.green;
|
||||||
|
xftcolor->color.blue = color.blue;
|
||||||
|
}
|
||||||
|
else if (x11_gc->depth == 1)
|
||||||
|
{
|
||||||
|
/* Drawing with Xft on a bitmap is a bit bizzare; it
|
||||||
|
* takes alpha >= 0x8000 to mean 'set to 1' and
|
||||||
|
* alpha < 0x8000 to mean 'set to 0'.
|
||||||
|
*/
|
||||||
|
if (xftcolor->pixel)
|
||||||
|
{
|
||||||
|
xftcolor->color.red = 0xffff;
|
||||||
|
xftcolor->color.green = 0xffff;
|
||||||
|
xftcolor->color.blue = 0xffff;
|
||||||
|
xftcolor->color.alpha = 0xffff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xftcolor->color.red = 0;
|
||||||
|
xftcolor->color.green = 0;
|
||||||
|
xftcolor->color.blue = 0;
|
||||||
|
xftcolor->color.alpha = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_warning ("Using Xft rendering requires the GC argument to have a\n"
|
||||||
|
"specified colormap. If the GC was created for a drawable\n"
|
||||||
|
"with a colormap, the colormap will be set on the GC\n"
|
||||||
|
"automatically. Otherwise, a colormap must be set on it with"
|
||||||
|
"gdk_gc_set_colormap");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,7 @@ struct _GdkGCX11
|
|||||||
GdkRegion *clip_region;
|
GdkRegion *clip_region;
|
||||||
guint16 dirty_mask;
|
guint16 dirty_mask;
|
||||||
guint have_clip_mask : 1;
|
guint have_clip_mask : 1;
|
||||||
|
guint depth : 8;
|
||||||
|
|
||||||
Picture fg_picture;
|
Picture fg_picture;
|
||||||
XRenderColor fg_picture_color;
|
XRenderColor fg_picture_color;
|
||||||
|
Reference in New Issue
Block a user