Commit 76fc08a3 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

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)
parent c1ccc9b9
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> Wed Jun 4 18:27:44 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator):
......
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> Wed Jun 4 18:27:44 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator):
......
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> Wed Jun 4 18:27:44 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator):
......
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> Wed Jun 4 18:27:44 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator):
......
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> Wed Jun 4 18:27:44 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator):
......
...@@ -140,6 +140,7 @@ _gdk_x11_gc_new (GdkDrawable *drawable, ...@@ -140,6 +140,7 @@ _gdk_x11_gc_new (GdkDrawable *drawable,
private = GDK_GC_X11 (gc); private = GDK_GC_X11 (gc);
private->dirty_mask = 0; private->dirty_mask = 0;
private->have_clip_mask = FALSE;
private->clip_region = NULL; private->clip_region = NULL;
private->screen = GDK_DRAWABLE_IMPL_X11 (drawable)->screen; private->screen = GDK_DRAWABLE_IMPL_X11 (drawable)->screen;
...@@ -158,7 +159,10 @@ _gdk_x11_gc_new (GdkDrawable *drawable, ...@@ -158,7 +159,10 @@ _gdk_x11_gc_new (GdkDrawable *drawable,
if (values_mask & GDK_GC_FOREGROUND) if (values_mask & GDK_GC_FOREGROUND)
private->fg_pixel = values->foreground.pixel; 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.function = GXcopy;
xvalues.fill_style = FillSolid; xvalues.fill_style = FillSolid;
xvalues.arc_mode = ArcPieSlice; xvalues.arc_mode = ArcPieSlice;
...@@ -394,6 +398,8 @@ gdk_x11_gc_set_values (GdkGC *gc, ...@@ -394,6 +398,8 @@ gdk_x11_gc_set_values (GdkGC *gc,
gdk_region_destroy (x11_gc->clip_region); gdk_region_destroy (x11_gc->clip_region);
x11_gc->clip_region = NULL; x11_gc->clip_region = NULL;
} }
x11_gc->have_clip_mask = values->clip_mask != NULL;
} }
if (values_mask & GDK_GC_FOREGROUND) if (values_mask & GDK_GC_FOREGROUND)
...@@ -643,20 +649,30 @@ gdk_gc_set_clip_rectangle (GdkGC *gc, ...@@ -643,20 +649,30 @@ gdk_gc_set_clip_rectangle (GdkGC *gc,
GdkRectangle *rectangle) GdkRectangle *rectangle)
{ {
GdkGCX11 *x11_gc; GdkGCX11 *x11_gc;
gboolean had_region = FALSE;
g_return_if_fail (GDK_IS_GC (gc)); g_return_if_fail (GDK_IS_GC (gc));
x11_gc = GDK_GC_X11 (gc); x11_gc = GDK_GC_X11 (gc);
if (x11_gc->clip_region) if (x11_gc->clip_region)
gdk_region_destroy (x11_gc->clip_region); {
had_region = TRUE;
gdk_region_destroy (x11_gc->clip_region);
}
if (rectangle) if (rectangle)
x11_gc->clip_region = gdk_region_rectangle (rectangle); x11_gc->clip_region = gdk_region_rectangle (rectangle);
else 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); XSetClipMask (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc), None);
x11_gc->have_clip_mask = FALSE;
} }
gc->clip_x_origin = 0; gc->clip_x_origin = 0;
...@@ -670,22 +686,32 @@ gdk_gc_set_clip_region (GdkGC *gc, ...@@ -670,22 +686,32 @@ gdk_gc_set_clip_region (GdkGC *gc,
GdkRegion *region) GdkRegion *region)
{ {
GdkGCX11 *x11_gc; GdkGCX11 *x11_gc;
gboolean had_region = FALSE;
g_return_if_fail (GDK_IS_GC (gc)); g_return_if_fail (GDK_IS_GC (gc));
x11_gc = GDK_GC_X11 (gc); x11_gc = GDK_GC_X11 (gc);
if (x11_gc->clip_region) if (x11_gc->clip_region)
gdk_region_destroy (x11_gc->clip_region); {
had_region = TRUE;
gdk_region_destroy (x11_gc->clip_region);
}
if (region) if (region)
x11_gc->clip_region = gdk_region_copy (region); x11_gc->clip_region = gdk_region_copy (region);
else 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); XSetClipMask (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc), None);
x11_gc->have_clip_mask = FALSE;
} }
gc->clip_x_origin = 0; gc->clip_x_origin = 0;
gc->clip_y_origin = 0; gc->clip_y_origin = 0;
......
...@@ -64,7 +64,8 @@ struct _GdkGCX11 ...@@ -64,7 +64,8 @@ struct _GdkGCX11
GC xgc; GC xgc;
GdkScreen *screen; GdkScreen *screen;
GdkRegion *clip_region; GdkRegion *clip_region;
guint dirty_mask; guint16 dirty_mask;
guint have_clip_mask : 1;
#ifdef HAVE_XFT #ifdef HAVE_XFT
Picture fg_picture; Picture fg_picture;
......
...@@ -371,30 +371,6 @@ render_layout_line (GdkDrawable *drawable, ...@@ -371,30 +371,6 @@ render_layout_line (GdkDrawable *drawable,
if (gdk_rectangle_intersect (&pixbuf_rect, &render_state->clip_rect, if (gdk_rectangle_intersect (&pixbuf_rect, &render_state->clip_rect,
&draw_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, gdk_draw_pixbuf (drawable,
render_state->fg_gc, render_state->fg_gc,
pixbuf, pixbuf,
...@@ -405,13 +381,6 @@ render_layout_line (GdkDrawable *drawable, ...@@ -405,13 +381,6 @@ render_layout_line (GdkDrawable *drawable,
draw_rect.height, draw_rect.height,
GDK_RGB_DITHER_NORMAL, GDK_RGB_DITHER_NORMAL,
0, 0); 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; shaped_width_pixels = width;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment