diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2011-03-11 07:52:57 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2011-03-28 12:19:24 -0400 |
commit | bd09657ce30f916eeff342a41921260686120204 (patch) | |
tree | d896c93e1eeb8360b16241fd07aad8f29feebced | |
parent | ad3cbfb073fc325e1b3152898ca71b8255675957 (diff) |
Offset rendering in pixman_composite_trapezoids() by (x_dst, y_dst)trap-offset
Previously, this function would do coordinate calculations in such a
way that (x_dst, y_dst) would only affect the alignment of the source
image, but not of the traps, which would always be considered to be in
absolute destination coordinates. This is unlike the
pixman_image_composite() function which also registers the mask to the
destination.
This patch makes it so that traps are also offset by (x_dst, y_dst).
Also add a comment explaining how this function is supposed to
operate, and update tri-test.c and composite-trap-test.c to deal with
the new semantics.
-rw-r--r-- | demos/tri-test.c | 2 | ||||
-rw-r--r-- | pixman/pixman-trap.c | 23 | ||||
-rw-r--r-- | test/composite-traps-test.c | 2 |
3 files changed, 19 insertions, 8 deletions
diff --git a/demos/tri-test.c b/demos/tri-test.c index ff4779e4..a71869a6 100644 --- a/demos/tri-test.c +++ b/demos/tri-test.c @@ -36,7 +36,7 @@ main (int argc, char **argv) dest_img, PIXMAN_a8, 200, 200, - 35, 5, + -5, 5, ARRAY_LENGTH (tris), tris); show_image (dest_img); diff --git a/pixman/pixman-trap.c b/pixman/pixman-trap.c index 2957a2bc..c99f03ec 100644 --- a/pixman/pixman-trap.c +++ b/pixman/pixman-trap.c @@ -387,6 +387,19 @@ pixman_rasterize_trapezoid (pixman_image_t * image, } } +/* + * pixman_composite_trapezoids() + * + * All the trapezoids are conceptually rendered to an infinitely big image. + * The (0, 0) coordinates of this image are then aligned with the (x, y) + * coordinates of the source image, and then both images are aligned with + * the (x, y) coordinates of the destination. Then, in principle, compositing + * of these three images takes place across the entire destination. + * + * FIXME: However, there is currently a bug, where we restrict this compositing + * to the bounding box of the trapezoids. This is incorrect for operators such + * as SRC and IN where blank source pixels do have an effect on the destination. + */ PIXMAN_EXPORT void pixman_composite_trapezoids (pixman_op_t op, pixman_image_t * src, @@ -419,14 +432,13 @@ pixman_composite_trapezoids (pixman_op_t op, if (!pixman_trapezoid_valid (trap)) continue; - pixman_rasterize_trapezoid (dst, trap, 0, 0); + pixman_rasterize_trapezoid (dst, trap, x_dst, y_dst); } } else { pixman_image_t *tmp; pixman_box32_t box; - int x_rel, y_rel; box.x1 = INT32_MAX; box.y1 = INT32_MAX; @@ -482,11 +494,10 @@ pixman_composite_trapezoids (pixman_op_t op, pixman_rasterize_trapezoid (tmp, trap, - box.x1, - box.y1); } - x_rel = box.x1 + x_src - x_dst; - y_rel = box.y1 + y_src - y_dst; - pixman_image_composite (op, src, tmp, dst, - x_rel, y_rel, 0, 0, box.x1, box.y1, + x_src + box.x1, y_src + box.y1, + 0, 0, + x_dst + box.x1, y_dst + box.y1, box.x2 - box.x1, box.y2 - box.y1); pixman_image_unref (tmp); diff --git a/test/composite-traps-test.c b/test/composite-traps-test.c index cf30281b..fa6d8a98 100644 --- a/test/composite-traps-test.c +++ b/test/composite-traps-test.c @@ -252,6 +252,6 @@ test_composite (int testnum, int main (int argc, const char *argv[]) { - return fuzzer_test_main("composite traps", 40000, 0xA34F95C7, + return fuzzer_test_main("composite traps", 40000, 0xE3112106, test_composite, argc, argv); } |