[cairo] [PATCH] [FIXED] Minor fixes in the new downscaling code.
Krzysztof Kosiński
tweenk.pl at gmail.com
Wed Feb 5 01:35:41 CET 2014
This adresses issues brought up on the mailing list. If we use
a non-impulse samping kernel, there is no need to use anything
more sophisticated than box reconstruction. Similarly, using
a non-box reconstruction kernel is OK with impulse sampling.
Also addressed is PIXMAN_FILTER_BEST, which previously fell through
to the default case.
This is a corrected resend of the previous patch, which contained a typo.
---
src/cairo-image-source.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/cairo-image-source.c b/src/cairo-image-source.c
index 661bc10..254d6ba 100644
--- a/src/cairo-image-source.c
+++ b/src/cairo-image-source.c
@@ -590,6 +590,7 @@ _pixman_image_set_properties (pixman_image_t *pixman_image,
pixman_filter = PIXMAN_FILTER_BEST;
pixman_kernel_sample = PIXMAN_KERNEL_LANCZOS3;
pixman_kernel_reconstruct = PIXMAN_KERNEL_LANCZOS3;
+ break;
case CAIRO_FILTER_GAUSSIAN:
/* XXX: The GAUSSIAN value has no implementation in cairo
* whatsoever, so it was really a mistake to have it in the
@@ -604,18 +605,31 @@ _pixman_image_set_properties (pixman_image_t
*pixman_image,
if (pixman_filter != PIXMAN_FILTER_NEAREST && (shrink_x || shrink_y)) {
pixman_kernel_t sampling_kernel_x, sampling_kernel_y;
+ pixman_kernel_t reconstruction_kernel_x, reconstruction_kernel_y;
int n_params;
pixman_fixed_t *params;
- sampling_kernel_x = shrink_x ? pixman_kernel_sample :
PIXMAN_KERNEL_IMPULSE;
- sampling_kernel_y = shrink_y ? pixman_kernel_sample :
PIXMAN_KERNEL_IMPULSE;
+ if (shrink_x) {
+ samping_kernel_x = pixman_kernel_sample;
+ reconstruction_kernel_x = PIXMAN_KERNEL_BOX;
+ } else {
+ sampling_kernel_x = PIXMAN_KERNEL_IMPULSE;
+ reconstruction_kernel_x = pixman_kernel_reconstruct;
+ }
+ if (shrink_y) {
+ samping_kernel_y = pixman_kernel_sample;
+ reconstruction_kernel_y = PIXMAN_KERNEL_BOX;
+ } else {
+ sampling_kernel_y = PIXMAN_KERNEL_IMPULSE;
+ reconstruction_kernel_y = pixman_kernel_reconstruct;
+ }
n_params = 0;
params = pixman_filter_create_separable_convolution (&n_params,
scale_x * 65536.0 + 0.5,
scale_y * 65536.0 + 0.5,
- pixman_kernel_reconstruct,
- pixman_kernel_reconstruct,
+ reconstruction_kernel_x,
+ reconstruction_kernel_y,
sampling_kernel_x,
sampling_kernel_y,
1, 1);
--
1.8.3.2
More information about the cairo
mailing list