[Pixman] [PATCH pixman 05/11] pixman-filter: Consistency in arg names to integral ()

Bill Spitzak spitzak at gmail.com
Fri Sep 26 19:06:04 PDT 2014


Rename kernel1/2 to reconstruct/sample and use 1/scale as the
scale argument, thus matching the names in other functions.
---
 pixman/pixman-filter.c |   30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index 4ff02ec..035a784 100644
--- a/pixman/pixman-filter.c
+++ b/pixman/pixman-filter.c
@@ -147,8 +147,8 @@ static const filter_info_t filters[] =
     { PIXMAN_KERNEL_LANCZOS3_STRETCHED, nice_kernel,      8.0 },
 };
 
-/* This function scales @kernel2 by @scale, then
- * aligns @x1 in @kernel1 with @x2 in @kernel2 and
+/* This function scales @sample by @scale, then
+ * aligns @x1 in @reconstruct with @x2 in @sample and
  * and integrates the product of the kernels across @width.
  *
  * This function assumes that the intervals are within
@@ -156,24 +156,24 @@ static const filter_info_t filters[] =
  * try to integrate a linear kernel ouside of [-1:1]
  */
 static double
-integral (pixman_kernel_t kernel1, double x1,
-	  pixman_kernel_t kernel2, double scale, double x2,
+integral (pixman_kernel_t reconstruct, double x1,
+	  pixman_kernel_t sample, double scale, double x2,
 	  double width)
 {
-    if (kernel1 == PIXMAN_KERNEL_IMPULSE)
+    if (reconstruct == PIXMAN_KERNEL_IMPULSE)
     {
 	assert (width == 0.0);
-	return filters[kernel2].func (x2 * scale);
+	return filters[sample].func (x2 / scale);
     }
-    else if (kernel1 == PIXMAN_KERNEL_BOX && kernel2 == PIXMAN_KERNEL_BOX)
+    else if (reconstruct == PIXMAN_KERNEL_BOX && sample == PIXMAN_KERNEL_BOX)
     {
 	assert (width <= 1.0);
 	return width;
     }
-    else if (kernel2 == PIXMAN_KERNEL_IMPULSE)
+    else if (sample == PIXMAN_KERNEL_IMPULSE)
     {
 	assert (width == 0.0);
-	return filters[kernel1].func (x1);
+	return filters[reconstruct].func (x1);
     }
     /* If the integration interval crosses zero, break it into
      * two separate integrals. This ensures that filters such
@@ -183,21 +183,21 @@ integral (pixman_kernel_t kernel1, double x1,
     if (x1 < 0 && x1 + width > 0)
     {
 	return
-	    integral (kernel1, x1, kernel2, scale, x2, - x1) +
-	    integral (kernel1, 0, kernel2, scale, x2 - x1, width + x1);
+	    integral (reconstruct, x1, sample, scale, x2, - x1) +
+	    integral (reconstruct, 0, sample, scale, x2 - x1, width + x1);
     }
     else if (x2 < 0 && x2 + width > 0)
     {
 	return
-	    integral (kernel1, x1, kernel2, scale, x2, - x2) +
-	    integral (kernel1, x1 - x2, kernel2, scale, 0, width + x2);
+	    integral (reconstruct, x1, sample, scale, x2, - x2) +
+	    integral (reconstruct, x1 - x2, sample, scale, 0, width + x2);
     }
     else
     {
 	/* Integration via Simpson's rule */
 #define N_SEGMENTS 16
 #define SAMPLE(a1, a2)							\
-	(filters[kernel1].func ((a1)) * filters[kernel2].func ((a2) * scale))
+	(filters[reconstruct].func ((a1)) * filters[sample].func ((a2) / scale))
 	
 	double s = 0.0;
 	double h = width / (double)N_SEGMENTS;
@@ -278,7 +278,7 @@ create_1d_filter (int             *width,
 		ihigh = MIN (shigh, rhigh);
 
 		c = integral (reconstruct, ilow,
-			      sample, 1.0 / scale, ilow - pos,
+			      sample, scale, ilow - pos,
 			      ihigh - ilow);
 	    }
 
-- 
1.7.9.5



More information about the Pixman mailing list