[Pixman] [PATCH 5/6] Always return a valid function from lookup_combiner()

Chris Wilson chris at chris-wilson.co.uk
Wed Jan 23 02:40:35 PST 2013


We should always have at least a C combiner available, so we never
expect the search to fail. If it does, emit an error and return a
dummy function.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 pixman/pixman-general.c        |    3 ---
 pixman/pixman-implementation.c |   14 +++++++++++++-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index f175d77..93a1b9a 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -188,9 +188,6 @@ general_composite_rect  (pixman_implementation_t *imp,
     compose = _pixman_implementation_lookup_combiner (
 	imp->toplevel, op, component_alpha, narrow);
 
-    if (!compose)
-	return;
-
     for (i = 0; i < height; ++i)
     {
 	uint32_t *s, *m, *d;
diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index 05cb5ea..c0a6436 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -172,6 +172,16 @@ update_cache:
     }
 }
 
+static void
+dummy_combine (pixman_implementation_t *imp,
+	       pixman_op_t              op,
+	       uint32_t *               pd,
+	       const uint32_t *         ps,
+	       const uint32_t *         pm,
+	       int                      w)
+{
+}
+
 pixman_combine_32_func_t
 _pixman_implementation_lookup_combiner (pixman_implementation_t *imp,
 					pixman_op_t		 op,
@@ -207,7 +217,9 @@ _pixman_implementation_lookup_combiner (pixman_implementation_t *imp,
 	imp = imp->fallback;
     }
 
-    return NULL;
+    /* We should never reach this point */
+    _pixman_log_error (FUNC, "No known combine function\n");
+    return dummy_combine;
 }
 
 pixman_bool_t
-- 
1.7.10.4



More information about the Pixman mailing list