diff options
author | Benjamin Otte <otte@gnome.org> | 2009-11-04 11:15:57 +0100 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2009-11-04 11:20:45 +0100 |
commit | 52afe9c77f2f54372fefeca50321a27e8dda0f63 (patch) | |
tree | 09769389ff237dde8bd3015c84b18a037d2e8e84 | |
parent | 84bbf179c375622d2c7b4e21b1b8ce189b5a18f2 (diff) |
[xlib] Fix new Composite test
When the reference point was tirggering _line_exceeds_16_16() and got
adjusted, the code failed to compute the srcX and srcY arguments for the
call to XRenderCompositeTrapezoids() correctly and caused the resulting
source image to be misaligned.
-rw-r--r-- | src/cairo-fixed-private.h | 9 | ||||
-rw-r--r-- | src/cairo-xlib-surface.c | 22 |
2 files changed, 20 insertions, 11 deletions
diff --git a/src/cairo-fixed-private.h b/src/cairo-fixed-private.h index e3add4ae..68fa5778 100644 --- a/src/cairo-fixed-private.h +++ b/src/cairo-fixed-private.h @@ -217,6 +217,15 @@ _cairo_fixed_16_16_from_double (double d) #endif } +static inline int +_cairo_fixed_16_16_floor (cairo_fixed_t f) +{ + if (f >= 0) + return f >> 16; + else + return -((-f - 1) >> 16) - 1; +} + #if CAIRO_FIXED_BITS == 32 static inline cairo_fixed_t diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 03053f00..fc235a9f 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -2605,17 +2605,6 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t op, break; } - if (traps[0].left.p1.y < traps[0].left.p2.y) { - render_reference_x = _cairo_fixed_integer_floor (traps[0].left.p1.x); - render_reference_y = _cairo_fixed_integer_floor (traps[0].left.p1.y); - } else { - render_reference_x = _cairo_fixed_integer_floor (traps[0].left.p2.x); - render_reference_y = _cairo_fixed_integer_floor (traps[0].left.p2.y); - } - - render_src_x = src_x + render_reference_x - dst_x; - render_src_y = src_y + render_reference_y - dst_y; - status = _cairo_xlib_surface_set_clip_region (dst, clip_region); if (unlikely (status)) goto BAIL; @@ -2674,6 +2663,17 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t op, } } + if (xtraps[0].left.p1.y < xtraps[0].left.p2.y) { + render_reference_x = _cairo_fixed_16_16_floor (xtraps[0].left.p1.x); + render_reference_y = _cairo_fixed_16_16_floor (xtraps[0].left.p1.y); + } else { + render_reference_x = _cairo_fixed_16_16_floor (xtraps[0].left.p2.x); + render_reference_y = _cairo_fixed_16_16_floor (xtraps[0].left.p2.y); + } + + render_src_x = src_x + render_reference_x - dst_x; + render_src_y = src_y + render_reference_y - dst_y; + XRenderCompositeTrapezoids (dst->dpy, _render_operator (op), src->src_picture, dst->dst_picture, |