[cairo] [PATCH] gl/msaa: Add a fast path for fills that are simple quads

Chris Wilson chris at chris-wilson.co.uk
Fri Jan 25 04:21:50 PST 2013

On Wed, Jan 23, 2013 at 02:06:35PM -0800, Martin Robinson wrote:
> +    /* If either division would produce a number between 0 and 1, i.e.
> +     * the numerator is smaller than the denominator and their signs are
> +     * the same, then the lines intersect. */
> +    if (_cairo_int64_lt (numerator_a, denominator) &&
> +	_cairo_int64_gt (_cairo_int64_mul (numerator_a, denominator), 0)) {

Hmm, whilst not strictly the same, I think it is correct though to use
  && _cairo_int64_negative(_cairo_int64_mul(numerate_a, denominator))

Better yet as this avoids the multiply and should allow us to avoid
those costly 64-bits on some platforms:
  && (_cairo_int64_negative(numerator_a) ^ _cairo_int64_negative(denominator))

Chris Wilson, Intel Open Source Technology Centre

More information about the cairo mailing list