[Pixman] 0.18.0 schedule
Siarhei Siamashka
siarhei.siamashka at gmail.com
Sat Mar 6 03:05:43 PST 2010
On Tuesday 02 March 2010, Soeren Sandmann wrote:
[...]
> There is a couple of things I'd _like_ to get in, but making it happen
> will require other people to help out:
>
> * Siarhei's fixes for gradient data types. As far as I can tell,
> moving to 16.16 won't be any _worse_ than what we have now, and it
> will be a speedup on ARM.
It will be worse in some cases because the calculated floating point
value 't' actually may not fit into the destination 16.16 fixed point type.
Floating floating point exceptions may be enabled by library user or they may
be even enabled by default on some platforms. Even the current 48.16
data type may be insufficient as demonstrated by the attached
example (a modified 'gradient-test.c' from pixman test).
$ ./gradient-test
Floating point exception
It is artificial hand crafted case, but it demonstrates that the calculated
value of 't' may be so large that its integer part does not fit even in 48
bits.
This can be solved (at least for the normal SVG radial gradients where the
focal point is inside outer circle) by for example taking the distance of the
furthest corner of the area being composited from the outer circle center, and
dividing it by the distance from the focal point to the outer perimeter. If
the calculated value is less than 32K, then 16.16 fixed point can be used
safely. Otherwise 't' may need to be clipped as floating point value before
converting to integer.
Probably normal people will never use radial gradients with the extreme corner
case parameters, the image just does not look right anyway, so it can't be
distorted any worse by additional checks.
By the way, technically gradients are performing point sampling. And it may
produce bad image quality and rough edges on the transition between stops.
--
Best regards,
Siarhei Siamashka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gradient-test.c
Type: text/x-csrc
Size: 1772 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/pixman/attachments/20100306/7adcc32b/attachment.c>
More information about the Pixman
mailing list