Re: [PATCH v3 0/3] test: Add test for image downscaling

Uli Schlachter <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Hi (and sorry for being annoying),

On 10.09.2013 19:06, Bryce W. Harrington wrote:
> These are tests for the recently integrated downscaling support.  This
> patchset includes some simple tests for three scaling factors, for each
> of the filter options.

I am not sure how this happened, but you sent out the wrong patches. The ones
you sent are already in master...

> This patchset is also posted to the 'downscaling' branch in my fdo git
> repo:
> 
>   http://cgit.freedesktop.org/~bryce/cairo/
[...]

...thus I switched to pulling from this branch.

Then I took another look at this and sadly I found another thing to complain
about. Right now, the results of these new tests look like this (the sed just
avoids line-wrapping in this mail):

$ md5sum output/pixman-downscale-*95.image.* | sort | sed -e 's/........... / /'
486189495f2ed62f80ea2  output/pixman-downscale-best-95.image.argb32.out.png
486189495f2ed62f80ea2  output/pixman-downscale-bilinear-95.image.argb32.out.png
486189495f2ed62f80ea2  output/pixman-downscale-fast-95.image.argb32.out.png
486189495f2ed62f80ea2  output/pixman-downscale-good-95.image.argb32.out.png
486189495f2ed62f80ea2  output/pixman-downscale-nearest-95.image.argb32.out.png
9521522a7bcda06976efc  output/pixman-downscale-best-95.image.rgb24.out.png
9521522a7bcda06976efc  output/pixman-downscale-bilinear-95.image.rgb24.out.png
9521522a7bcda06976efc  output/pixman-downscale-fast-95.image.rgb24.out.png
9521522a7bcda06976efc  output/pixman-downscale-good-95.image.rgb24.out.png
9521522a7bcda06976efc  output/pixman-downscale-nearest-95.image.rgb24.out.png

That's not a lot of different results.

Looking at the code, I noticed this:

(test/pixman-downscale.c, line 56ff)
>     cairo_save (cr);
>     cairo_pattern_set_filter (cairo_get_source (cr), filter);
>     cairo_scale (cr, scale, scale);
>     cairo_set_source_surface (cr, image, 0, 0);
>     cairo_paint (cr);
>     cairo_restore (cr);

You first set the filter on the source and then call cairo_set_source_surface(),
installing a new source. If I move the call to cairo_pattern_set_filter() after
the cairo_set_source_surface() call, the resulting PNGs for "fast" and "nearest"
change a bit:

$ md5sum output/pixman-downscale-*95.image.* | sort | sed -e 's/........... / /'
486189495f2ed62f80ea2  output/pixman-downscale-best-95.image.argb32.out.png
486189495f2ed62f80ea2  output/pixman-downscale-bilinear-95.image.argb32.out.png
486189495f2ed62f80ea2  output/pixman-downscale-good-95.image.argb32.out.png
9521522a7bcda06976efc  output/pixman-downscale-best-95.image.rgb24.out.png
9521522a7bcda06976efc  output/pixman-downscale-bilinear-95.image.rgb24.out.png
9521522a7bcda06976efc  output/pixman-downscale-good-95.image.rgb24.out.png
d5f0ec52d41f03523c0b1  output/pixman-downscale-fast-95.image.argb32.out.png
d5f0ec52d41f03523c0b1  output/pixman-downscale-fast-95.image.rgb24.out.png
d5f0ec52d41f03523c0b1  output/pixman-downscale-nearest-95.image.argb32.out.png
d5f0ec52d41f03523c0b1  output/pixman-downscale-nearest-95.image.rgb24.out.png

Could you fix the test? Thanks!
(And feel free to ping me (psychon) on IRC when you have a new branch up, I
think the mailing list won't care much and I am stuck with having to merge this
anyway)

Cheers,
Uli

P.S.: Sadly it doesn't look like this fixes any test failures.
-- 
A normal person is just someone you don't know well enough yet.
 - Nettie Wiebe
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.