Clean up gdk_draw_drawable() composite handling

Instead of doing some magic in gdk_draw_drawable() to avoid double
offsetting when calling gdk_draw_drawable on the impl we call
the vfunc directly on the impl. Thus removing the weird magic from
gdk_draw_drawable().

I tested this with the testgtk test "text", where if the original magic
code is disabled typing a newline in the middle of a text line causes
the double offset issue to appear.
This commit is contained in:
Alexander Larsson 2009-08-25 10:34:10 +02:00
parent c0084e2142
commit c2546c859d
3 changed files with 19 additions and 20 deletions

View File

@ -634,7 +634,7 @@ gdk_draw_drawable (GdkDrawable *drawable,
gint width,
gint height)
{
GdkDrawable *composite, *composite_impl;
GdkDrawable *composite;
gint composite_x_offset = 0;
gint composite_y_offset = 0;
@ -663,24 +663,13 @@ gdk_draw_drawable (GdkDrawable *drawable,
&composite_x_offset,
&composite_y_offset);
/* The draw_drawable call below is will recurse into gdk_draw_drawable again,
* specifying the right impl for the destination. This means the composite
* we got here will be fed to get_composite_drawable again, which is a problem
* for window as that causes double the composite offset. Avoid this by passing
* in the impl directly.
*/
if (GDK_IS_WINDOW (composite))
composite_impl = GDK_WINDOW_OBJECT (src)->impl;
else
composite_impl = composite;
/* TODO: For non-native windows this may copy stuff from other overlapping
windows. We should clip that and (for windows with bg != None) clear that
area in the destination instead. */
if (GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable_with_src)
GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable_with_src (drawable, gc,
composite_impl,
composite,
xsrc - composite_x_offset,
ysrc - composite_y_offset,
xdest, ydest,
@ -688,7 +677,7 @@ gdk_draw_drawable (GdkDrawable *drawable,
src);
else /* backwards compat for old out-of-tree implementations of GdkDrawable (are there any?) */
GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc,
composite_impl,
composite,
xsrc - composite_x_offset,
ysrc - composite_y_offset,
xdest, ydest,

View File

@ -385,10 +385,14 @@ gdk_pixmap_draw_drawable (GdkDrawable *drawable,
{
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
_gdk_gc_remove_drawable_clip (gc);
gdk_draw_drawable (private->impl, gc, src, xsrc, ysrc,
xdest, ydest,
width, height);
_gdk_gc_remove_drawable_clip (gc);
/* Call the method directly to avoid getting the composite drawable again */
GDK_DRAWABLE_GET_CLASS (private->impl)->draw_drawable_with_src (private->impl, gc,
src,
xsrc, ysrc,
xdest, ydest,
width, height,
original_src);
}
static void

View File

@ -3654,8 +3654,14 @@ gdk_window_draw_drawable (GdkDrawable *drawable,
BEGIN_DRAW;
gdk_draw_drawable (impl, gc, src, xsrc, ysrc,
xdest - x_offset, ydest - y_offset, width, height);
/* Call the method directly to avoid getting the composite drawable again */
GDK_DRAWABLE_GET_CLASS (impl)->draw_drawable_with_src (impl, gc,
src,
xsrc, ysrc,
xdest - x_offset,
ydest - y_offset,
width, height,
original_src);
if (!private->paint_stack)
{