[cairo] Replicating top bits in conversion from 565 to 8888

Soeren Sandmann sandmann at daimi.au.dk
Sun Sep 14 12:41:06 PDT 2008


Hi André,

Another issue I noticed: When converting from 565 to 8888, currently
we are just appending zeros. This is problematic in a number of cases;
for example a pure white gets converted to a shade of gray. The
standard way to do these kinds of conversions is to replicate the top
bits, ie., to do

        12345 -> 12345123

rather than

        12345 -> 12345000

The attached patch implements that. If it looks ok to you, I'll push
it for the 0.12.0 release.

I also noticed that it doesn't use the multiplication trick that is
used in the MMX code. Would it be worthwhile doing that? I originally
copied the trick from code that Owen wrote, but I never checked that
it is actually faster than just shifting.


Thanks,
Soren


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001--sse2-Fix-rounding-bug-in-conversion-from-565-to-88.patch
Type: text/x-patch
Size: 0 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080914/0838c8b1/attachment.bin 


More information about the cairo mailing list