From 895a8da63370635b05ffb91d3d670c6627d8b2ab Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Wed, 24 Jun 2009 11:28:03 -0400 Subject: [PATCH] Fix offset bug in pixman_run_fast_path(). Fast paths should only run when the source images complete cover the composite region, because otherwise they would be required to sample the border, and fast paths generally don't know how to do that. The check for this did not work right because it didn't take the offset generated by the composite coordinates into account. This commits fixes that by adding (x, y) coordinates to image cover indicating the new position of the source in destination coordinates. Based on this we now compare against the region extents which are already in destination coordinates. --- pixman/pixman-utils.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c index 497e8c9..188cde8 100644 --- a/pixman/pixman-utils.c +++ b/pixman/pixman-utils.c @@ -567,13 +567,13 @@ get_fast_path (const pixman_fast_path_t *fast_paths, } static inline pixman_bool_t -image_covers (pixman_image_t *image, pixman_box32_t *extents) +image_covers (pixman_image_t *image, pixman_box32_t *extents, int x, int y) { if (image->common.type == BITS && image->common.repeat == PIXMAN_REPEAT_NONE) { - if (extents->x1 < 0 || extents->y1 < 0 || - extents->x2 >= image->bits.width || - extents->y2 >= image->bits.height) + if (x > extents->x1 || y > extents->y1 || + x + image->bits.width < extents->x2 || + y + image->bits.height < extents->y2) { return FALSE; } @@ -674,9 +674,9 @@ _pixman_run_fast_path (const pixman_fast_path_t *paths, ®ion, src, mask, dest, src_x, src_y, mask_x, mask_y, dest_x, dest_y, width, height)) { pixman_box32_t *extents = pixman_region32_extents (®ion); - - if (image_covers (src, extents) && - (!mask || image_covers (mask, extents))) + + if (image_covers (src, extents, dest_x - src_x, dest_y - src_y) && + (!mask || image_covers (mask, extents, dest_x - mask_x, dest_y - mask_y))) { walk_region_internal (imp, op, src, mask, dest, -- 2.7.4