Alexandre Julliard : winex11: Use the create_pixmap_from_image helper to export XA_PIXMAP clipboard formats .

Alexandre Julliard julliard at winehq.org
Tue May 15 12:55:59 CDT 2012


Module: wine
Branch: master
Commit: e85895e4c5eb46d1579adbf5e175d8b6f186f9bd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e85895e4c5eb46d1579adbf5e175d8b6f186f9bd

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri May 11 15:27:04 2012 +0200

winex11: Use the create_pixmap_from_image helper to export XA_PIXMAP clipboard formats.

---

 dlls/winex11.drv/clipboard.c |   40 ++++++++++++++++------------------------
 1 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c
index ac17bdd..8dc3f0e 100644
--- a/dlls/winex11.drv/clipboard.c
+++ b/dlls/winex11.drv/clipboard.c
@@ -1758,7 +1758,6 @@ static HANDLE X11DRV_CLIPBOARD_ExportString(Display *display, Window requestor,
 static HANDLE X11DRV_CLIPBOARD_ExportXAPIXMAP(Display *display, Window requestor, Atom aTarget, Atom rprop,
     LPWINE_CLIPDATA lpdata, LPDWORD lpBytes)
 {
-    HDC hdc, memdc;
     HANDLE hData;
     unsigned char* lpData;
 
@@ -1770,33 +1769,26 @@ static HANDLE X11DRV_CLIPBOARD_ExportXAPIXMAP(Display *display, Window requestor
 
     if (!lpdata->drvData) /* If not already rendered */
     {
-        /* Create a DDB from the DIB */
-
-        Pixmap pixmap = 0;
-        X_PHYSBITMAP *physBitmap;
-        HBITMAP hBmp;
+        Pixmap pixmap;
+        XVisualInfo vis;
         LPBITMAPINFO pbmi;
+        struct gdi_image_bits bits;
+
+        memset( &vis, 0, sizeof(vis) );
+        vis.visual     = visual;
+        vis.depth      = screen_depth;
+        vis.visualid   = visual->visualid;
+        vis.class      = visual->class;
+        vis.red_mask   = visual->red_mask;
+        vis.green_mask = visual->green_mask;
+        vis.blue_mask  = visual->blue_mask;
 
-        hdc = GetDC(0);
         pbmi = GlobalLock( lpdata->hData );
-        hBmp = CreateDIBitmap( hdc, &pbmi->bmiHeader, CBM_INIT,
-                               (LPBYTE)pbmi + bitmap_info_size( pbmi, DIB_RGB_COLORS ),
-                               pbmi, DIB_RGB_COLORS );
+        bits.ptr = (LPBYTE)pbmi + bitmap_info_size( pbmi, DIB_RGB_COLORS );
+        bits.free = NULL;
+        bits.is_copy = FALSE;
+        pixmap = create_pixmap_from_image( 0, &vis, pbmi, &bits, DIB_RGB_COLORS );
         GlobalUnlock( lpdata->hData );
-
-        /* make sure it's owned by x11drv */
-        memdc = CreateCompatibleDC( hdc );
-        SelectObject( memdc, hBmp );
-        DeleteDC( memdc );
-
-        /* clear the physBitmap so that we can steal its pixmap */
-        if ((physBitmap = X11DRV_get_phys_bitmap( hBmp )))
-        {
-            pixmap = physBitmap->pixmap;
-            physBitmap->pixmap = 0;
-        }
-        DeleteObject( hBmp );
-        ReleaseDC( 0, hdc );
         lpdata->drvData = pixmap;
     }
 




More information about the wine-cvs mailing list