[cairo] [PATCH] [FIXED] Minor fixes in the new downscaling code.

Bryce W. Harrington b.harrington at samsung.com
Mon Mar 17 14:17:51 PDT 2014


Hi Krzysztof,

Thanks for looking into these issues and providing a patch.  I'm running
it through 'make check' now.  The changes look sensible, although I was
not able to apply the patch to git due to formatting/line wrapping, and
after that it didn't compile due to a couple typos.  I've attached the
fixed up patches.

I'd recommend using git format-patch / git send-email to generate
patches when using git.

  git format-patch -s HEAD~1

  git send-email --to cairo at cairographics.org --thread --no-chain-reply-to 00*.patch

Anyway, review comments below...

Bryce


On Wed, Feb 05, 2014 at 01:35:41AM +0100, Krzysztof Kosiński wrote:
> This adresses issues brought up on the mailing list. If we use

addresses

> 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.

Split this bit out into a second patch.
 
> 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;

Looks like lines got wrapped several places.

> -        sampling_kernel_y = shrink_y ? pixman_kernel_sample :
> PIXMAN_KERNEL_IMPULSE;
> +        if (shrink_x) {
> +        samping_kernel_x = pixman_kernel_sample;

sampling_kernel_x

Also the tabbing seems off from here on down.

> +        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;

samplling_kernel_y

> +        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);

I've reworked your patches with the above corrections.  I've attached them
here if you want to re-submit them (just replace my header with yours).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-For-PIXMAN_FILTER_BEST-Don-t-fall-through-to-the-def.patch
Type: text/x-diff
Size: 1131 bytes
Desc: 0001-For-PIXMAN_FILTER_BEST-Don-t-fall-through-to-the-def.patch
URL: <http://lists.cairographics.org/archives/cairo/attachments/20140317/7b1e0128/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Optimize-downscaling-for-kernel-box-and-impulse-down.patch
Type: text/x-diff
Size: 2358 bytes
Desc: 0002-Optimize-downscaling-for-kernel-box-and-impulse-down.patch
URL: <http://lists.cairographics.org/archives/cairo/attachments/20140317/7b1e0128/attachment-0001.patch>


More information about the cairo mailing list