[Pixman] [PATCH pixman 05/13] pixman-filter: Speed up the BOX+BOX filter

Bill Spitzak spitzak at gmail.com
Thu Sep 11 19:12:22 PDT 2014


This is easy as the caller already intersected the two boxes.
---
 pixman/pixman-filter.c |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index 816d085..15ea270 100644
--- a/pixman/pixman-filter.c
+++ b/pixman/pixman-filter.c
@@ -160,6 +160,21 @@ integral (pixman_kernel_t kernel1, double x1,
 	  pixman_kernel_t kernel2, double scale, double x2,
 	  double width)
 {
+    if (kernel1 == PIXMAN_KERNEL_IMPULSE)
+    {
+	assert (width == 0.0);
+	return filters[kernel2].func (x2 * scale);
+    }
+    else if (kernel1 == PIXMAN_KERNEL_BOX && kernel2 == PIXMAN_KERNEL_BOX)
+    {
+	assert (width <= 1.0);
+	return width;
+    }
+    else if (kernel2 == PIXMAN_KERNEL_IMPULSE)
+    {
+	assert (width == 0.0);
+	return filters[kernel1].func (x1);
+    }
     /* 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
@@ -177,16 +192,6 @@ integral (pixman_kernel_t kernel1, double x1,
 	    integral (kernel1, x1, kernel2, scale, x2, - x2) +
 	    integral (kernel1, x1 - x2, kernel2, scale, 0, width + x2);
     }
-    else if (kernel1 == PIXMAN_KERNEL_IMPULSE)
-    {
-	assert (width == 0.0);
-	return filters[kernel2].func (x2 * scale);
-    }
-    else if (kernel2 == PIXMAN_KERNEL_IMPULSE)
-    {
-	assert (width == 0.0);
-	return filters[kernel1].func (x1);
-    }
     else
     {
 	/* Integration via Simpson's rule */
-- 
1.7.9.5



More information about the Pixman mailing list