# [Pixman] [PATCH v11 09/14] pixman-filter: Nested polynomial for cubic

Oded Gabbay oded.gabbay at gmail.com
Sun Feb 7 13:57:26 CET 2016

```On Fri, Feb 5, 2016 at 9:49 AM,  <spitzak at gmail.com> wrote:
> From: Bill Spitzak <spitzak at gmail.com>
>
> v11: Restored range checks
>
> Signed-off-by: Bill Spitzak <spitzak at gmail.com>
> ---
>  pixman/pixman-filter.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
> index e82871f..e5ef8e6 100644
> --- a/pixman/pixman-filter.c
> +++ b/pixman/pixman-filter.c
> @@ -109,14 +109,16 @@ general_cubic (double x, double B, double C)
>
>      if (ax < 1)
>      {
> -       return ((12 - 9 * B - 6 * C) * ax * ax * ax +
> -               (-18 + 12 * B + 6 * C) * ax * ax + (6 - 2 * B)) / 6;
> +       return (((12 - 9 * B - 6 * C) * ax +
> +                (-18 + 12 * B + 6 * C)) * ax * ax +
> +               (6 - 2 * B)) / 6;
>      }
> -    else if (ax >= 1 && ax < 2)
> +    else if (ax < 2)
>      {
> -       return ((-B - 6 * C) * ax * ax * ax +
> -               (6 * B + 30 * C) * ax * ax + (-12 * B - 48 * C) *
> -               ax + (8 * B + 24 * C)) / 6;
> +       return ((((-B - 6 * C) * ax +
> +                 (6 * B + 30 * C)) * ax +
> +                (-12 * B - 48 * C)) * ax +
> +               (8 * B + 24 * C)) / 6;
>      }
>      else
>      {
> --
> 1.9.1
>
> _______________________________________________
> Pixman mailing list
> Pixman at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pixman

I'm sorry, I was probably not clear enough in my response for the v10
patch. In my response then, I also referred to the fact you removed
the special case of handling ax >= 2. I meant that I also didn't see
the benefit of removing that check.

Oded
```