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)
This commit is contained in:
12
ChangeLog
12
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):
|
||||
|
||||
@ -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):
|
||||
|
||||
@ -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):
|
||||
|
||||
@ -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):
|
||||
|
||||
@ -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):
|
||||
|
||||
@ -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;
|
||||
@ -159,6 +160,9 @@ _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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
XSetClipMask (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc), None);
|
||||
x11_gc->have_clip_mask = FALSE;
|
||||
}
|
||||
|
||||
gc->clip_x_origin = 0;
|
||||
@ -670,20 +686,30 @@ 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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
XSetClipMask (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc), None);
|
||||
x11_gc->have_clip_mask = FALSE;
|
||||
}
|
||||
|
||||
gc->clip_x_origin = 0;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user