[Pixman] [PATCH pixman 08/11] pixman-filter: fix blank images for IMPULSE sampling filter

Bill Spitzak spitzak at gmail.com
Mon Dec 22 13:32:07 PST 2014


- Put error on center of odd-sized filters. This may fix other filters
some but the primary effect is to change the size=1 filters produced
by IMPULSE sampling from 0.0 to 1.0.

- Made IMPULSE.IMPULSE produce a filter of size 1, not zero.

- Reuse the above result to produce a faster BOX.IMPULSE which
ignores the subsampling.
---
 pixman/pixman-filter.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index 1a465ac..d763138 100644
--- a/pixman/pixman-filter.c
+++ b/pixman/pixman-filter.c
@@ -230,6 +230,8 @@ filter_width (pixman_kernel_t reconstruct,
 	      pixman_kernel_t sample,
 	      double scale)
 {
+    if (reconstruct == PIXMAN_KERNEL_BOX && sample == PIXMAN_KERNEL_IMPULSE)
+	return 0;
     return ceil(scale * filters[sample].width + filters[reconstruct].width);
 }
 
@@ -299,7 +301,7 @@ create_1d_filter (int              width,
 	}
 
 	if (new_total != pixman_fixed_1)
-	    *(p - *width / 2) += (pixman_fixed_1 - new_total);
+	    *(p - (width + 1) / 2) += (pixman_fixed_1 - new_total);
     }
 }
 
@@ -323,11 +325,13 @@ pixman_filter_create_separable_convolution (int             *n_values,
     int subsample_x, subsample_y;
     int width, height;
 
-    subsample_x = (1 << subsample_bits_x);
-    subsample_y = (1 << subsample_bits_y);
-
     width = filter_width (reconstruct_x, sample_x, sx);
+    if (width < 1) { width = 1; subsample_bits_x = 0; }
     height = filter_width (reconstruct_y, sample_y, sy);
+    if (height < 1) { height = 1; subsample_bits_y = 0; }
+
+    subsample_x = (1 << subsample_bits_x);
+    subsample_y = (1 << subsample_bits_y);
 
     *n_values = 4 + width * subsample_x + height * subsample_y;
 
-- 
1.7.9.5



More information about the Pixman mailing list