[Pixman] [PATCH pixman 12/15] pixman-filter: Turn off subsampling when not necessary
Bill Spitzak
spitzak at gmail.com
Tue Dec 23 17:52:09 PST 2014
If sample is IMPULSE and reconstruct is BOX or IMPULSE the sub-pixel
position of the sample is not relevant, so only one subsample is needed.
---
pixman/pixman-filter.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index 64981cd..7e10108 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);
}
@@ -323,13 +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;
+ if (width < 1) { width = 1; subsample_bits_x = 0; }
height = filter_width (reconstruct_y, sample_y, sy);
- if (height < 1) height = 1;
+ 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