PATCH: x11 SelectBitmap / CreateBitmap

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

 



Hi,

Lotus Notes does the following to support a Print Preview:

- Creates a printer DC.
- Creates a compatible bitmap within that DC.
- Selects this bitmap into a display DC.
- Tries to render text into it.

This crashes in xrendering, since no physBitmap has been assigned to the
bitmap, so drawable is 0 leading to a crash in XFillRectangle.

This code works around the problem, but it is mostly a hack I guess.

(Should we be able to select a compatible bitmap from a different DC into
 another one?)

Ciao, Marcus

Changelog:
	If we select a non display bitmap into a display DC, create
	a respective physmap and x11 drawable.

Index: graphics/x11drv/bitmap.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/bitmap.c,v
retrieving revision 1.44
diff -u -r1.44 bitmap.c
--- graphics/x11drv/bitmap.c	14 Nov 2002 22:31:35 -0000	1.44
+++ graphics/x11drv/bitmap.c	26 Nov 2002 10:16:57 -0000
@@ -88,6 +88,26 @@
     else
         physDev->drawable = (Pixmap)bmp->physBitmap;
 
+    /* This happens if we create a compatible bitmap in a non display DC,
+     * but select it in a X11 display DC.
+     * It is probably broken by design.
+     */
+    if (!physDev->drawable) {
+	    FIXME("Creating a drawable / physical bitmap for compatible bitmap.\n");
+	    if (!(physDev->drawable = (Pixmap)bmp->physBitmap = (void *)TSXCreatePixmap(gdi_display, root_window,
+							    bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
+							    bmp->bitmap.bmBitsPixel)))
+	    {
+		FIXME("Cannot create Pixmap!\n");
+		GDI_ReleaseObj( hbitmap );
+		return 0;
+	    }
+
+	    if (bmp->bitmap.bmBits) /* Set bitmap bits */
+		X11DRV_SetBitmapBits( hbitmap, bmp->bitmap.bmBits,
+				      bmp->bitmap.bmHeight * bmp->bitmap.bmWidthBytes );
+    }
+
       /* Change GC depth if needed */
 
     if (dc->bitsPerPixel != bmp->bitmap.bmBitsPixel)
@@ -149,7 +169,7 @@
                                                     bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
                                                     bmp->bitmap.bmBitsPixel)))
     {
-        WARN("Can't create Pixmap\n");
+        FIXME("Cannot create Pixmap!\n");
 	GDI_ReleaseObj( hbitmap );
 	return FALSE;
     }


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux