# [Pixman] [PATCH 10/14] pixman-filter: integral splitting is only needed for triangle filter

Oded Gabbay oded.gabbay at gmail.com
Fri Apr 29 11:49:36 UTC 2016

```On Tue, Apr 12, 2016 at 5:36 AM, Søren Sandmann Pedersen
<soren.sandmann at gmail.com> wrote:
> From: Bill Spitzak <spitzak at gmail.com>
>
> Only the triangle is discontinuous at 0. The other filters resemble a
> cubic closely enough that Simpsons integration works without
> splitting.
>
> Changes by Søren: Rebase without the changes to the integral function,
> update comment to match the new code.
>
> Signed-off-by: Bill Spitzak <spitzak at gmail.com>
> Signed-off-by: Søren Sandmann <soren.sandmann at gmail.com>
> Reviewed-by: Søren Sandmann <soren.sandmann at gmail.com>
> ---
>  pixman/pixman-filter.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
> index 8d4872a..c868723 100644
> --- a/pixman/pixman-filter.c
> +++ b/pixman/pixman-filter.c
> @@ -160,18 +160,17 @@ integral (pixman_kernel_t kernel1, double x1,
>           pixman_kernel_t kernel2, double scale, double x2,
>           double width)
>  {
> -    /* 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
> -     * integrate properly.
> +    /* The LINEAR filter is not differentiable at 0, so if the
> +     * integration interval crosses zero, break it into two
> +     * separate integrals.
>       */
> -    if (x1 < 0 && x1 + width > 0)
> +    if (kernel1 == PIXMAN_KERNEL_LINEAR && x1 < 0 && x1 + width > 0)
>      {
>         return
>             integral (kernel1, x1, kernel2, scale, x2, - x1) +
>             integral (kernel1, 0, kernel2, scale, x2 - x1, width + x1);
>      }
> -    else if (x2 < 0 && x2 + width > 0)
> +    else if (kernel2 == PIXMAN_KERNEL_LINEAR && x2 < 0 && x2 + width > 0)
>      {
>         return
>             integral (kernel1, x1, kernel2, scale, x2, - x2) +
> --
> 1.7.11.7
>
> _______________________________________________
> Pixman mailing list
> Pixman at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pixman

This patch is:
Acked-by: Oded Gabbay <oded.gabbay at gmail.com>
```