Re: Problem in gdk_imglib -- more information

Some more information on this problem...

> 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.

I've tried this and it almost works.  The bits end up being inverted so
that it masks out what it should keep and keeps what it should mask out.
I verified that this against a different X server and it got the same

> 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.

Upon further testing, this works for some things but not others.
gnome-help-browser, for example still crashes in XFreeImage.

Also, when I did get this to work, I had to invert the bits just like when
I changed imlib to pass an XYBitmap instead of a ZPixmap.

> 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]