Alexandre Julliard : winex11: Implement the CopyBitmap entry point.

Alexandre Julliard julliard at winehq.org
Wed Nov 9 13:29:41 CST 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Nov  7 22:04:00 2011 +0100

winex11: Implement the CopyBitmap entry point.

---

 dlls/winex11.drv/bitmap.c  |   36 ++++++++++++++++++++++++++++++++++++
 dlls/winex11.drv/init.c    |    2 +-
 dlls/winex11.drv/x11drv.h  |    1 +
 dlls/winex11.drv/xrender.c |   10 +++++++++-
 4 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/bitmap.c b/dlls/winex11.drv/bitmap.c
index ea1c7ac..09da565 100644
--- a/dlls/winex11.drv/bitmap.c
+++ b/dlls/winex11.drv/bitmap.c
@@ -199,6 +199,42 @@ BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap )
 }
 
 
+/****************************************************************************
+ *	  CopyBitmap   (X11DRV.@)
+ */
+BOOL X11DRV_CopyBitmap( HBITMAP src, HBITMAP dst )
+{
+    X_PHYSBITMAP *phys_src, *phys_dst;
+    BITMAP bitmap;
+
+    if (!(phys_src = X11DRV_get_phys_bitmap( src ))) return FALSE;
+    if (!GetObjectW( dst, sizeof(bitmap), &bitmap )) return FALSE;
+
+    TRACE("%p->%p %dx%d %d bpp\n", src, dst, bitmap.bmWidth, bitmap.bmHeight, bitmap.bmBitsPixel);
+
+    if (!(phys_dst = X11DRV_init_phys_bitmap( dst ))) return FALSE;
+
+    phys_dst->depth = phys_src->depth;
+    phys_dst->trueColor = phys_src->trueColor;
+    if (phys_dst->trueColor) phys_dst->color_shifts = phys_src->color_shifts;
+
+    wine_tsx11_lock();
+    phys_dst->pixmap = XCreatePixmap( gdi_display, root_window,
+                                      bitmap.bmWidth, bitmap.bmHeight, phys_dst->depth );
+    XCopyArea( gdi_display, phys_src->pixmap, phys_dst->pixmap,
+               get_bitmap_gc(phys_dst->depth), 0, 0, bitmap.bmWidth, bitmap.bmHeight, 0, 0 );
+    wine_tsx11_unlock();
+
+    if (!phys_dst->pixmap)
+    {
+        WARN("Can't create Pixmap\n");
+        HeapFree( GetProcessHeap(), 0, phys_dst );
+        return FALSE;
+    }
+    return TRUE;
+}
+
+
 /***********************************************************************
  *           DeleteBitmap   (X11DRV.@)
  */
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index 6574270..8d61b5b 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -476,7 +476,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
     X11DRV_ChoosePixelFormat,           /* pChoosePixelFormat */
     X11DRV_Chord,                       /* pChord */
     NULL,                               /* pCloseFigure */
-    NULL,                               /* pCopyBitmap */
+    X11DRV_CopyBitmap,                  /* pCopyBitmap */
     X11DRV_CreateBitmap,                /* pCreateBitmap */
     X11DRV_CreateCompatibleDC,          /* pCreateCompatibleDC */
     X11DRV_CreateDC,                    /* pCreateDC */
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 1d6ce53..4967866 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -181,6 +181,7 @@ extern BOOL X11DRV_Arc( PHYSDEV dev, INT left, INT top, INT right,
                         INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
 extern BOOL X11DRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
                           INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
+extern BOOL X11DRV_CopyBitmap( HBITMAP src, HBITMAP dst ) DECLSPEC_HIDDEN;
 extern BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap ) DECLSPEC_HIDDEN;
 extern HBITMAP X11DRV_CreateDIBSection( PHYSDEV dev, HBITMAP hbitmap,
                                         BITMAPINFO *bmi, UINT usage ) DECLSPEC_HIDDEN;
diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index 30b9553..7ba61a3 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -1276,6 +1276,14 @@ static INT xrenderdrv_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID
 }
 
 /****************************************************************************
+ *	  xrenderdrv_CopyBitmap
+ */
+static BOOL xrenderdrv_CopyBitmap( HBITMAP src, HBITMAP dst )
+{
+    return X11DRV_CopyBitmap( src, dst );
+}
+
+/****************************************************************************
  *	  xrenderdrv_CreateBitmap
  */
 static BOOL xrenderdrv_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap )
@@ -3060,7 +3068,7 @@ static const struct gdi_dc_funcs xrender_funcs =
     NULL,                               /* pChoosePixelFormat */
     NULL,                               /* pChord */
     NULL,                               /* pCloseFigure */
-    NULL,                               /* pCopyBitmap */
+    xrenderdrv_CopyBitmap,              /* pCopyBitmap */
     xrenderdrv_CreateBitmap,            /* pCreateBitmap */
     xrenderdrv_CreateCompatibleDC,      /* pCreateCompatibleDC */
     xrenderdrv_CreateDC,                /* pCreateDC */




More information about the wine-cvs mailing list