Problem in gdk_imglib



I finally found what was causing the Bad Length errors when trying to run 
Gnome apps on MI/X 3.0.  In render.c in imglib, there's a place where it
creates a bitmap mask to mask out the transparent portions of an image.
When it creates the image, it makes it a 1 bit/pixel ZPixmap.  All the
documentation I can find indicates that a ZPixmap is supposed to be
the depth of the drawable, which in this case is 32.  When you pass
this image to XPutImage, xlib decides to promote it to a 4 bit/pixel
pixmap, but tells the server that it's 1-bit/pixel.  The server then gets
what it is told is a 1-bit/pixel ZPixmap but too much data and complains.

I compared the code that receives and processes this request to
the version in the XFree86 server (dix/dispatch.c, ProcPutImage()) and
it does the same thing, so I don't see how it works on that server and
not mine.

I've come up with two solutions.  First is that a 1 bit/pixel thing should
probably be an XYBitmap, not a ZPixmap.  This is probably the "correct"
solution.

The other solution, which smells like an ugly hack but works, is that I
modified ProcPutImage() in my server to detect that if the data sent is
too bit for the request, and the request is for a 1-bpp ZPixmap, assume
it's really a 4-bpp ZPixmap and process it accordingly.  This works as
long as the size of the data sent is larger than the 1-bpp version would
be when padded out to 4 bytes/scanline.  

Examples of where this type of image mask is used are:
The arrows at the ends of the "panel" bar.
The icons on the buttons in gnome-hint (which is what I used to debug it)
The flower on the left side of the menu bar at the top.


 -- Dave Williss
------
Meddle not in the affairs of dragons, 
   for you are crunchy and taste good with catsup






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]