On Wed, Jun 14, 2000 at 02:24:34PM +0200, Ove Kaaven wrote:
> In dlls/ddraw/ddraw/x11.c, the create_ximage function, we have
> 
>     int bpp = PFGET_BPP(This->d.directdraw_pixelformat);
> 
> and this value is subsequently multiplied with the width and height values
> in order to create an XImage. But this XImage is the destination of any
> depth-conversion, so if there's depth-conversion, the bpp should be the
> display's bpp, not the DirectDrawSurface's bpp... so I get crashes when I
> run depth-conversion in plain Xlib mode (without XShm).

Exact....

> Unfortunately, I haven't convinced myself that I really know enough about
> X to know the very best way to acquire the *real* display bpp value from
> that routine... so if someone else could look at it?

Well, it's easy... The real screen pixel format is stored in
This->d.screen_pixelformat.

So, creating a new variable :

   int screen_bpp = PFGET_BPP(This->d.screen_pixelformat);

and use this one for the XCreateImage call should fix the problem....

BTW, by reading the man page for XCreateImage, I found this :

 'Note that when the image is created using XCreateImage, XGetImage,
  or XSubImage, the destroy procedure that the XDestroyImage function
  calls frees both the image structure and the data pointed to by the
  image structure.'

I understand this as saying that calling XDestroyImage on an image
created with XCreateImage (our case here) will free itself the image
pointer... That would lead to a crash in our case at it would free a
HeapAlloc allocated memory block, no ?

I will try to look at X's code to see if this is really the case.

-- 
               Lionel Ulmer   -   [EMAIL PROTECTED]
    My Advogato Wine diary : http://www.advogato.org/person/bbrox/

Reply via email to