[cairo] [patch] gl: fix gradient color texture generation

Søren Sandmann sandmann at cs.au.dk
Thu Jul 26 11:59:39 PDT 2012


Chris Wilson <chris at chris-wilson.co.uk> writes:

>> -    p1.x = _cairo_fixed_16_16_from_double (0.5);
>> +    /* due to a "bug" in pixman, we should not use exact center of pixel
>> +     * as the p1.x and p2.x.  This is beause pixman generates gradient
>> +     * color by interpolate two adjacent stops.  And the step of 
>> +     * interpolation is computed from p2.x - p1.x.  If we have set
>> +     * at the center of pixel, it results pixman picking stop colors from
>> +     * out-of-bound stops array.  see _gradient_walker_reset () in
>> +     * pixman-gradient-walker.c
>> +     */
>> +    p1.x = _cairo_fixed_16_16_from_double (0.6);
> How about pixman_fixed_1 - pixman_fixed_1_2 + pixman_fixed_epsilon
> which should be (1 << 16) - (1 << 8) + 1?

There is probably no bug[1] in pixman in this case and this workaround
is therefore probably bogus. But apart from that:

    If there are bugs in pixman, then *fix them there* or at the very
    least *report* them. Do not just work around them in cairo.

Soren

[1] See _pixman_init_gradient() in pixman-image.c


More information about the cairo mailing list