From: Søren Sandmann Pedersen <s...@redhat.com>

Instead of initializing an array on the stack, just use a simple
switch to select which set of combiners to look up in.
---
 pixman/pixman-implementation.c |   37 ++++++++++++++++++++++++-------------
 1 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index 77d0906..d2573ab 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -121,25 +121,36 @@ _pixman_implementation_lookup_combiner 
(pixman_implementation_t *imp,
                                        pixman_bool_t            
component_alpha,
                                        pixman_bool_t            narrow)
 {
-    pixman_combine_32_func_t f;
-
-    do
+    while (imp)
     {
-       pixman_combine_32_func_t (*combiners[]) =
+       pixman_combine_32_func_t f = NULL;
+
+       switch ((narrow << 1) | component_alpha)
        {
-           (pixman_combine_32_func_t *)imp->combine_64,
-           (pixman_combine_32_func_t *)imp->combine_64_ca,
-           imp->combine_32,
-           imp->combine_32_ca,
-       };
+       case 0: /* not narrow, not component alpha */
+           f = (pixman_combine_32_func_t)imp->combine_64[op];
+           break;
+           
+       case 1: /* not narrow, component_alpha */
+           f = (pixman_combine_32_func_t)imp->combine_64_ca[op];
+           break;
+
+       case 2: /* narrow, not component alpha */
+           f = imp->combine_32[op];
+           break;
+
+       case 3: /* narrow, component_alpha */
+           f = imp->combine_32_ca[op];
+           break;
+       }
 
-       f = combiners[component_alpha | (narrow << 1)][op];
+       if (f)
+           return f;
 
        imp = imp->delegate;
     }
-    while (!f);
 
-    return f;
+    return NULL;
 }
 
 pixman_bool_t
-- 
1.7.4

_______________________________________________
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to