summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog22
-rw-r--r--ChangeLog.pre-2-1022
-rw-r--r--ChangeLog.pre-2-422
-rw-r--r--ChangeLog.pre-2-622
-rw-r--r--ChangeLog.pre-2-822
-rw-r--r--gdk/x11/gdkdrawable-x11.c26
-rw-r--r--gdk/x11/gdkgc-x11.c66
-rw-r--r--gdk/x11/gdkprivate-x11.h1
8 files changed, 177 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index bb696fc561..19f9521b75 100644
--- a/ChangeLog
+++ b/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>
* modules/input/Makefile.am: only reference input method
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index bb696fc561..19f9521b75 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -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>
* modules/input/Makefile.am: only reference input method
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index bb696fc561..19f9521b75 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -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>
* modules/input/Makefile.am: only reference input method
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index bb696fc561..19f9521b75 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -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>
* modules/input/Makefile.am: only reference input method
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index bb696fc561..19f9521b75 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -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>
* modules/input/Makefile.am: only reference input method
diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c
index 3dbd8c1fa2..e5d4b30e0d 100644
--- a/gdk/x11/gdkdrawable-x11.c
+++ b/gdk/x11/gdkdrawable-x11.c
@@ -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)
+ {
+ GdkVisual *visual;
- if (!colormap)
+ 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)
{
diff --git a/gdk/x11/gdkgc-x11.c b/gdk/x11/gdkgc-x11.c
index 52d460b5c3..f5cbae9df5 100644
--- a/gdk/x11/gdkgc-x11.c
+++ b/gdk/x11/gdkgc-x11.c
@@ -143,6 +143,8 @@ _gdk_x11_gc_new (GdkDrawable *drawable,
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))
{
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)
{
GdkGCX11 *x11_gc;
- GdkColormap *cmap;
gboolean new = FALSE;
- GdkColor color;
+ XftColor xftcolor;
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;
x11_gc = GDK_GC_X11 (gc);
- cmap = gdk_gc_get_colormap (gc);
if (x11_gc->fg_picture == None)
{
@@ -891,17 +891,16 @@ _gdk_x11_gc_get_fg_picture (GdkGC *gc)
new = TRUE;
}
- gdk_colormap_query_color (cmap, x11_gc->fg_pixel, &color);
-
+ _gdk_gc_x11_get_fg_xft_color (gc, &xftcolor);
+
if (new ||
- x11_gc->fg_picture_color.red != color.red ||
- x11_gc->fg_picture_color.green != color.green ||
- x11_gc->fg_picture_color.blue != color.blue)
+ x11_gc->fg_picture_color.red != xftcolor.color.red ||
+ x11_gc->fg_picture_color.green != xftcolor.color.green ||
+ x11_gc->fg_picture_color.blue != xftcolor.color.blue)
{
- x11_gc->fg_picture_color.red = color.red;
- x11_gc->fg_picture_color.green = color.green;
- x11_gc->fg_picture_color.blue = color.blue;
- x11_gc->fg_picture_color.alpha = 0xffff;
+ x11_gc->fg_picture_color.red = xftcolor.color.red;
+ x11_gc->fg_picture_color.green = xftcolor.color.green;
+ x11_gc->fg_picture_color.blue = xftcolor.color.blue;
XRenderFillRectangle (GDK_GC_XDISPLAY (gc), PictOpSrc,
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));
x11_gc = GDK_GC_X11 (gc);
+
cmap = gdk_gc_get_colormap (gc);
xftcolor->pixel = x11_gc->fg_pixel;
- gdk_colormap_query_color (cmap, xftcolor->pixel, &color);
- xftcolor->color.red = color.red;
- xftcolor->color.green = color.green;
- xftcolor->color.blue = color.blue;
- xftcolor->color.alpha = 0xffff;
+ if (cmap)
+ {
+ gdk_colormap_query_color (cmap, xftcolor->pixel, &color);
+ 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");
+ }
}
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index 98efc53210..5ded4338aa 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -64,6 +64,7 @@ struct _GdkGCX11
GdkRegion *clip_region;
guint16 dirty_mask;
guint have_clip_mask : 1;
+ guint depth : 8;
Picture fg_picture;
XRenderColor fg_picture_color;