summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2010-04-24 17:08:10 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2010-04-24 17:10:52 -0400
commit9ed63ead50e2d174544a3c912e98760578e210de (patch)
tree9d4de585987e84fddcadb14d858bc7bc9d340c72
parentf3fc92efe962fed4c3d6ebc8595ac6383b8bc8bf (diff)
Move the selection of the implementation to an inline function.impcache
This is cleaner and avoids the name clash between "imp" as a function argument and imp as a global variable.
-rw-r--r--pixman/pixman.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/pixman/pixman.c b/pixman/pixman.c
index 435340b8..393cdb9b 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -30,7 +30,16 @@
#include <stdlib.h>
-static pixman_implementation_t *imp;
+static force_inline pixman_implementation_t *
+get_implementation (void)
+{
+ static pixman_implementation_t *imp;
+
+ if (!imp)
+ imp = _pixman_choose_implementation();
+
+ return imp;
+}
typedef struct operator_info_t operator_info_t;
@@ -820,10 +829,7 @@ pixman_image_composite32 (pixman_op_t op,
_pixman_image_validate (mask);
_pixman_image_validate (dest);
- if (!imp)
- imp = _pixman_choose_implementation ();
-
- do_composite (imp, op,
+ do_composite (get_implementation(), op,
src, mask, dest,
src_x, src_y,
mask_x, mask_y,
@@ -845,10 +851,8 @@ pixman_blt (uint32_t *src_bits,
int width,
int height)
{
- if (!imp)
- imp = _pixman_choose_implementation ();
-
- return _pixman_implementation_blt (imp, src_bits, dst_bits, src_stride, dst_stride,
+ return _pixman_implementation_blt (get_implementation(),
+ src_bits, dst_bits, src_stride, dst_stride,
src_bpp, dst_bpp,
src_x, src_y,
dst_x, dst_y,
@@ -865,10 +869,8 @@ pixman_fill (uint32_t *bits,
int height,
uint32_t xor)
{
- if (!imp)
- imp = _pixman_choose_implementation ();
-
- return _pixman_implementation_fill (imp, bits, stride, bpp, x, y, width, height, xor);
+ return _pixman_implementation_fill (get_implementation(),
+ bits, stride, bpp, x, y, width, height, xor);
}
static uint32_t