summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2003-06-04 23:26:52 +0000
committerOwen Taylor <otaylor@src.gnome.org>2003-06-04 23:26:52 +0000
commit76fc08a3fc962c5fa29672825718fdd073039d22 (patch)
tree29e49aad74d0a1a296d91e403b62151c5bcc4b77
parentc1ccc9b9a449614b66fa89e43f996801d316432e (diff)
downloadgtk+-76fc08a3fc962c5fa29672825718fdd073039d22.tar.gz
Keep track of when we have a clip mask set for the GC, and when we unset
Wed Jun 4 19:24:28 2003 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkgc-x11.c gdk/x11/gdkprivate-x11.h: Keep track of when we have a clip mask set for the GC, and when we unset it, or switch to a clip region, immediately call XSetClipMask (..., None) to avoid Xlib caching stale data. (#111806) * gtk/gtktextdisplay.c: Don't set a clip mask when drawing alpha pixmaps; it isn't necessary any more. (#111806)
-rw-r--r--ChangeLog12
-rw-r--r--ChangeLog.pre-2-1012
-rw-r--r--ChangeLog.pre-2-412
-rw-r--r--ChangeLog.pre-2-612
-rw-r--r--ChangeLog.pre-2-812
-rw-r--r--gdk/x11/gdkgc-x11.c40
-rw-r--r--gdk/x11/gdkprivate-x11.h3
-rw-r--r--gtk/gtktextdisplay.c31
8 files changed, 95 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b6934c65e..afb69f19cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Wed Jun 4 19:24:28 2003 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/gdkgc-x11.c gdk/x11/gdkprivate-x11.h: Keep
+ track of when we have a clip mask set for the GC,
+ and when we unset it, or switch to a clip region,
+ immediately call XSetClipMask (..., None) to avoid
+ Xlib caching stale data. (#111806)
+
+ * gtk/gtktextdisplay.c: Don't set a clip mask
+ when drawing alpha pixmaps; it isn't necessary any more.
+ (#111806)
+
Wed Jun 4 18:27:44 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator):
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 3b6934c65e..afb69f19cc 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,15 @@
+Wed Jun 4 19:24:28 2003 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/gdkgc-x11.c gdk/x11/gdkprivate-x11.h: Keep
+ track of when we have a clip mask set for the GC,
+ and when we unset it, or switch to a clip region,
+ immediately call XSetClipMask (..., None) to avoid
+ Xlib caching stale data. (#111806)
+
+ * gtk/gtktextdisplay.c: Don't set a clip mask
+ when drawing alpha pixmaps; it isn't necessary any more.
+ (#111806)
+
Wed Jun 4 18:27:44 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator):
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 3b6934c65e..afb69f19cc 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,15 @@
+Wed Jun 4 19:24:28 2003 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/gdkgc-x11.c gdk/x11/gdkprivate-x11.h: Keep
+ track of when we have a clip mask set for the GC,
+ and when we unset it, or switch to a clip region,
+ immediately call XSetClipMask (..., None) to avoid
+ Xlib caching stale data. (#111806)
+
+ * gtk/gtktextdisplay.c: Don't set a clip mask
+ when drawing alpha pixmaps; it isn't necessary any more.
+ (#111806)
+
Wed Jun 4 18:27:44 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator):
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 3b6934c65e..afb69f19cc 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,15 @@
+Wed Jun 4 19:24:28 2003 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/gdkgc-x11.c gdk/x11/gdkprivate-x11.h: Keep
+ track of when we have a clip mask set for the GC,
+ and when we unset it, or switch to a clip region,
+ immediately call XSetClipMask (..., None) to avoid
+ Xlib caching stale data. (#111806)
+
+ * gtk/gtktextdisplay.c: Don't set a clip mask
+ when drawing alpha pixmaps; it isn't necessary any more.
+ (#111806)
+
Wed Jun 4 18:27:44 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator):
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 3b6934c65e..afb69f19cc 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,15 @@
+Wed Jun 4 19:24:28 2003 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/gdkgc-x11.c gdk/x11/gdkprivate-x11.h: Keep
+ track of when we have a clip mask set for the GC,
+ and when we unset it, or switch to a clip region,
+ immediately call XSetClipMask (..., None) to avoid
+ Xlib caching stale data. (#111806)
+
+ * gtk/gtktextdisplay.c: Don't set a clip mask
+ when drawing alpha pixmaps; it isn't necessary any more.
+ (#111806)
+
Wed Jun 4 18:27:44 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator):
diff --git a/gdk/x11/gdkgc-x11.c b/gdk/x11/gdkgc-x11.c
index d88f72a536..9874c7ea83 100644
--- a/gdk/x11/gdkgc-x11.c
+++ b/gdk/x11/gdkgc-x11.c
@@ -140,6 +140,7 @@ _gdk_x11_gc_new (GdkDrawable *drawable,
private = GDK_GC_X11 (gc);
private->dirty_mask = 0;
+ private->have_clip_mask = FALSE;
private->clip_region = NULL;
private->screen = GDK_DRAWABLE_IMPL_X11 (drawable)->screen;
@@ -158,7 +159,10 @@ _gdk_x11_gc_new (GdkDrawable *drawable,
if (values_mask & GDK_GC_FOREGROUND)
private->fg_pixel = values->foreground.pixel;
-
+
+ if ((values_mask & GDK_GC_CLIP_MASK) && values->clip_mask)
+ private->have_clip_mask = TRUE;
+
xvalues.function = GXcopy;
xvalues.fill_style = FillSolid;
xvalues.arc_mode = ArcPieSlice;
@@ -394,6 +398,8 @@ gdk_x11_gc_set_values (GdkGC *gc,
gdk_region_destroy (x11_gc->clip_region);
x11_gc->clip_region = NULL;
}
+
+ x11_gc->have_clip_mask = values->clip_mask != NULL;
}
if (values_mask & GDK_GC_FOREGROUND)
@@ -643,20 +649,30 @@ gdk_gc_set_clip_rectangle (GdkGC *gc,
GdkRectangle *rectangle)
{
GdkGCX11 *x11_gc;
-
+ gboolean had_region = FALSE;
+
g_return_if_fail (GDK_IS_GC (gc));
x11_gc = GDK_GC_X11 (gc);
if (x11_gc->clip_region)
- gdk_region_destroy (x11_gc->clip_region);
+ {
+ had_region = TRUE;
+ gdk_region_destroy (x11_gc->clip_region);
+ }
if (rectangle)
x11_gc->clip_region = gdk_region_rectangle (rectangle);
else
+ x11_gc->clip_region = NULL;
+
+ /* Unset immediately, to make sure Xlib doesn't keep the
+ * XID of an old clip mask cached
+ */
+ if ((had_region && !rectangle) || x11_gc->have_clip_mask)
{
- x11_gc->clip_region = NULL;
XSetClipMask (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc), None);
+ x11_gc->have_clip_mask = FALSE;
}
gc->clip_x_origin = 0;
@@ -670,22 +686,32 @@ gdk_gc_set_clip_region (GdkGC *gc,
GdkRegion *region)
{
GdkGCX11 *x11_gc;
+ gboolean had_region = FALSE;
g_return_if_fail (GDK_IS_GC (gc));
x11_gc = GDK_GC_X11 (gc);
if (x11_gc->clip_region)
- gdk_region_destroy (x11_gc->clip_region);
+ {
+ had_region = TRUE;
+ gdk_region_destroy (x11_gc->clip_region);
+ }
if (region)
x11_gc->clip_region = gdk_region_copy (region);
else
+ x11_gc->clip_region = NULL;
+
+ /* Unset immediately, to make sure Xlib doesn't keep the
+ * XID of an old clip mask cached
+ */
+ if ((had_region && !region) || x11_gc->have_clip_mask)
{
- x11_gc->clip_region = NULL;
XSetClipMask (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc), None);
+ x11_gc->have_clip_mask = FALSE;
}
-
+
gc->clip_x_origin = 0;
gc->clip_y_origin = 0;
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index 2e66abc693..f6f62a3bab 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -64,7 +64,8 @@ struct _GdkGCX11
GC xgc;
GdkScreen *screen;
GdkRegion *clip_region;
- guint dirty_mask;
+ guint16 dirty_mask;
+ guint have_clip_mask : 1;
#ifdef HAVE_XFT
Picture fg_picture;
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index f96a40f551..55e64099fb 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -371,30 +371,6 @@ render_layout_line (GdkDrawable *drawable,
if (gdk_rectangle_intersect (&pixbuf_rect, &render_state->clip_rect,
&draw_rect))
{
- GdkBitmap *mask = NULL;
-
- if (gdk_pixbuf_get_has_alpha (pixbuf))
- {
- mask = gdk_pixmap_new (drawable,
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf),
- 1);
-
- gdk_pixbuf_render_threshold_alpha (pixbuf, mask,
- 0, 0, 0, 0,
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf),
- 128);
-
- }
-
- if (mask)
- {
- gdk_gc_set_clip_mask (render_state->fg_gc, mask);
- gdk_gc_set_clip_origin (render_state->fg_gc,
- pixbuf_rect.x, pixbuf_rect.y);
- }
-
gdk_draw_pixbuf (drawable,
render_state->fg_gc,
pixbuf,
@@ -405,13 +381,6 @@ render_layout_line (GdkDrawable *drawable,
draw_rect.height,
GDK_RGB_DITHER_NORMAL,
0, 0);
-
- if (mask)
- {
- gdk_gc_set_clip_rectangle (render_state->fg_gc,
- &render_state->clip_rect);
- g_object_unref (mask);
- }
}
shaped_width_pixels = width;