Adrian Johnson wrote:
On 24/11/12 14:27, Søren Sandmann wrote:
-=- Adding support to cairo and further work

Once these patches have landed in Pixman, support will have to be
added to cairo to make use of them. How to do that exactly requires
figuring out what new API to offer, and how the tradeoffs between
performance and quality should be made. This is not something that I
personally plan to work on anytime soon, except to make three notes:

It would be useful to have an API for downscaling that does not require
the entire source image to be loaded into memory. I've recently updated
the downscaling box filter code in the cairo backend of poppler to read
the source image one line at a time as it is uncompressed from the pdf
file. This was to fix a bug where rendering a PDF containing a
21,590 x 161,385 1 bit/pixel image failed due to the 32,767 x 32,767
image limit.

Yes I think Cairo will have to downrez an image before applying this filtering. It could keep the downrez image around until a different downrez is needed or the source image is damaged. I now think this down rez could be restricted to powers of 2 and a box filter, allowing it to be run very quickly with a recursive version that never needs more than 2 source lines at a time.

Unless the filter is box, the downrez has to make the image no smaller than 2x the final size, to avoid hiding the nice aspects of the filters.

There is also a problem where a huge image is not scaled down, so this source image is not any smaller. But in that case it would be clipped, so a temporary source image that is clipped to only the area that projects to the output clip is needed. This clipped image can be produced by code that only looks at 1 source line at a time.

Combining them and assuming the worst possible case (a scale of 1/3.9999... and a rotation by 45 degrees) it looks like the maximum texture size would be the size of the output surface multiplied by 4*sqrt(2). That may still be a problem if the maximum texture size is equal to the maximum output size. Perhaps it could just produce a blurry picture in that case by downrezing excessively.


_______________________________________________
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to