[cairo] Fix inversion of radial gradients when r2 > r1

Chris Wilson chris at chris-wilson.co.uk
Fri Jul 24 01:42:28 PDT 2009


On Fri, 2009-07-24 at 09:03 +0200, Soeren Sandmann wrote:
> Hi Chris,
> 
> Thanks for fixing bug 22908, and also thanks for applying Andre's
> optimization. I think both are very much worthwhile. There are a few
> problems with the commit, however:
> 
> * The optimization and the bug fix are conceptually separate things,
>   so they should be in separate commits. As it is you can't tell from
>   the commit which changes were optimization and which were bug fixes;
>   in fact, it is impossible to tell what the bug actually was.

Sorry, I was moving the fluff out of the way until I could see the
issue.

> * Andre's original patch had a detailed comment explaining why it was
>   possible to pull out the loop-invariant expressions. I'd like to at
>   least preserve some of that justification.

The detailed comment just described the code movement, and did not make
a good explanation. I've added a comment now to explain the
transformation, hopefully it meets your approval.
 
> * Is there any reason not to apply the optimization in the projective
>   case? 

I have no test cases to exercise the projective path. The potential is
limited by (pdx, pdy) no longer being linear across the scanline, but
the same constants can be moved out of the inner loop nevertheless. The
impact of the change on run-time for a trace like talos-svg is marginal
(~2% on a eeepc 700). However, as computing the scanline for the radial
gradients take over 40% of the runtime for talos-svg on that machine,
there is a large potential for improvement - in particular the affine
path looks particularly apt for vectorisation.
-ickle



More information about the cairo mailing list