[cairo] Use 8-bit colour values internally

MenTaLguY mental at rydia.net
Tue Aug 23 11:34:50 PDT 2005


On Mon, 2005-08-22 at 23:37 -0400, Jason Dorje Short wrote:

> #define COLOR_INT_TO_SHORT(c) ((c) << 8)

If you're going to do that, it may as well be:

#define COLOR_INT_TO_SHORT(c) (((c) << 8) | (c))

which is (macro side-effects aside) equivalent to the correct: 

#define COLOR_INT_TO_SHORT(c) ((c) * 65535 / 255)

Which yields the expected 65535 for COLOR_INT_TO_SHORT(255), instead of
65280.

-mental
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050823/037cf30c/attachment-0001.pgp


More information about the cairo mailing list