From 129d9c187146a060863598d154e6770394547afd Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Tue, 15 Sep 2009 01:16:40 -0400 Subject: [PATCH] Move region computation out of the loop in do_composite() We only need to compute the composite region once, not on every iteration. --- pixman/pixman.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/pixman/pixman.c b/pixman/pixman.c index 822d7f4..9d0641b 100644 --- a/pixman/pixman.c +++ b/pixman/pixman.c @@ -528,6 +528,7 @@ do_composite (pixman_implementation_t *imp, { pixman_format_code_t src_format, mask_format, dest_format; uint32_t src_flags, mask_flags, dest_flags; + pixman_region32_t region; get_image_info (src, &src_format, &src_flags); get_image_info (mask, &mask_format, &mask_flags); @@ -545,24 +546,23 @@ do_composite (pixman_implementation_t *imp, src_format = mask_format = PIXMAN_rpixbuf; } + 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)) + { + return; + } + while (imp) { { pixman_composite_func_t func; const pixman_fast_path_t *info; pixman_bool_t result; - pixman_region32_t region; 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)) - { - return; - } - result = FALSE; extents = pixman_region32_extents (®ion); @@ -624,13 +624,14 @@ do_composite (pixman_implementation_t *imp, result = TRUE; } - pixman_region32_fini (®ion); if (result) - return; + break; } imp = imp->delegate; } + + pixman_region32_fini (®ion); } /* -- 2.7.4