Samples are multiplied in a 1,4,2,4,2,4,1 pattern, previous version
did 1,2,4,4,4,2,1.

I also reduced the number of samples greatly as there is no
numerical difference with the filter functions.
---
 pixman/pixman-filter.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index b2bf53f..a9af72c 100644
--- a/pixman/pixman-filter.c
+++ b/pixman/pixman-filter.c
@@ -190,7 +190,7 @@ integral (pixman_kernel_t kernel1, double x1,
     else
     {
        /* Integration via Simpson's rule */
-#define N_SEGMENTS 128
+#define N_SEGMENTS 16
 #define SAMPLE(a1, a2)                                                 \
        (filters[kernel1].func ((a1)) * filters[kernel2].func ((a2) * scale))
        
@@ -204,11 +204,14 @@ integral (pixman_kernel_t kernel1, double x1,
        {
            double a1 = x1 + h * i;
            double a2 = x2 + h * i;
+           s += 4 * SAMPLE(a1, a2);
+       }
 
-           s += 2 * SAMPLE (a1, a2);
-
-           if (i >= 2 && i < N_SEGMENTS - 1)
-               s += 4 * SAMPLE (a1, a2);
+       for (i = 2; i < N_SEGMENTS; i += 2)
+       {
+           double a1 = x1 + h * i;
+           double a2 = x2 + h * i;
+           s += 2 * SAMPLE(a1, a2);
        }
 
        s += SAMPLE (x1 + width, x2 + width);
-- 
1.7.9.5

_______________________________________________
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to