[PATCH pixman 04/11] pixman-filter: Speed up the BOX+BOX filter

Bill Spitzak <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <1411439413-40964-5-git-send-email-spitzak__24841.0006789074$1411439433$gmane$org@gmail.com>
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 a9af72c..4ff02ec 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

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.