[cairo] Use 8-bit colour values internally
Bill Spitzak
spitzak at d2.com
Tue Aug 23 15:41:48 PDT 2005
You can also do ((c) * 0x101) which I believe is just as fast or faster
than the shift+add on modern machines.
MenTaLguY wrote:
> 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.
More information about the cairo
mailing list