NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: xsrc/59952: xsetwallpaper: server/client endian mismatch
The following reply was made to PR xsrc/59952; it has been noted by GNATS.
From: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: xsrc/59952: xsetwallpaper: server/client endian mismatch
Date: Wed, 4 Feb 2026 06:57:11 -0000 (UTC)
gnats-admin%NetBSD.org@localhost ("Adrian Chadd via gnats") writes:
> Well, my next diff is handling servers that aren't ARGB. :-P
>
> I'm tempted to lean in here and not bswap at all but let x11 do it. I
> believe that's what the API is meant to encourage.
XCreateImage() gets you an XImage suited for the display and visual.
You then create the pixel data in the appropriate format and
XPutImage() transfers it to the server.
XInitImage() lets you create an XImage yourself for the format you
specify. If the characteristics of the image (for example, byte_order
and bitmap_unit) differ from what the server requires, XPutImage()
makes the necessary conversions.
XImage contains pointers to pixel manipulation functions (that
XInitImage will initialize). So you should not modify the XImage
structure yourself after it is initialized or created by some
Xlib function.
The pixel depth is nothing that could be converted automatically,
operations with different depths always fail with a BadMatch.
You can render a XYBitmap to a deeper display because the XYBitmap
is seen as pixels in background (0-bits) and foreground (1-bits)
color. So there is no depth conversion taking place between pixel
values.
Saying that, automatic conversions was never popular. Any conversion
is slow, especially when done with single pixel operations. The code
I've seen that relied on this was usually handling small pre-rendered
images in a user interface (like button imagery). Everything else would
convert the data once when loading or generating an image and not
every time when it gets rendered for refreshing a window. Something
like xsetwallpaper probably doesn't care, as rendering is done only once.
Home |
Main Index |
Thread Index |
Old Index