Single stop gradients

Andrea Canciani ranma42 at gmail.com
Sat Oct 23 03:10:50 PDT 2010


cairo-xcb is currently hitting an error when it tries to draw
gradients with a single stop.

The RENDER specification doesn't say anything about conditions
on the number of gradients stops, in particular it does not say that
gradients with no stop at all or with just one stops will cause an
error, but the server replies with a BadValue error whenever it
receives a linear/radial gradient with nStops<2.

http://cgit.freedesktop.org/xorg/proto/renderproto/plain/renderproto.txt
http://cgit.freedesktop.org/xorg/xserver/tree/render/picture.c#n940
http://cgit.freedesktop.org/xorg/xserver/tree/render/picture.c#n981

Pixman allows gradients with a single stop (and their rasterization
is just the same as if the stop was repeated twice at the same offset
with the same components).

cairo-xcb can be fixed to repeat the stop so that it will never ask
for a single stop gradient, but we're currently trying to avoid
workarounds in it, so we'd like the RENDER specification to be
updated to state that they are prohibited or the code in xserver
to actually allow them.

Cairo never asks X to render a 0 stops gradient, but having the
specification should probably define the behavior in this case
as well.

Andrea Canciani


More information about the xorg-devel mailing list