[Pixman] [PATCH 13/15] pixman-filter: refactor cubic polynominal and don't range check

spitzak at gmail.com spitzak at gmail.com
Sat Dec 12 10:06:42 PST 2015


From: Bill Spitzak <spitzak at gmail.com>

The other filters do not check for x being in range, so there is
no reason for cubic to do so.
---
 pixman/pixman-filter.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index 7e10108..bf9dce3 100644
--- a/pixman/pixman-filter.c
+++ b/pixman/pixman-filter.c
@@ -109,18 +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;
-    }
-    else if (ax >= 1 && 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 (((12 - 9 * B - 6 * C) * ax +
+		 (-18 + 12 * B + 6 * C)) * ax * ax +
+		(6 - 2 * B)) / 6;
     }
     else
     {
-	return 0;
+	return ((((-B - 6 * C) * ax +
+		 (6 * B + 30 * C)) * ax +
+		(-12 * B - 48 * C)) * ax +
+		(8 * B + 24 * C)) / 6;
     }
 }
 
-- 
1.9.1



More information about the Pixman mailing list