[cairo] set_source_rgb vs set_source_rgba [Performance]

Ian Britten britten at caris.com
Fri Aug 15 12:10:56 PDT 2008


Behdad Esfahbod wrote:

>>>> I would hope that this makes absolutely no difference if the alpha is
>>>> 1.0. If it does then it is definately Cairo's fault IMHO.
>>> I agree.  I have a vague memoy that we did that at some point, but the code
>>> doesn't show that.  Chris may know?
 >>
>> I did add a check at the entry point to convert a call to set_rgba into
>> set_rgb if opaque. Behdad chose to move the check down to the
>> _cairo_pattern_init_solid() so that it covered all paths, as part of his
>> work into supporting dithering.
> 
> Right.  I see it now.  So yeah, there's absolutely no perf hit in using rgba
> with alpha 1.0

Many thanks for confirming this!  It lets me keep my code simpler! :)
Ian


More information about the cairo mailing list