From 362a9f564a9a58c48ab0129ca3ac997d0cb84bab Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Tue, 15 Sep 2009 01:34:33 -0400 Subject: [PATCH] Move more things out of the inner loop in do_composite(). Specifically, - the src_ and mask_repeat computations - the check for whether the involved images cover the composite region. --- pixman/pixman.c | 100 ++++++++++++++++++++++++-------------------------------- 1 file changed, 42 insertions(+), 58 deletions(-) diff --git a/pixman/pixman.c b/pixman/pixman.c index 9d0641b..9821d09 100644 --- a/pixman/pixman.c +++ b/pixman/pixman.c @@ -528,7 +528,9 @@ 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_bool_t src_repeat, mask_repeat; pixman_region32_t region; + pixman_box32_t *extents; get_image_info (src, &src_format, &src_flags); get_image_info (mask, &mask_format, &mask_flags); @@ -546,6 +548,19 @@ do_composite (pixman_implementation_t *imp, src_format = mask_format = PIXMAN_rpixbuf; } + src_repeat = + src->type == BITS && + src_flags & FAST_PATH_ID_TRANSFORM && + src->common.repeat == PIXMAN_REPEAT_NORMAL && + src_format != PIXMAN_solid; + + mask_repeat = + mask && + mask->type == BITS && + mask_flags & FAST_PATH_ID_TRANSFORM && + mask->common.repeat == PIXMAN_REPEAT_NORMAL && + mask_format != PIXMAN_solid; + pixman_region32_init (®ion); if (!pixman_compute_composite_region32 ( @@ -555,63 +570,34 @@ do_composite (pixman_implementation_t *imp, return; } + extents = pixman_region32_extents (®ion); + + if (image_covers (src, extents, dest_x - src_x, dest_y - src_y)) + src_flags |= FAST_PATH_COVERS_CLIP; + + if (mask && image_covers (mask, extents, dest_x - mask_x, dest_y - mask_y)) + mask_flags |= FAST_PATH_COVERS_CLIP; + while (imp) { - { - pixman_composite_func_t func; - const pixman_fast_path_t *info; - pixman_bool_t result; - pixman_box32_t *extents; - - result = FALSE; - - extents = pixman_region32_extents (®ion); - - if (image_covers (src, extents, dest_x - src_x, dest_y - src_y)) - src_flags |= FAST_PATH_COVERS_CLIP; - - if (mask && image_covers (mask, extents, dest_x - mask_x, dest_y - mask_y)) - mask_flags |= FAST_PATH_COVERS_CLIP; + const pixman_fast_path_t *info; - func = NULL; - for (info = imp->fast_paths; info->op != PIXMAN_OP_NONE; ++info) - { - if ((info->op == op || info->op == PIXMAN_OP_any) && - /* src */ - ((info->src_format == src_format) || - (info->src_format == PIXMAN_any)) && - (info->src_flags & src_flags) == info->src_flags && - /* mask */ - ((info->mask_format == mask_format) || - (info->mask_format == PIXMAN_any)) && - (info->mask_flags & mask_flags) == info->mask_flags && - /* dest */ - ((info->dest_format == dest_format) || - (info->dest_format == PIXMAN_any)) && - (info->dest_flags & dest_flags) == info->dest_flags) - { - func = info->func; - break; - } - } - - if (func) + for (info = imp->fast_paths; info->op != PIXMAN_OP_NONE; ++info) + { + if ((info->op == op || info->op == PIXMAN_OP_any) && + /* src */ + ((info->src_format == src_format) || + (info->src_format == PIXMAN_any)) && + (info->src_flags & src_flags) == info->src_flags && + /* mask */ + ((info->mask_format == mask_format) || + (info->mask_format == PIXMAN_any)) && + (info->mask_flags & mask_flags) == info->mask_flags && + /* dest */ + ((info->dest_format == dest_format) || + (info->dest_format == PIXMAN_any)) && + (info->dest_flags & dest_flags) == info->dest_flags) { - pixman_bool_t src_repeat, mask_repeat; - - src_repeat = - src->type == BITS && - src_flags & FAST_PATH_ID_TRANSFORM && - src->common.repeat == PIXMAN_REPEAT_NORMAL && - src_format != PIXMAN_solid; - - mask_repeat = - mask && - mask->type == BITS && - mask_flags & FAST_PATH_ID_TRANSFORM && - mask->common.repeat == PIXMAN_REPEAT_NORMAL && - mask_format != PIXMAN_solid; - walk_region_internal (imp, op, src, mask, dest, src_x, src_y, mask_x, mask_y, @@ -619,18 +605,16 @@ do_composite (pixman_implementation_t *imp, width, height, src_repeat, mask_repeat, ®ion, - func); + info->func); - result = TRUE; + goto done; } - - if (result) - break; } imp = imp->delegate; } +done: pixman_region32_fini (®ion); } -- 2.7.4