mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-13 12:20:10 +00:00
Further clean up window drawing redirection/clipping
This combines the OFFSET_GC and various SETUP/RESTORE gc macros to a single BEGIN/END_DRAW macro pair.
This commit is contained in:
parent
1d739c2ff6
commit
609b03c517
452
gdk/gdkwindow.c
452
gdk/gdkwindow.c
@ -2991,82 +2991,115 @@ gdk_window_get_internal_paint_info (GdkWindow *window,
|
|||||||
*y_offset = y_off;
|
*y_offset = y_off;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GdkDrawable *
|
||||||
setup_clip_for_draw (GdkDrawable *drawable,
|
start_draw_helper (GdkDrawable *drawable,
|
||||||
GdkGC *gc,
|
GdkGC *gc,
|
||||||
int old_clip_x, int old_clip_y)
|
gint *x_offset_out,
|
||||||
|
gint *y_offset_out)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
||||||
|
gint x_offset, y_offset;
|
||||||
|
GdkDrawable *impl;
|
||||||
|
gint old_clip_x = gc->clip_x_origin;
|
||||||
|
gint old_clip_y = gc->clip_y_origin;
|
||||||
GdkRegion *clip;
|
GdkRegion *clip;
|
||||||
|
guint32 clip_region_tag;
|
||||||
|
GdkWindowPaint *paint;
|
||||||
|
|
||||||
if (private->window_type == GDK_WINDOW_ROOT)
|
paint = NULL;
|
||||||
return;
|
if (private->paint_stack)
|
||||||
|
paint = private->paint_stack->data;
|
||||||
|
|
||||||
|
if (paint)
|
||||||
|
{
|
||||||
|
x_offset = paint->x_offset;
|
||||||
|
y_offset = paint->y_offset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x_offset = -private->abs_x;
|
||||||
|
y_offset = -private->abs_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x_offset != 0 || y_offset != 0)
|
||||||
|
{
|
||||||
|
gdk_gc_set_clip_origin (gc,
|
||||||
|
old_clip_x - x_offset,
|
||||||
|
old_clip_y - y_offset);
|
||||||
|
gdk_gc_set_ts_origin (gc,
|
||||||
|
gc->ts_x_origin - x_offset,
|
||||||
|
gc->ts_y_origin - y_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
*x_offset_out = x_offset;
|
||||||
|
*y_offset_out = y_offset;
|
||||||
|
|
||||||
|
/* Add client side window clip region to gc */
|
||||||
|
clip = NULL;
|
||||||
|
if (paint)
|
||||||
|
{
|
||||||
|
/* Only need clipping if using implicit paint, otherwise
|
||||||
|
the pixmap is clipped when copying to the window in end_paint */
|
||||||
|
if (paint->uses_implicit)
|
||||||
|
{
|
||||||
|
/* This includes the window clip */
|
||||||
|
clip = paint->region;
|
||||||
|
}
|
||||||
|
clip_region_tag = paint->region_tag;
|
||||||
|
|
||||||
|
/* After having set up the drawable clip rect on a GC we need to make sure
|
||||||
|
* that we draw to th the impl, otherwise the pixmap code will reset the
|
||||||
|
* drawable clip. */
|
||||||
|
impl = ((GdkPixmapObject *)(paint->pixmap))->impl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Drawing directly to the window, flush anything outstanding to
|
||||||
|
guarantee ordering. */
|
||||||
|
gdk_window_flush ((GdkWindow *)drawable);
|
||||||
|
|
||||||
|
/* Don't clip when drawing to root */
|
||||||
|
if (private->window_type != GDK_WINDOW_ROOT)
|
||||||
|
{
|
||||||
if (_gdk_gc_get_subwindow (gc) == GDK_CLIP_BY_CHILDREN)
|
if (_gdk_gc_get_subwindow (gc) == GDK_CLIP_BY_CHILDREN)
|
||||||
clip = private->clip_region_with_children;
|
clip = private->clip_region_with_children;
|
||||||
else
|
else
|
||||||
clip = private->clip_region;
|
clip = private->clip_region;
|
||||||
|
}
|
||||||
|
clip_region_tag = private->clip_tag;
|
||||||
|
impl = private->impl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clip)
|
||||||
_gdk_gc_add_drawable_clip (gc,
|
_gdk_gc_add_drawable_clip (gc,
|
||||||
private->clip_tag,
|
clip_region_tag, clip,
|
||||||
clip,
|
|
||||||
/* If there was a clip origin set appart from the
|
/* If there was a clip origin set appart from the
|
||||||
* window offset, need to take that into consideration */
|
* window offset, need to take that into
|
||||||
|
* consideration */
|
||||||
-old_clip_x, -old_clip_y);
|
-old_clip_x, -old_clip_y);
|
||||||
|
|
||||||
|
return impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
#define BEGIN_DRAW \
|
||||||
setup_clip_for_paint (GdkDrawable *drawable,
|
{ \
|
||||||
GdkWindowPaint *paint,
|
GdkDrawable *impl; \
|
||||||
GdkGC *gc,
|
|
||||||
int old_clip_x, int old_clip_y)
|
|
||||||
{
|
|
||||||
_gdk_gc_add_drawable_clip (gc,
|
|
||||||
paint->region_tag,
|
|
||||||
/* This includes the window clip */
|
|
||||||
paint->region,
|
|
||||||
/* If there was a clip origin set appart from the
|
|
||||||
* window offset, need to take that into consideration */
|
|
||||||
-old_clip_x, -old_clip_y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define OFFSET_GC(gc) \
|
|
||||||
gint x_offset, y_offset; \
|
gint x_offset, y_offset; \
|
||||||
gint old_clip_x = gc->clip_x_origin; \
|
gint old_clip_x = gc->clip_x_origin; \
|
||||||
gint old_clip_y = gc->clip_y_origin; \
|
gint old_clip_y = gc->clip_y_origin; \
|
||||||
gint old_ts_x = gc->ts_x_origin; \
|
gint old_ts_x = gc->ts_x_origin; \
|
||||||
gint old_ts_y = gc->ts_y_origin; \
|
gint old_ts_y = gc->ts_y_origin; \
|
||||||
gdk_window_get_offsets (drawable, &x_offset, &y_offset); \
|
impl = start_draw_helper (drawable, gc, \
|
||||||
if (x_offset != 0 || y_offset != 0) \
|
&x_offset, &y_offset);
|
||||||
{ \
|
|
||||||
gdk_gc_set_clip_origin (gc, old_clip_x - x_offset, \
|
|
||||||
old_clip_y - y_offset); \
|
|
||||||
gdk_gc_set_ts_origin (gc, old_ts_x - x_offset, \
|
|
||||||
old_ts_y - y_offset); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define RESTORE_GC(gc) \
|
#define END_DRAW \
|
||||||
if (x_offset != 0 || y_offset != 0) \
|
if (x_offset != 0 || y_offset != 0) \
|
||||||
{ \
|
{ \
|
||||||
gdk_gc_set_clip_origin (gc, old_clip_x, old_clip_y); \
|
gdk_gc_set_clip_origin (gc, old_clip_x, old_clip_y); \
|
||||||
gdk_gc_set_ts_origin (gc, old_ts_x, old_ts_y); \
|
gdk_gc_set_ts_origin (gc, old_ts_x, old_ts_y); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SETUP_PAINT_GC_CLIP(gc) \
|
|
||||||
if (paint->uses_implicit) \
|
|
||||||
setup_clip_for_paint (drawable, paint, gc, old_clip_x, \
|
|
||||||
old_clip_y);
|
|
||||||
|
|
||||||
#define RESTORE_PAINT_GC_CLIP(gc)
|
|
||||||
|
|
||||||
|
|
||||||
#define SETUP_DIRECT_GC_CLIP(gc) \
|
|
||||||
gdk_window_flush ((GdkWindow *)drawable);\
|
|
||||||
setup_clip_for_draw (drawable, gc, old_clip_x, old_clip_y);
|
|
||||||
|
|
||||||
#define RESTORE_DIRECT_GC_CLIP(gc)
|
|
||||||
|
|
||||||
static GdkGC *
|
static GdkGC *
|
||||||
gdk_window_create_gc (GdkDrawable *drawable,
|
gdk_window_create_gc (GdkDrawable *drawable,
|
||||||
GdkGCValues *values,
|
GdkGCValues *values,
|
||||||
@ -3081,16 +3114,6 @@ gdk_window_create_gc (GdkDrawable *drawable,
|
|||||||
values, mask);
|
values, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* After having set up the drawable clip rect on a GC we need
|
|
||||||
* to make sure that if we draw to a pixmap we draw to the impl,
|
|
||||||
* otherwise the pixmap code will reset the drawable clip.
|
|
||||||
*/
|
|
||||||
static GdkDrawable *
|
|
||||||
pixmap_impl (GdkPixmap *pixmap)
|
|
||||||
{
|
|
||||||
return ((GdkPixmapObject *)pixmap)->impl;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_window_draw_rectangle (GdkDrawable *drawable,
|
gdk_window_draw_rectangle (GdkDrawable *drawable,
|
||||||
GdkGC *gc,
|
GdkGC *gc,
|
||||||
@ -3100,29 +3123,13 @@ gdk_window_draw_rectangle (GdkDrawable *drawable,
|
|||||||
gint width,
|
gint width,
|
||||||
gint height)
|
gint height)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (GDK_WINDOW_DESTROYED (drawable))
|
if (GDK_WINDOW_DESTROYED (drawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (private->paint_stack)
|
BEGIN_DRAW;
|
||||||
{
|
gdk_draw_rectangle (impl, gc, filled,
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
|
||||||
gdk_draw_rectangle (pixmap_impl (paint->pixmap), gc, filled,
|
|
||||||
x - x_offset, y - y_offset, width, height);
|
x - x_offset, y - y_offset, width, height);
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
END_DRAW;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_rectangle (private->impl, gc, filled,
|
|
||||||
x - x_offset, y - y_offset, width, height);
|
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
|
||||||
}
|
|
||||||
|
|
||||||
RESTORE_GC (gc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3136,30 +3143,14 @@ gdk_window_draw_arc (GdkDrawable *drawable,
|
|||||||
gint angle1,
|
gint angle1,
|
||||||
gint angle2)
|
gint angle2)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (GDK_WINDOW_DESTROYED (drawable))
|
if (GDK_WINDOW_DESTROYED (drawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (private->paint_stack)
|
BEGIN_DRAW;
|
||||||
{
|
gdk_draw_arc (impl, gc, filled,
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
|
||||||
gdk_draw_arc (pixmap_impl (paint->pixmap), gc, filled,
|
|
||||||
x - x_offset, y - y_offset,
|
x - x_offset, y - y_offset,
|
||||||
width, height, angle1, angle2);
|
width, height, angle1, angle2);
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
END_DRAW;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_arc (private->impl, gc, filled,
|
|
||||||
x - x_offset, y - y_offset,
|
|
||||||
width, height, angle1, angle2);
|
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
|
||||||
}
|
|
||||||
RESTORE_GC (gc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3169,14 +3160,13 @@ gdk_window_draw_polygon (GdkDrawable *drawable,
|
|||||||
GdkPoint *points,
|
GdkPoint *points,
|
||||||
gint npoints)
|
gint npoints)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
|
||||||
GdkPoint *new_points;
|
GdkPoint *new_points;
|
||||||
|
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (GDK_WINDOW_DESTROYED (drawable))
|
if (GDK_WINDOW_DESTROYED (drawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
BEGIN_DRAW;
|
||||||
|
|
||||||
if (x_offset != 0 || y_offset != 0)
|
if (x_offset != 0 || y_offset != 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -3191,24 +3181,12 @@ gdk_window_draw_polygon (GdkDrawable *drawable,
|
|||||||
else
|
else
|
||||||
new_points = points;
|
new_points = points;
|
||||||
|
|
||||||
if (private->paint_stack)
|
gdk_draw_polygon (impl, gc, filled, new_points, npoints);
|
||||||
{
|
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
|
||||||
gdk_draw_polygon (pixmap_impl (paint->pixmap), gc, filled, new_points, npoints);
|
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_polygon (private->impl, gc, filled, new_points, npoints);
|
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_points != points)
|
if (new_points != points)
|
||||||
g_free (new_points);
|
g_free (new_points);
|
||||||
|
|
||||||
RESTORE_GC (gc);
|
END_DRAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3220,30 +3198,13 @@ gdk_window_draw_text (GdkDrawable *drawable,
|
|||||||
const gchar *text,
|
const gchar *text,
|
||||||
gint text_length)
|
gint text_length)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (GDK_WINDOW_DESTROYED (drawable))
|
if (GDK_WINDOW_DESTROYED (drawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (private->paint_stack)
|
BEGIN_DRAW;
|
||||||
{
|
gdk_draw_text (impl, font, gc,
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
|
||||||
gdk_draw_text (pixmap_impl (paint->pixmap), font, gc,
|
|
||||||
x - x_offset, y - y_offset, text, text_length);
|
x - x_offset, y - y_offset, text, text_length);
|
||||||
|
END_DRAW;
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_text (private->impl, font, gc,
|
|
||||||
x - x_offset, y - y_offset, text, text_length);
|
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
|
||||||
}
|
|
||||||
|
|
||||||
RESTORE_GC (gc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3255,29 +3216,13 @@ gdk_window_draw_text_wc (GdkDrawable *drawable,
|
|||||||
const GdkWChar *text,
|
const GdkWChar *text,
|
||||||
gint text_length)
|
gint text_length)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (GDK_WINDOW_DESTROYED (drawable))
|
if (GDK_WINDOW_DESTROYED (drawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (private->paint_stack)
|
BEGIN_DRAW;
|
||||||
{
|
gdk_draw_text_wc (impl, font, gc,
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
|
||||||
gdk_draw_text_wc (pixmap_impl (paint->pixmap), font, gc,
|
|
||||||
x - x_offset, y - y_offset, text, text_length);
|
x - x_offset, y - y_offset, text, text_length);
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
END_DRAW;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_text_wc (private->impl, font, gc,
|
|
||||||
x - x_offset, y - y_offset, text, text_length);
|
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
|
||||||
}
|
|
||||||
|
|
||||||
RESTORE_GC (gc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkDrawable *
|
static GdkDrawable *
|
||||||
@ -3477,30 +3422,17 @@ gdk_window_draw_drawable (GdkDrawable *drawable,
|
|||||||
gint height)
|
gint height)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (GDK_WINDOW_DESTROYED (drawable))
|
if (GDK_WINDOW_DESTROYED (drawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* If we have a backing pixmap draw to that */
|
BEGIN_DRAW;
|
||||||
if (private->paint_stack)
|
|
||||||
{
|
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
|
||||||
gdk_draw_drawable (pixmap_impl (paint->pixmap), gc,
|
|
||||||
src, xsrc, ysrc,
|
|
||||||
xdest - x_offset, ydest - y_offset, width, height);
|
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_drawable (private->impl, gc,
|
|
||||||
src, xsrc, ysrc,
|
|
||||||
xdest - x_offset, ydest - y_offset,
|
|
||||||
width, height);
|
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
|
||||||
|
|
||||||
|
gdk_draw_drawable (impl, gc, src, xsrc, ysrc,
|
||||||
|
xdest - x_offset, ydest - y_offset, width, height);
|
||||||
|
|
||||||
|
if (!private->paint_stack)
|
||||||
|
{
|
||||||
/* We might have drawn from an obscured part of a client
|
/* We might have drawn from an obscured part of a client
|
||||||
side window, if so we need to send graphics exposures */
|
side window, if so we need to send graphics exposures */
|
||||||
if (_gdk_gc_get_exposures (gc) &&
|
if (_gdk_gc_get_exposures (gc) &&
|
||||||
@ -3555,7 +3487,7 @@ gdk_window_draw_drawable (GdkDrawable *drawable,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RESTORE_GC (gc);
|
END_DRAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3564,14 +3496,13 @@ gdk_window_draw_points (GdkDrawable *drawable,
|
|||||||
GdkPoint *points,
|
GdkPoint *points,
|
||||||
gint npoints)
|
gint npoints)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
|
||||||
GdkPoint *new_points;
|
GdkPoint *new_points;
|
||||||
|
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (GDK_WINDOW_DESTROYED (drawable))
|
if (GDK_WINDOW_DESTROYED (drawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
BEGIN_DRAW;
|
||||||
|
|
||||||
if (x_offset != 0 || y_offset != 0)
|
if (x_offset != 0 || y_offset != 0)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
@ -3586,24 +3517,12 @@ gdk_window_draw_points (GdkDrawable *drawable,
|
|||||||
else
|
else
|
||||||
new_points = points;
|
new_points = points;
|
||||||
|
|
||||||
if (private->paint_stack)
|
gdk_draw_points (impl, gc, new_points, npoints);
|
||||||
{
|
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
|
||||||
gdk_draw_points (pixmap_impl (paint->pixmap), gc, new_points, npoints);
|
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_points (private->impl, gc, new_points, npoints);
|
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_points != points)
|
if (new_points != points)
|
||||||
g_free (new_points);
|
g_free (new_points);
|
||||||
|
|
||||||
RESTORE_GC (gc);
|
END_DRAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3612,14 +3531,13 @@ gdk_window_draw_segments (GdkDrawable *drawable,
|
|||||||
GdkSegment *segs,
|
GdkSegment *segs,
|
||||||
gint nsegs)
|
gint nsegs)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
|
||||||
GdkSegment *new_segs;
|
GdkSegment *new_segs;
|
||||||
|
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (GDK_WINDOW_DESTROYED (drawable))
|
if (GDK_WINDOW_DESTROYED (drawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
BEGIN_DRAW;
|
||||||
|
|
||||||
if (x_offset != 0 || y_offset != 0)
|
if (x_offset != 0 || y_offset != 0)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
@ -3636,24 +3554,12 @@ gdk_window_draw_segments (GdkDrawable *drawable,
|
|||||||
else
|
else
|
||||||
new_segs = segs;
|
new_segs = segs;
|
||||||
|
|
||||||
if (private->paint_stack)
|
gdk_draw_segments (impl, gc, new_segs, nsegs);
|
||||||
{
|
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
|
||||||
gdk_draw_segments (pixmap_impl (paint->pixmap), gc, new_segs, nsegs);
|
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_segments (private->impl, gc, new_segs, nsegs);
|
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_segs != segs)
|
if (new_segs != segs)
|
||||||
g_free (new_segs);
|
g_free (new_segs);
|
||||||
|
|
||||||
RESTORE_GC (gc);
|
END_DRAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3662,14 +3568,13 @@ gdk_window_draw_lines (GdkDrawable *drawable,
|
|||||||
GdkPoint *points,
|
GdkPoint *points,
|
||||||
gint npoints)
|
gint npoints)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
|
||||||
GdkPoint *new_points;
|
GdkPoint *new_points;
|
||||||
|
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (GDK_WINDOW_DESTROYED (drawable))
|
if (GDK_WINDOW_DESTROYED (drawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
BEGIN_DRAW;
|
||||||
|
|
||||||
if (x_offset != 0 || y_offset != 0)
|
if (x_offset != 0 || y_offset != 0)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
@ -3684,24 +3589,12 @@ gdk_window_draw_lines (GdkDrawable *drawable,
|
|||||||
else
|
else
|
||||||
new_points = points;
|
new_points = points;
|
||||||
|
|
||||||
if (private->paint_stack)
|
gdk_draw_lines (impl, gc, new_points, npoints);
|
||||||
{
|
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
|
||||||
gdk_draw_lines (pixmap_impl (paint->pixmap), gc, new_points, npoints);
|
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_lines (private->impl, gc, new_points, npoints);
|
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_points != points)
|
if (new_points != points)
|
||||||
g_free (new_points);
|
g_free (new_points);
|
||||||
|
|
||||||
RESTORE_GC (gc);
|
END_DRAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3712,30 +3605,13 @@ gdk_window_draw_glyphs (GdkDrawable *drawable,
|
|||||||
gint y,
|
gint y,
|
||||||
PangoGlyphString *glyphs)
|
PangoGlyphString *glyphs)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
|
||||||
|
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (GDK_WINDOW_DESTROYED (drawable))
|
if (GDK_WINDOW_DESTROYED (drawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (private->paint_stack)
|
BEGIN_DRAW;
|
||||||
{
|
gdk_draw_glyphs (impl, gc, font,
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
|
||||||
gdk_draw_glyphs (pixmap_impl (paint->pixmap), gc, font, x - x_offset, y - y_offset, glyphs);
|
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_glyphs (private->impl, gc, font,
|
|
||||||
x - x_offset, y - y_offset, glyphs);
|
x - x_offset, y - y_offset, glyphs);
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
END_DRAW;
|
||||||
}
|
|
||||||
|
|
||||||
RESTORE_GC (gc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3747,14 +3623,13 @@ gdk_window_draw_glyphs_transformed (GdkDrawable *drawable,
|
|||||||
gint y,
|
gint y,
|
||||||
PangoGlyphString *glyphs)
|
PangoGlyphString *glyphs)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
|
||||||
PangoMatrix tmp_matrix;
|
PangoMatrix tmp_matrix;
|
||||||
|
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (GDK_WINDOW_DESTROYED (drawable))
|
if (GDK_WINDOW_DESTROYED (drawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
BEGIN_DRAW;
|
||||||
|
|
||||||
if (x_offset != 0 || y_offset != 0)
|
if (x_offset != 0 || y_offset != 0)
|
||||||
{
|
{
|
||||||
if (matrix)
|
if (matrix)
|
||||||
@ -3780,22 +3655,9 @@ gdk_window_draw_glyphs_transformed (GdkDrawable *drawable,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (private->paint_stack)
|
gdk_draw_glyphs_transformed (impl, gc, matrix, font, x, y, glyphs);
|
||||||
{
|
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
END_DRAW;
|
||||||
gdk_draw_glyphs_transformed (pixmap_impl (paint->pixmap), gc, matrix, font, x, y, glyphs);
|
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_glyphs_transformed (private->impl, gc, matrix, font, x, y, glyphs);
|
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
|
||||||
}
|
|
||||||
|
|
||||||
RESTORE_GC (gc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -4199,33 +4061,14 @@ gdk_window_draw_image (GdkDrawable *drawable,
|
|||||||
gint width,
|
gint width,
|
||||||
gint height)
|
gint height)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
|
||||||
|
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (GDK_WINDOW_DESTROYED (drawable))
|
if (GDK_WINDOW_DESTROYED (drawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (private->paint_stack)
|
BEGIN_DRAW;
|
||||||
{
|
gdk_draw_image (impl, gc, image, xsrc, ysrc,
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
|
||||||
gdk_draw_image (pixmap_impl (paint->pixmap), gc, image, xsrc, ysrc,
|
|
||||||
xdest - x_offset, ydest - y_offset,
|
xdest - x_offset, ydest - y_offset,
|
||||||
width, height);
|
width, height);
|
||||||
|
END_DRAW;
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_image (private->impl, gc, image, xsrc, ysrc,
|
|
||||||
xdest - x_offset, ydest - y_offset,
|
|
||||||
width, height);
|
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
|
||||||
}
|
|
||||||
|
|
||||||
RESTORE_GC (gc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4252,32 +4095,18 @@ gdk_window_draw_pixbuf (GdkDrawable *drawable,
|
|||||||
if (!gc)
|
if (!gc)
|
||||||
gc = _gdk_drawable_get_scratch_gc (drawable, FALSE);
|
gc = _gdk_drawable_get_scratch_gc (drawable, FALSE);
|
||||||
|
|
||||||
/* Need block to make OFFSET_GC macro to work */
|
BEGIN_DRAW;
|
||||||
{
|
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (private->paint_stack)
|
if (private->paint_stack)
|
||||||
{
|
gdk_draw_pixbuf (impl, gc, pixbuf, src_x, src_y,
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
|
||||||
gdk_draw_pixbuf (pixmap_impl (paint->pixmap), gc, pixbuf, src_x, src_y,
|
|
||||||
dest_x - x_offset, dest_y - y_offset,
|
dest_x - x_offset, dest_y - y_offset,
|
||||||
width, height,
|
width, height,
|
||||||
dither, x_dither - x_offset, y_dither - y_offset);
|
dither, x_dither - x_offset, y_dither - y_offset);
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
gdk_draw_pixbuf (impl, gc, pixbuf, src_x, src_y,
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_pixbuf (private->impl, gc, pixbuf, src_x, src_y,
|
|
||||||
dest_x - x_offset, dest_y - y_offset,
|
dest_x - x_offset, dest_y - y_offset,
|
||||||
width, height,
|
width, height,
|
||||||
dither, x_dither, y_dither);
|
dither, x_dither, y_dither);
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
END_DRAW;
|
||||||
}
|
|
||||||
|
|
||||||
RESTORE_GC (gc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4286,14 +4115,13 @@ gdk_window_draw_trapezoids (GdkDrawable *drawable,
|
|||||||
GdkTrapezoid *trapezoids,
|
GdkTrapezoid *trapezoids,
|
||||||
gint n_trapezoids)
|
gint n_trapezoids)
|
||||||
{
|
{
|
||||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
|
||||||
GdkTrapezoid *new_trapezoids = NULL;
|
GdkTrapezoid *new_trapezoids = NULL;
|
||||||
|
|
||||||
OFFSET_GC (gc);
|
|
||||||
|
|
||||||
if (GDK_WINDOW_DESTROYED (drawable))
|
if (GDK_WINDOW_DESTROYED (drawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
BEGIN_DRAW;
|
||||||
|
|
||||||
if (x_offset != 0 || y_offset != 0)
|
if (x_offset != 0 || y_offset != 0)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
@ -4312,23 +4140,11 @@ gdk_window_draw_trapezoids (GdkDrawable *drawable,
|
|||||||
trapezoids = new_trapezoids;
|
trapezoids = new_trapezoids;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (private->paint_stack)
|
gdk_draw_trapezoids (impl, gc, trapezoids, n_trapezoids);
|
||||||
{
|
|
||||||
GdkWindowPaint *paint = private->paint_stack->data;
|
|
||||||
SETUP_PAINT_GC_CLIP (gc);
|
|
||||||
gdk_draw_trapezoids (pixmap_impl (paint->pixmap), gc, trapezoids, n_trapezoids);
|
|
||||||
RESTORE_PAINT_GC_CLIP (gc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SETUP_DIRECT_GC_CLIP(gc);
|
|
||||||
gdk_draw_trapezoids (private->impl, gc, trapezoids, n_trapezoids);
|
|
||||||
RESTORE_DIRECT_GC_CLIP(gc);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (new_trapezoids);
|
g_free (new_trapezoids);
|
||||||
|
|
||||||
RESTORE_GC (gc);
|
END_DRAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user