Alexandre Julliard : gdi32: Get rid of the BitBlt driver entry point.

Alexandre Julliard julliard at winehq.org
Thu Mar 17 12:27:02 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Mar 17 15:01:11 2011 +0100

gdi32: Get rid of the BitBlt driver entry point.

---

 dlls/gdi32/bitblt.c          |   75 +----------------------------------------
 dlls/gdi32/driver.c          |    2 -
 dlls/gdi32/enhmfdrv/bitblt.c |   39 ++++++---------------
 dlls/gdi32/enhmfdrv/init.c   |    1 -
 dlls/gdi32/gdi_private.h     |    1 -
 dlls/gdi32/mfdrv/init.c      |    1 -
 6 files changed, 13 insertions(+), 106 deletions(-)

diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c
index 6586f41..daf29cd 100644
--- a/dlls/gdi32/bitblt.c
+++ b/dlls/gdi32/bitblt.c
@@ -68,80 +68,9 @@ BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop
 BOOL WINAPI BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width,
                     INT height, HDC hdcSrc, INT xSrc, INT ySrc, DWORD rop )
 {
-    BOOL ret = FALSE;
-    DC *dcDst, *dcSrc;
-
     if (!rop_uses_src( rop )) return PatBlt( hdcDst, xDst, yDst, width, height, rop );
-
-    TRACE("hdcSrc=%p %d,%d -> hdcDest=%p %d,%d %dx%d rop=%06x\n",
-          hdcSrc, xSrc, ySrc, hdcDst, xDst, yDst, width, height, rop);
-
-    if (!(dcDst = get_dc_ptr( hdcDst ))) return FALSE;
-    update_dc( dcDst );
-
-    if (dcDst->funcs->pBitBlt || dcDst->funcs->pStretchBlt)
-    {
-        dcSrc = get_dc_ptr( hdcSrc );
-        if (dcSrc) update_dc( dcSrc );
-
-        if (dcDst->funcs->pBitBlt)
-            ret = dcDst->funcs->pBitBlt( dcDst->physDev, xDst, yDst, width, height,
-                                         dcSrc ? dcSrc->physDev : NULL, xSrc, ySrc, rop );
-        else
-            ret = dcDst->funcs->pStretchBlt( dcDst->physDev, xDst, yDst, width, height,
-                                             dcSrc ? dcSrc->physDev : NULL, xSrc, ySrc,
-                                             width, height, rop );
-
-        release_dc_ptr( dcDst );
-        if (dcSrc) release_dc_ptr( dcSrc );
-    }
-    else if (dcDst->funcs->pStretchDIBits)
-    {
-        BITMAP bm;
-        BITMAPINFOHEADER info_hdr;
-        HBITMAP hbm;
-        LPVOID bits;
-        INT lines;
-
-        release_dc_ptr( dcDst );
-
-        if(GetObjectType( hdcSrc ) != OBJ_MEMDC)
-        {
-            FIXME("hdcSrc isn't a memory dc.  Don't yet cope with this\n");
-            return FALSE;
-        }
-
-        GetObjectW(GetCurrentObject(hdcSrc, OBJ_BITMAP), sizeof(bm), &bm);
- 
-        info_hdr.biSize = sizeof(info_hdr);
-        info_hdr.biWidth = bm.bmWidth;
-        info_hdr.biHeight = bm.bmHeight;
-        info_hdr.biPlanes = 1;
-        info_hdr.biBitCount = 32;
-        info_hdr.biCompression = BI_RGB;
-        info_hdr.biSizeImage = 0;
-        info_hdr.biXPelsPerMeter = 0;
-        info_hdr.biYPelsPerMeter = 0;
-        info_hdr.biClrUsed = 0;
-        info_hdr.biClrImportant = 0;
-
-        if(!(bits = HeapAlloc(GetProcessHeap(), 0, bm.bmHeight * bm.bmWidth * 4)))
-            return FALSE;
-
-        /* Select out the src bitmap before calling GetDIBits */
-        hbm = SelectObject(hdcSrc, GetStockObject(DEFAULT_BITMAP));
-        GetDIBits(hdcSrc, hbm, 0, bm.bmHeight, bits, (BITMAPINFO*)&info_hdr, DIB_RGB_COLORS);
-        SelectObject(hdcSrc, hbm);
-
-        lines = StretchDIBits(hdcDst, xDst, yDst, width, height, xSrc, bm.bmHeight - height - ySrc,
-                              width, height, bits, (BITMAPINFO*)&info_hdr, DIB_RGB_COLORS, rop);
-
-        HeapFree(GetProcessHeap(), 0, bits);
-        return (lines == height);
-    }
-    else release_dc_ptr( dcDst );
-
-    return ret;
+    else return StretchBlt( hdcDst, xDst, yDst, width, height,
+                            hdcSrc, xSrc, ySrc, width, height, rop );
 }
 
 
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index 57f3117..f70293d 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -81,7 +81,6 @@ static struct graphics_driver *create_driver( HMODULE module )
         GET_FUNC(Arc);
         GET_FUNC(ArcTo);
         GET_FUNC(BeginPath);
-        GET_FUNC(BitBlt);
         GET_FUNC(ChoosePixelFormat);
         GET_FUNC(Chord);
         GET_FUNC(CloseFigure);
@@ -794,7 +793,6 @@ const DC_FUNCTIONS null_driver =
     nulldrv_Arc,                        /* pArc */
     nulldrv_ArcTo,                      /* pArcTo */
     nulldrv_BeginPath,                  /* pBeginPath */
-    NULL,                               /* pBitBlt */
     nulldrv_ChoosePixelFormat,          /* pChoosePixelFormat */
     nulldrv_Chord,                      /* pChord */
     nulldrv_CloseFigure,                /* pCloseFigure */
diff --git a/dlls/gdi32/enhmfdrv/bitblt.c b/dlls/gdi32/enhmfdrv/bitblt.c
index f56e8ac..377efad 100644
--- a/dlls/gdi32/enhmfdrv/bitblt.c
+++ b/dlls/gdi32/enhmfdrv/bitblt.c
@@ -65,12 +65,8 @@ BOOL CDECL EMFDRV_PatBlt( PHYSDEV dev, INT left, INT top,
     return ret;
 }
 
-/* Utilitarian function used by EMFDRV_BitBlt and EMFDRV_StretchBlt */
-
-static BOOL EMFDRV_BitBlockTransfer( 
-    PHYSDEV devDst, INT xDst, INT yDst, INT widthDst, INT heightDst,  
-    PHYSDEV devSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, DWORD rop,
-    DWORD emrType)
+BOOL CDECL EMFDRV_StretchBlt( PHYSDEV devDst, INT xDst, INT yDst, INT widthDst, INT heightDst,
+                              PHYSDEV devSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, DWORD rop )
 {
     BOOL ret;
     PEMRBITBLT pEMR;
@@ -83,13 +79,18 @@ static BOOL EMFDRV_BitBlockTransfer(
     LPBITMAPINFOHEADER lpBmiH;
     EMFDRV_PDEVICE* physDevSrc = (EMFDRV_PDEVICE*)devSrc;
     HBITMAP hBitmap = NULL;
+    DWORD emrType;
 
-    if (emrType == EMR_BITBLT)
+    if (widthSrc == widthDst && heightSrc == heightDst)
+    {
+        emrType = EMR_BITBLT;
         emrSize = sizeof(EMRBITBLT);
-    else if (emrType == EMR_STRETCHBLT)
-        emrSize = sizeof(EMRSTRETCHBLT);
+    }
     else
-        return FALSE;
+    {
+        emrType = EMR_STRETCHBLT;
+        emrSize = sizeof(EMRSTRETCHBLT);
+    }
 
     hBitmap = GetCurrentObject(physDevSrc->hdc, OBJ_BITMAP);
 
@@ -168,24 +169,6 @@ static BOOL EMFDRV_BitBlockTransfer(
     return ret;
 }
 
-BOOL CDECL EMFDRV_BitBlt(
-    PHYSDEV devDst, INT xDst, INT yDst, INT width, INT height,
-    PHYSDEV devSrc, INT xSrc, INT ySrc, DWORD rop)
-{
-    return EMFDRV_BitBlockTransfer( devDst, xDst, yDst, width, height,  
-                                    devSrc, xSrc, ySrc, width, height, 
-                                    rop, EMR_BITBLT );
-}
-
-BOOL CDECL EMFDRV_StretchBlt(
-    PHYSDEV devDst, INT xDst, INT yDst, INT widthDst, INT heightDst,  
-    PHYSDEV devSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, DWORD rop )
-{
-    return EMFDRV_BitBlockTransfer( devDst, xDst, yDst, widthDst, heightDst,  
-                                    devSrc, xSrc, ySrc, widthSrc, heightSrc, 
-                                    rop, EMR_STRETCHBLT );
-}
-
 INT CDECL EMFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
                                       INT heightDst, INT xSrc, INT ySrc,
                                       INT widthSrc, INT heightSrc,
diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c
index ac3fa4f..c31496b 100644
--- a/dlls/gdi32/enhmfdrv/init.c
+++ b/dlls/gdi32/enhmfdrv/init.c
@@ -43,7 +43,6 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
     EMFDRV_Arc,                      /* pArc */
     NULL,                            /* pArcTo */
     EMFDRV_BeginPath,                /* pBeginPath */
-    EMFDRV_BitBlt,                   /* pBitBlt */
     NULL,                            /* pChoosePixelFormat */
     EMFDRV_Chord,                    /* pChord */
     EMFDRV_CloseFigure,              /* pCloseFigure */
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 9db7c32..01f2c1b 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -88,7 +88,6 @@ typedef struct tagDC_FUNCS
     BOOL     (CDECL *pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
     BOOL     (CDECL *pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
     BOOL     (CDECL *pBeginPath)(PHYSDEV);
-    BOOL     (CDECL *pBitBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,DWORD);
     INT      (CDECL *pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *);
     BOOL     (CDECL *pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
     BOOL     (CDECL *pCloseFigure)(PHYSDEV);
diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c
index 03af2e8..2cd3ff8 100644
--- a/dlls/gdi32/mfdrv/init.c
+++ b/dlls/gdi32/mfdrv/init.c
@@ -41,7 +41,6 @@ static const DC_FUNCTIONS MFDRV_Funcs =
     MFDRV_Arc,                       /* pArc */
     NULL,                            /* pArcTo */
     MFDRV_BeginPath,                 /* pBeginPath */
-    NULL,                            /* pBitBlt */
     NULL,                            /* pChoosePixelFormat */
     MFDRV_Chord,                     /* pChord */
     MFDRV_CloseFigure,               /* pCloseFigure */




More information about the wine-cvs mailing list