[cairo] 24bit and/or MSB first Xservers
Owen Taylor
otaylor at redhat.com
Wed May 11 05:29:44 PDT 2005
On Tue, 2005-05-10 at 15:04 -0600, Peter Dennis Bartok wrote:
> Hi all,
>
> Has anyone successfully used Cairo on anything other than a Xfree/Xorg X
> server?
>
> Two cases where we are seeing problems are Sun's X server and Hummingbirds'
> Exceed Win32 X server. On both or applications usually die with a BadMatch
> (in XPutImage or XGetImage). Also, on Servers that have MSB first, cairo
> treats it as if they are LSB first, thereby swapping red and blue.
>
> My understanding of the inner workings of cairo and libpixman sadly is quite
> limited, so I wouldn't know where to start trying to fix this.
No libpixman or Cairo knowledge needed. It's all really shallow inside
cairo-xlib-surface.c.
For the endianess problems, the code simply needs to byte-swap the
image after calling XGetImage / before calling XPutImage if you
detect cross-endian. (Image byte order not equal to local byte
order.)
(In some cases, there are tricks you can play with calling a
big endian RGB x888 visual a little endian BGR 888x visual.
libpixman can draw to a BGR 888x visual but it's going to be
slow. Certainly simpler to just byte-swap than to worry about
accelerating that.)
It looks to me like the code should work fine on MSB as long
as the client/server endianess matches.
To track down the BadMatch, put a call to
XSynchronize (display, True) into the program that is producing
the BadMatch, and then get a backtrace. If we know what request
is causing it, it should be pretty simple to track down what is
going on.
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/20050511/15dbb710/attachment.pgp
More information about the cairo
mailing list