[cairo] [PATCH] Revert "image: Use convolution filters for sample reconstruction when downscaling"
spitzak at gmail.com
Fri May 16 15:49:21 PDT 2014
On 05/13/2014 01:15 AM, Uli Schlachter wrote:
> This reverts commit fb57ea13e04d82866cbc8e86c83261148bb3e231.
> When running cairo-test-suite with the parameter "-a", it also runs each test
> with a non-zero device-offset and device-scaling. The above commit influenced
> the device-scaling results badly. E.g. some test results ended up with a black
> border at the top-most and left-most row that looked like there was an offset of
> "0.5" in drawing the image and thus pixels outside of the image were sampled.
There should be a workaround for this! Reverting proper scaling is not
Obviously there are bugs in pixman. It sounds like it is transforming
the corner of the input filter to the corner of the output filter,
rather than the centers. This can be fixed by modifying the transform to
The other thing is that there should be exactly one filter in each
direction. As far as I can tell that means that one of "reconstruct" and
"sampling" must be IMPULSE. I am still completely mystified as to what
pixman is thinking here and have not been able to figure out which is
which. The attached code certainly can allow both filters to be
non-impulse which is a bug.
> - * TODO: this approach may not be completely correct if the matrix
> - * contains a skew component. */
> - scale_x = hypot (pattern->matrix.xx, pattern->matrix.yx);
> - scale_y = hypot (pattern->matrix.yx, pattern->matrix.yy);
This is in fact the best value you can get for a skew matrix (or for a
rotation). Anything better requires sampling where the two filter axis
are not parallel to the source image axis.
More information about the cairo