[cairo] Fix for CAIRO_FORMAT_RGB24 pngs

Owen Taylor otaylor at redhat.com
Tue May 17 15:34:09 PDT 2005


On Tue, 2005-05-17 at 17:23 -0400, Owen Taylor wrote:
> Here's a simple patch that gets PNG writing to work correctly for
> surfaces without an alpha channel.
> 
> There are still some potential problems in the PNG code:
>  
>  - The handling of A8 and A1 is different on read and write.
>    If you write out an A8 surface and then read it back, I think
>    you'll get a RGB24 black-and-white 
> 
>  - The code looks very suspicious for endianess:
> 
>     png_set_bgr (png);
>     png_set_filler (png, 0xff, PNG_FILLER_AFTER)
> 
>    Looks like treating little endian xRGB as BGRx bytes.
> 
>    Have people been testing reading / writing pngs on PPC? Is
>    it working?

OK, I understand now how it is working in most cases

On read:

 File (MSB) => <internal transforms above> 
 Temporary (LSB) => <premultiply_data()>
 Final buffer (Native endian)

And on write:

 Source buffer (Native endian) => <unpremultiply_data()>
 Temporary (LSB) =>  <internal transforms> 
 File (MSB)

It just breaks when we don't go through unpremultiply data when
writing RGB24 pngs. Definitely needs some cleanup so that 
we don't do a confusing MSB => LSB => MSB dance.

Regards,
					Owen

-------------- 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/20050517/2851a543/attachment.pgp


More information about the cairo mailing list