summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>2016-03-06 17:06:52 -0800
committerSøren Sandmann Pedersen <soren.sandmann@gmail.com>2016-03-11 00:00:46 -0500
commit18e8f754cc26a92d437264bf2f47a70aa270b5bb (patch)
tree27e7ddb7f3befc1cc559297679b1f44e1f12b385
parent7bea37b00537d5982a7f5dcf68a9750feb377bb1 (diff)
pixman-filter: Nested polynomial for cubic
v11: Restored range checks Signed-off-by: Bill Spitzak <spitzak@gmail.com> Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
-rw-r--r--pixman/pixman-filter.c14
1 files 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
{