[Pixman] [PATCH v14 14/22] pixman-filter: Do BOX.BOX much faster

spitzak at gmail.com spitzak at gmail.com
Mon Mar 7 01:06:49 UTC 2016


From: Bill Spitzak <spitzak at gmail.com>

The desired result from the integration is directly available, as the range has been
clipped to the intersection of the two boxes. As this filter is probably the most
common one, this optimization looks very useful.

Signed-off-by: Bill Spitzak <spitzak at gmail.com>
---
 pixman/pixman-filter.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index 6d589c2..8dfb49b 100644
--- a/pixman/pixman-filter.c
+++ b/pixman/pixman-filter.c
@@ -171,6 +171,11 @@ integral (pixman_kernel_t kernel1,
     {
 	return filters[kernel2].func (-pos * scale) * scale;
     }
+    else if (kernel1 == PIXMAN_KERNEL_BOX && kernel2 == PIXMAN_KERNEL_BOX)
+    {
+	assert (high <= low + 1.0);
+	return (high - low) * scale;
+    }
     /* If the integration interval crosses zero, break it into
      * two separate integrals. This ensures that filters such
      * as LINEAR that are not differentiable at 0 will still
-- 
1.9.1



More information about the Pixman mailing list