diff options
author | Søren Sandmann Pedersen <sandmann@redhat.com> | 2009-09-15 01:14:41 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <sandmann@redhat.com> | 2010-02-14 21:45:13 -0500 |
commit | 4c185503d26374915942d1f64c02134e4a2c5a99 (patch) | |
tree | 1dd8ef24b12afd8592c38ab21aec33e286f7bca0 | |
parent | 81b7d7b18050c770f272fd10aa7f5cf85ddc25cc (diff) |
Move get_image_info() out of the loop in do_composite
The computation of image formats and flags is invariant to the loop,
so it can all be moved out.
-rw-r--r-- | pixman/pixman.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/pixman/pixman.c b/pixman/pixman.c index 25f773b7..822d7f42 100644 --- a/pixman/pixman.c +++ b/pixman/pixman.c @@ -526,33 +526,34 @@ do_composite (pixman_implementation_t *imp, int width, int height) { + pixman_format_code_t src_format, mask_format, dest_format; + uint32_t src_flags, mask_flags, dest_flags; + + get_image_info (src, &src_format, &src_flags); + get_image_info (mask, &mask_format, &mask_flags); + get_image_info (dest, &dest_format, &dest_flags); + + /* Check for pixbufs */ + if ((mask_format == PIXMAN_a8r8g8b8 || mask_format == PIXMAN_a8b8g8r8) && + (src->type == BITS && src->bits.bits == mask->bits.bits) && + (src->common.repeat == mask->common.repeat) && + (src_x == mask_x && src_y == mask_y)) + { + if (src_format == PIXMAN_x8b8g8r8) + src_format = mask_format = PIXMAN_pixbuf; + else if (src_format == PIXMAN_x8r8g8b8) + src_format = mask_format = PIXMAN_rpixbuf; + } + while (imp) { { - pixman_format_code_t src_format, mask_format, dest_format; - uint32_t src_flags, mask_flags, dest_flags; pixman_composite_func_t func; const pixman_fast_path_t *info; pixman_bool_t result; pixman_region32_t region; pixman_box32_t *extents; - get_image_info (src, &src_format, &src_flags); - get_image_info (mask, &mask_format, &mask_flags); - get_image_info (dest, &dest_format, &dest_flags); - - /* Check for pixbufs */ - if ((mask_format == PIXMAN_a8r8g8b8 || mask_format == PIXMAN_a8b8g8r8) && - (src->type == BITS && src->bits.bits == mask->bits.bits) && - (src->common.repeat == mask->common.repeat) && - (src_x == mask_x && src_y == mask_y)) - { - if (src_format == PIXMAN_x8b8g8r8) - src_format = mask_format = PIXMAN_pixbuf; - else if (src_format == PIXMAN_x8r8g8b8) - src_format = mask_format = PIXMAN_rpixbuf; - } - pixman_region32_init (®ion); if (!pixman_compute_composite_region32 ( |