From 08eb065c568de5c0cb67b7b02ccb17bf72d5059c Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Wed, 3 Jun 2009 05:21:29 -0400 Subject: [PATCH] Move region computation closer to the region walking. Computing the composite is region is a bit expensive, so only compute it if we are likely to actually walk it. --- pixman/pixman-utils.c | 63 +++++++++++++++++++++------------------------------ 1 file changed, 26 insertions(+), 37 deletions(-) diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c index 7fa89fa..c13bc3b 100644 --- a/pixman/pixman-utils.c +++ b/pixman/pixman-utils.c @@ -758,19 +758,7 @@ _pixman_run_fast_path (const FastPathInfo *paths, pixman_composite_func_t func = NULL; pixman_bool_t src_repeat = src->common.repeat == PIXMAN_REPEAT_NORMAL; pixman_bool_t mask_repeat = mask && mask->common.repeat == PIXMAN_REPEAT_NORMAL; - pixman_region32_t region; pixman_bool_t result; - pixman_box32_t extents; - - pixman_region32_init (®ion); - - if (!pixman_compute_composite_region32 ( - ®ion, src, mask, dest, src_x, src_y, mask_x, mask_y, dest_x, dest_y, width, height)) - { - result = TRUE; - - goto out; - } if ((src->type == BITS || pixman_image_can_get_solid (src)) && (!mask || mask->type == BITS) @@ -791,16 +779,6 @@ _pixman_run_fast_path (const FastPathInfo *paths, const FastPathInfo *info; pixman_bool_t pixbuf; - extents = *pixman_region32_extents (®ion); - - if (!image_covers (src, &extents) || - (mask && !image_covers (mask, &extents))) - { - result = FALSE; - - goto out; - } - pixbuf = src && src->type == BITS && mask && mask->type == BITS && @@ -842,25 +820,36 @@ _pixman_run_fast_path (const FastPathInfo *paths, } } + result = FALSE; + if (func) { - walk_region_internal (imp, op, - src, mask, dest, - src_x, src_y, mask_x, mask_y, - dest_x, dest_y, - width, height, - src_repeat, mask_repeat, - ®ion, - func); + pixman_region32_t region; + pixman_region32_init (®ion); + + if (pixman_compute_composite_region32 ( + ®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); - result = TRUE; - } - else - { - result = FALSE; + if (image_covers (src, extents) && + (!mask || image_covers (mask, extents))) + { + walk_region_internal (imp, op, + src, mask, dest, + src_x, src_y, mask_x, mask_y, + dest_x, dest_y, + width, height, + src_repeat, mask_repeat, + ®ion, + func); + + result = TRUE; + } + } + + pixman_region32_fini (®ion); } -out: - pixman_region32_fini (®ion); return result; } -- 2.7.4