summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-10-03 21:17:07 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-10-03 21:17:07 +0000
commit272900364501ea849bec0f30a871a72bbdb81632 (patch)
treeae3f64f4307b9ec5069dd15b276ae5490127c581
parentef33adff83617e2c937052316b9fb925d4972252 (diff)
downloadgtk+-272900364501ea849bec0f30a871a72bbdb81632.tar.gz
Restore the pre-Xft2 code to render text directly via RENDER,
Thu Oct 3 17:09:23 2002 Owen Taylor <otaylor@redhat.com> * gdk/x11/{gdkdrawable-x11.[ch],gdkpixmap-x11.c, gdkwindow-x11.c}: Restore the pre-Xft2 code to render text directly via RENDER, conditionalized with !HAVE_XFT2 so that we'll build again on Xft1 systems. (#90181)
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLog.pre-2-108
-rw-r--r--ChangeLog.pre-2-28
-rw-r--r--ChangeLog.pre-2-48
-rw-r--r--ChangeLog.pre-2-68
-rw-r--r--ChangeLog.pre-2-88
-rw-r--r--gdk/x11/gdkdrawable-x11.c95
-rw-r--r--gdk/x11/gdkdrawable-x11.h4
-rw-r--r--gdk/x11/gdkpixmap-x11.c7
-rw-r--r--gdk/x11/gdkwindow-x11.c5
10 files changed, 154 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 84e5f8259a..6e54ae2fba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Thu Oct 3 17:09:23 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/{gdkdrawable-x11.[ch],gdkpixmap-x11.c,
+ gdkwindow-x11.c}: Restore the pre-Xft2 code to
+ render text directly via RENDER, conditionalized
+ with !HAVE_XFT2 so that we'll build again on Xft1
+ systems. (#90181)
+
Thu Oct 3 14:13:33 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c (gdk_event_new): Add a 'type'
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 84e5f8259a..6e54ae2fba 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,11 @@
+Thu Oct 3 17:09:23 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/{gdkdrawable-x11.[ch],gdkpixmap-x11.c,
+ gdkwindow-x11.c}: Restore the pre-Xft2 code to
+ render text directly via RENDER, conditionalized
+ with !HAVE_XFT2 so that we'll build again on Xft1
+ systems. (#90181)
+
Thu Oct 3 14:13:33 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c (gdk_event_new): Add a 'type'
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 84e5f8259a..6e54ae2fba 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,11 @@
+Thu Oct 3 17:09:23 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/{gdkdrawable-x11.[ch],gdkpixmap-x11.c,
+ gdkwindow-x11.c}: Restore the pre-Xft2 code to
+ render text directly via RENDER, conditionalized
+ with !HAVE_XFT2 so that we'll build again on Xft1
+ systems. (#90181)
+
Thu Oct 3 14:13:33 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c (gdk_event_new): Add a 'type'
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 84e5f8259a..6e54ae2fba 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,11 @@
+Thu Oct 3 17:09:23 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/{gdkdrawable-x11.[ch],gdkpixmap-x11.c,
+ gdkwindow-x11.c}: Restore the pre-Xft2 code to
+ render text directly via RENDER, conditionalized
+ with !HAVE_XFT2 so that we'll build again on Xft1
+ systems. (#90181)
+
Thu Oct 3 14:13:33 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c (gdk_event_new): Add a 'type'
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 84e5f8259a..6e54ae2fba 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,11 @@
+Thu Oct 3 17:09:23 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/{gdkdrawable-x11.[ch],gdkpixmap-x11.c,
+ gdkwindow-x11.c}: Restore the pre-Xft2 code to
+ render text directly via RENDER, conditionalized
+ with !HAVE_XFT2 so that we'll build again on Xft1
+ systems. (#90181)
+
Thu Oct 3 14:13:33 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c (gdk_event_new): Add a 'type'
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 84e5f8259a..6e54ae2fba 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,11 @@
+Thu Oct 3 17:09:23 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/{gdkdrawable-x11.[ch],gdkpixmap-x11.c,
+ gdkwindow-x11.c}: Restore the pre-Xft2 code to
+ render text directly via RENDER, conditionalized
+ with !HAVE_XFT2 so that we'll build again on Xft1
+ systems. (#90181)
+
Thu Oct 3 14:13:33 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c (gdk_event_new): Add a 'type'
diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c
index d6ec59332d..ed07cace1a 100644
--- a/gdk/x11/gdkdrawable-x11.c
+++ b/gdk/x11/gdkdrawable-x11.c
@@ -236,6 +236,7 @@ _gdk_x11_have_render (GdkDisplay *display)
&event_base, &error_base);
}
+#ifdef HAVE_XFT2
static XftDraw *
gdk_x11_drawable_get_xft_draw (GdkDrawable *drawable)
{
@@ -272,7 +273,7 @@ gdk_x11_drawable_get_picture (GdkDrawable *drawable)
return draw ? XftDrawPicture (draw) : None;
}
-
+
static void
gdk_x11_drawable_update_xft_clip (GdkDrawable *drawable,
GdkGC *gc)
@@ -323,7 +324,81 @@ gdk_x11_drawable_update_xft_clip (GdkDrawable *drawable,
XftDrawSetClip (xft_draw, NULL);
}
}
-#endif
+
+#else /* !HAVE_XFT2 */
+
+static Picture
+gdk_x11_drawable_get_picture (GdkDrawable *drawable)
+{
+ GdkDrawableImplX11 *impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
+ if (!_gdk_x11_have_render (gdk_drawable_get_display (drawable)))
+ return None;
+
+ if (impl->picture == None)
+ {
+ GdkVisual *visual = gdk_drawable_get_visual (drawable);
+ XRenderPictFormat *format;
+
+ if (!visual)
+ {
+ 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 None;
+ }
+
+ format = XRenderFindVisualFormat (GDK_SCREEN_XDISPLAY (impl->screen),
+ gdk_x11_visual_get_xvisual(visual));
+ if (format)
+ impl->picture = XRenderCreatePicture (GDK_SCREEN_XDISPLAY (impl->screen),
+ impl->xid, format, 0, NULL);
+ }
+
+ return impl->picture;
+}
+
+static void
+gdk_x11_drawable_update_xft_clip (GdkDrawable *drawable,
+ GdkGC *gc)
+{
+ GdkGCX11 *gc_private = gc ? GDK_GC_X11 (gc) : NULL;
+ GdkDrawableImplX11 *impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+ Picture picture = gdk_x11_drawable_get_picture (drawable);
+
+ if (gc && gc_private->clip_region)
+ {
+ GdkRegionBox *boxes = gc_private->clip_region->rects;
+ gint n_boxes = gc_private->clip_region->numRects;
+ XRectangle *rects = g_new (XRectangle, n_boxes);
+ int i;
+
+ for (i=0; i < n_boxes; i++)
+ {
+ rects[i].x = CLAMP (boxes[i].x1 + gc->clip_x_origin, G_MINSHORT, G_MAXSHORT);
+ rects[i].y = CLAMP (boxes[i].y1 + gc->clip_y_origin, G_MINSHORT, G_MAXSHORT);
+ rects[i].width = CLAMP (boxes[i].x2 + gc->clip_x_origin, G_MINSHORT, G_MAXSHORT) - rects[i].x;
+ rects[i].height = CLAMP (boxes[i].y2 + gc->clip_y_origin, G_MINSHORT, G_MAXSHORT) - rects[i].y;
+ }
+
+ XRenderSetPictureClipRectangles (GDK_SCREEN_XDISPLAY (impl->screen),
+ picture, 0, 0, rects, n_boxes);
+
+ g_free (rects);
+ }
+ else
+ {
+ XRenderPictureAttributes pa;
+ pa.clip_mask = None;
+ XRenderChangePicture (GDK_SCREEN_XDISPLAY (impl->screen),
+ picture, CPClipMask, &pa);
+ }
+}
+#endif /* HAVE_XFT2 */
+
+#endif /* HAVE_XFT */
/*****************************************************
* X11 specific implementations of generic functions *
@@ -722,6 +797,7 @@ gdk_x11_draw_glyphs (GdkDrawable *drawable,
#if HAVE_XFT
if (PANGO_XFT_IS_FONT (font))
{
+#ifdef HAVE_XFT2
XftColor color;
XftDraw *draw;
@@ -731,9 +807,22 @@ gdk_x11_draw_glyphs (GdkDrawable *drawable,
draw = gdk_x11_drawable_get_xft_draw (drawable);
pango_xft_render (draw, &color, font, glyphs, x, y);
+#else /* !HAVE_XFT2 */
+ Picture src_picture;
+ Picture dest_picture;
+
+ src_picture = _gdk_x11_gc_get_fg_picture (gc);
+
+ gdk_x11_drawable_update_xft_clip (drawable, gc);
+ dest_picture = gdk_x11_drawable_get_picture (drawable);
+
+ pango_xft_picture_render (GDK_SCREEN_XDISPLAY (impl->screen),
+ src_picture, dest_picture,
+ font, glyphs, x, y);
+#endif /* HAVE_XFT2 */
}
else
-#endif /* !HAVE_XFT */
+#endif /* HAVE_XFT */
pango_x_render (GDK_SCREEN_XDISPLAY (impl->screen),
impl->xid,
GDK_GC_GET_XGC (gc),
diff --git a/gdk/x11/gdkdrawable-x11.h b/gdk/x11/gdkdrawable-x11.h
index f2a15f4613..0d4185b6f1 100644
--- a/gdk/x11/gdkdrawable-x11.h
+++ b/gdk/x11/gdkdrawable-x11.h
@@ -65,8 +65,10 @@ struct _GdkDrawableImplX11
Window xid;
GdkScreen *screen;
-#ifdef HAVE_XFT
+#ifdef HAVE_XFT2
XftDraw *xft_draw;
+#elif defined (HAVE_XFT)
+ Picture picture;
#endif
};
diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c
index 094ab306b9..459d9f23c4 100644
--- a/gdk/x11/gdkpixmap-x11.c
+++ b/gdk/x11/gdkpixmap-x11.c
@@ -133,10 +133,15 @@ gdk_pixmap_impl_x11_finalize (GObject *object)
{
GdkDrawableImplX11 *draw_impl = GDK_DRAWABLE_IMPL_X11 (impl);
+#ifdef HAVE_XFT2
if (draw_impl->xft_draw)
XftDrawDestroy (draw_impl->xft_draw);
+#else /* !HAVE_XFT2 */
+ if (draw_impl->picture)
+ XRenderFreePicture (GDK_DISPLAY_XDISPLAY (display), draw_impl->picture);
+#endif /* HAVE_XFT2 */
}
-#endif /* HAVE_XFT */
+#endif /* HAVE_XFT */
if (!impl->is_foreign)
XFreePixmap (GDK_DISPLAY_XDISPLAY (display), GDK_PIXMAP_XID (wrapper));
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 65bfa1096d..4a73034454 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -829,8 +829,13 @@ _gdk_windowing_window_destroy (GdkWindow *window,
{
GdkDrawableImplX11 *draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl);
+#ifdef HAVE_XFT2
if (draw_impl->xft_draw)
XftDrawDestroy (draw_impl->xft_draw);
+#else /* !HAVE_XFT2 */
+ if (draw_impl->picture)
+ XRenderFreePicture (GDK_DISPLAY_XDISPLAY (display), draw_impl->picture);
+#endif /* HAVE_XFT2 */
}
#endif /* HAVE_XFT */