[Pixman] [PATCH 2/6] Add a noop composite function for the DST operator

Søren Sandmann Pedersen sandmann at cs.au.dk
Tue May 3 04:42:43 PDT 2011


From: Søren Sandmann Pedersen <ssp at redhat.com>

The DST operator doesn't actually do anything, so add a noop fast path
for it instead of checking in pixman_image_composite32(). The
performance tradeoff here is that we get rid of a test for DST in the
common case where the operator is not DST, in return for an extra walk
over the clip rectangles in the uncommon case where the operator
actually is DST.
---
 pixman/pixman-noop.c |   19 +++++++++++++++++++
 pixman/pixman.c      |    2 --
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
index 50bbfb0..673a02a 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -30,8 +30,27 @@
 #include "pixman-combine32.h"
 #include "pixman-fast-path.h"
 
+static void
+noop_composite (pixman_implementation_t *imp,
+		pixman_op_t              op,
+		pixman_image_t *         src,
+		pixman_image_t *         mask,
+		pixman_image_t *         dest,
+		int32_t                  src_x,
+		int32_t                  src_y,
+		int32_t                  mask_x,
+		int32_t                  mask_y,
+		int32_t                  dest_x,
+		int32_t                  dest_y,
+		int32_t                  width,
+		int32_t                  height)
+{
+    return;
+}
+
 static const pixman_fast_path_t noop_fast_paths[] =
 {
+    { PIXMAN_OP_DST, PIXMAN_any, 0, PIXMAN_any, 0, PIXMAN_any, 0, noop_composite },
     { PIXMAN_OP_NONE },
 };
 
diff --git a/pixman/pixman.c b/pixman/pixman.c
index f21af2f..61d3a92 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -761,8 +761,6 @@ pixman_image_composite32 (pixman_op_t      op,
      * mathematically equivalent to the source.
      */
     op = optimize_operator (op, src_flags, mask_flags, dest_flags);
-    if (op == PIXMAN_OP_DST)
-	goto out;
 
     if (lookup_composite_function (op,
 				   src_format, src_flags,
-- 
1.7.4



More information about the Pixman mailing list