summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <sandmann@redhat.com>2009-09-15 01:16:40 -0400
committerSøren Sandmann Pedersen <sandmann@redhat.com>2010-02-14 21:45:25 -0500
commit129d9c187146a060863598d154e6770394547afd (patch)
treec97b783a71184271999a17d7b8db24a49cd3d975
parent4c185503d26374915942d1f64c02134e4a2c5a99 (diff)
Move region computation out of the loop in do_composite()
We only need to compute the composite region once, not on every iteration.
-rw-r--r--pixman/pixman.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/pixman/pixman.c b/pixman/pixman.c
index 822d7f42..9d0641ba 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 (&region);
+
+ if (!pixman_compute_composite_region32 (
+ &region, 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 (&region);
-
- if (!pixman_compute_composite_region32 (
- &region, src, mask, dest,
- src_x, src_y, mask_x, mask_y, dest_x, dest_y, width, height))
- {
- return;
- }
-
result = FALSE;
extents = pixman_region32_extents (&region);
@@ -624,13 +624,14 @@ do_composite (pixman_implementation_t *imp,
result = TRUE;
}
- pixman_region32_fini (&region);
if (result)
- return;
+ break;
}
imp = imp->delegate;
}
+
+ pixman_region32_fini (&region);
}
/*