[cairo] PATCH: Use floats instead of doubles in some spline calculations for improved performance

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 28 02:12:51 PST 2013

On Thu, Feb 28, 2013 at 06:59:32AM +0000, Mikko Strandborg wrote:
> All, 
> The attached patch improves all curve calculations: the accuracy of floating
> point is sufficient for these cases.

Hmm, I think your overflow detection is wrong as we need an extra bit
for the subtraction. However, we already implicitly rely upon this
limited range elsewhere and so make te same assumptions here. So I would
rather replace the extra code with a set of asserts that the
calculations would not overflow as documentation of our assumptions.
(And I would prefer if those were could be disabled independently of
asserts (thinking of --enable-range-debug and --enable-debug).)

I think you are right in that single precision is sufficient here, but I
will mull it over for a bit first.

Chris Wilson, Intel Open Source Technology Centre

More information about the cairo mailing list