From 18e8f754cc26a92d437264bf2f47a70aa270b5bb Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Sun, 6 Mar 2016 17:06:52 -0800 Subject: pixman-filter: Nested polynomial for cubic v11: Restored range checks Signed-off-by: Bill Spitzak Reviewed-by: Oded Gabbay --- 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 ab62e0af..eeee4b76 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 { -- cgit v1.2.3