summaryrefslogtreecommitdiff
path: root/gdk/gdkdraw.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-12-15 01:46:41 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-12-15 01:46:41 +0000
commit6e5a269f38ad682e116e94efac287fa4ddc46b7f (patch)
tree25b336984ac15be84beb85ff71b3d99c11b861ed /gdk/gdkdraw.c
parent2142a98c9e8826323941ec3da2c75325ca00eb52 (diff)
downloadgdk-pixbuf-6e5a269f38ad682e116e94efac287fa4ddc46b7f.tar.gz
Add two virtualized functions gdk_drawable_get_clip_region - to get the
Thu Dec 14 20:22:31 2000 Owen Taylor <otaylor@redhat.com> * gdk/{gdkdrawable.[ch],gdkpixmap.c,gdkwindow.c,x11/gdkwindow.c}: Add two virtualized functions gdk_drawable_get_clip_region - to get the clip region when drawing. * gdk/gdkwindow.c (gdk_window_invalidate_rect): Rewrite to simple use invalidate_region. * gdk/gdkwindow.c (gdk_window_invalidate_region): Clip to visible region. * acconfig.h configure.in: Check for Xft. For now, assume that if Xft is found, Pango was compiled with Xft support as well. * gdk/gdkcolor.h gdk/x11/gdkcolor-x11.c: Add gdk_colormap_query_color(). * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_glyphs): Draw with Xft if appropriate. * gdk/x11/gdkpango-x11.c (gdk_pango_context_get): Create a pangoxft context if we have XFT and the environment variable GD_USE_XFT is set. * gdk/x11/gdkx.h (struct _GdkGCX11): Cache the fg_pixel and also possibly an XftDraw structure. * gtk/gtkfontsel.c: Handle the case where the font from the style doesn't match any of the fonts a bit better. * gtk/testgtk.c: Add tabs between directional segments for hebrew/arabic test. (Not really necessary, just a little prettier.)
Diffstat (limited to 'gdk/gdkdraw.c')
-rw-r--r--gdk/gdkdraw.c71
1 files changed, 65 insertions, 6 deletions
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index fcab539e5..a6fd64d28 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -29,12 +29,13 @@
#include "gdkwindow.h"
static GdkDrawable* gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
- gint x,
- gint y,
- gint width,
- gint height,
- gint *composite_x_offset,
- gint *composite_y_offset);
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint *composite_x_offset,
+ gint *composite_y_offset);
+static GdkRegion * gdk_drawable_real_get_visible_region (GdkDrawable *drawable);
static void gdk_drawable_class_init (GdkDrawableClass *klass);
@@ -70,6 +71,9 @@ static void
gdk_drawable_class_init (GdkDrawableClass *klass)
{
klass->get_composite_drawable = gdk_drawable_real_get_composite_drawable;
+ /* Default implementation for clip and visible region is the same */
+ klass->get_clip_region = gdk_drawable_real_get_visible_region;
+ klass->get_visible_region = gdk_drawable_real_get_visible_region;
}
/* Manipulation of drawables
@@ -525,3 +529,58 @@ gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
return GDK_DRAWABLE (g_object_ref (G_OBJECT (drawable)));
}
+
+/**
+ * gdk_drawable_get_clip_region:
+ * @drawable: a #GdkDrawable
+ *
+ * Computes the region of a drawable that potentially can be written
+ * to by drawing primitives. This region will not take into account
+ * the clip region for the GC, and may also not take into account
+ * other factors such as if the window is obscured by other windows,
+ * but no area outside of this region will be affected by drawing
+ * primitives.
+ *
+ * Return value: a #GdkRegion. This must be freed with gdk_region_destroy()
+ * when you are done.
+ **/
+GdkRegion *
+gdk_drawable_get_clip_region (GdkDrawable *drawable)
+{
+ g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
+
+ return GDK_DRAWABLE_GET_CLASS (drawable)->get_clip_region (drawable);
+}
+
+/**
+ * gdk_drawable_get_visible_region:
+ * @drawable:
+ *
+ * Computes the region of a drawable that is potentially visible.
+ * This does not necessarily take into account if the window is
+ * obscured by other windows, but no area outside of this region
+ * is visible.
+ *
+ * Return value: a #GdkRegion. This must be freed with gdk_region_destroy()
+ * when you are done.
+ **/
+GdkRegion *
+gdk_drawable_get_visible_region (GdkDrawable *drawable)
+{
+ g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
+
+ return GDK_DRAWABLE_GET_CLASS (drawable)->get_visible_region (drawable);
+}
+
+static GdkRegion *
+gdk_drawable_real_get_visible_region (GdkDrawable *drawable)
+{
+ GdkRectangle rect;
+
+ rect.x = 0;
+ rect.y = 0;
+
+ gdk_drawable_get_size (drawable, &rect.width, &rect.height);
+
+ return gdk_region_rectangle (&rect);
+}