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

[email protected] (Søren Sandmann)
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Chris Wilson <[email protected]> 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
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.