Samstag, 13. November 2010

XShmGetImage

I really wonder what was the idea (or who had it) behind ommiting the width/height parameters from XShmGetImage:
Status XShmGetImage(Display* dpy ,Drawable d, XImage* image, int x, int y, unsigned long plane_mask)
Those two parameters where in XGetImage, even although an XImage is really cheap to construct client-side.
If you have to read back a certain area using XShmGetImage, either you create a fresh ShmImage (quite expensive) or you read back a too large area (also expensive, and sometimes not even possible).

I've been revently working a bit in OpenJDK's surface readback mechanism and this descision causes great pain there. Omiting those two parameters makes ShmGetImage only half as useful and efficient as it could be.