[Pixman] [PATCH] Improve handling of tangent circles

Andrea Canciani ranma42 at gmail.com
Wed Jan 12 13:58:55 PST 2011

On Wed, Jan 12, 2011 at 6:36 PM, Andrea Canciani <ranma42 at gmail.com> wrote:
> On Tue, Jan 4, 2011 at 11:12 AM, Andrea Canciani <ranma42 at gmail.com> wrote:
>> On Tue, Jan 4, 2011 at 10:59 AM, Siarhei Siamashka
>> <siarhei.siamashka at gmail.com> wrote:
>>> On Monday 03 January 2011 10:15:09 Andrea Canciani wrote:
>>>> When b is 0, avoid the division by zero and just return transparent
>>>> black.
>>>> When the solution t would have an invalid radius (negative or outside
>>>> [0,1] for none-extended gradients), return transparent black.
>>> Thanks for keeping improving radial gradients code.
>>> I just wonder if it would be difficult to add a test to pixman for this
>>> particular division by zero case? Or is it somehow triggered by cairo
>>> tests?
>> It is triggered by the new radial-gradient tests in cairo:
>> http://cgit.freedesktop.org/cairo/commit/?id=ada6057b8ccab133909b127850c41abb3216a842
>> The refimages have been created with a patched pixman, so the tests
>> currently fail on cairo-image, but would pass with this change.
>>> One of the problems with the pixman radial code is that it is slow.
>>> And this path further slows it down a bit by adding a new branch in the
>>> inner loop. This is perfectly fine for a reference implementation, but if
>>> somebody decides to add some performance optimizations, then we need to
>>> have
>>> at least some basic tests which can catch possible errors and
>>> regressions.
>> I plan to rewrite the radial-gradient test to make it only use pixman
>> so that it can be added to pixman testsuite.
> Attached is a patch which adds radial-test to the GTK pixman tests.
> I think we don't want it to be a checksum-based test because I believe
> we can tolerate minor differences (caused by different rounding modes
> or hardware where the float operations have slightly different error
> propagation), but the aspect should basically be independent of this.
> Please notice that the patch which started this thread changes the result
> of the test. Without it, the radial gradient can in some cases also include
> "negative radius" circles.

I pushed the "Improve handling of tangent circles" patch to master.

Soren suggested some very useful improvements to radial-test, so
here is an updated patch, which checks for division by 0 and does
not use fmin/fmax.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-a-test-for-radial-gradients.patch
Type: application/octet-stream
Size: 7007 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/pixman/attachments/20110112/8535454d/attachment.obj>

More information about the Pixman mailing list