Add a noop composite function for the DST operator
authorSøren Sandmann Pedersen <ssp@redhat.com>
Mon, 24 Jan 2011 16:35:27 +0000 (11:35 -0500)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Thu, 19 May 2011 13:45:59 +0000 (13:45 +0000)
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
pixman/pixman.c

index 50bbfb0..673a02a 100644 (file)
 #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 },
 };
 
index f21af2f..61d3a92 100644 (file)
@@ -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,