Alexandre Julliard : winex11: Get rid of the SetDIBitsToDevice implementation.

Alexandre Julliard julliard at winehq.org
Tue Sep 6 11:35:52 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Sep  6 14:44:11 2011 +0200

winex11: Get rid of the SetDIBitsToDevice implementation.

---

 dlls/gdi32/tests/bitmap.c |   16 ++++-
 dlls/winex11.drv/dib.c    |  135 ---------------------------------------------
 dlls/winex11.drv/init.c   |    2 +-
 dlls/winex11.drv/x11drv.h |    2 -
 4 files changed, 14 insertions(+), 141 deletions(-)

diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index a2dbfd9..a66113c 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -929,7 +929,12 @@ static void test_dib_formats(void)
                         "SetDIBits succeeded for %u/%u/%u\n", bpp, planes, compr );
                 ret = SetDIBitsToDevice( memdc, 0, 0, 1, 1, 0, 0, 0, 1, data, bi, DIB_RGB_COLORS );
                 if (expect_ok)
-                    ok( ret, "SetDIBitsToDevice failed for %u/%u/%u\n", bpp, planes, compr );
+                {
+                    if (todo)
+                        todo_wine ok( ret, "SetDIBitsToDevice failed for %u/%u/%u\n", bpp, planes, compr );
+                    else
+                        ok( ret, "SetDIBitsToDevice failed for %u/%u/%u\n", bpp, planes, compr );
+                }
                 else
                     ok( !ret ||
                         broken((bpp == 4 && compr == BI_RLE4) || (bpp == 8 && compr == BI_RLE8)), /* nt4 */
@@ -978,7 +983,12 @@ static void test_dib_formats(void)
                     ok( !ret, "SetDIBits succeeded for %u/%u/%u\n", bpp, planes, compr );
                 ret = SetDIBitsToDevice( memdc, 0, 0, 1, 1, 0, 0, 0, 1, data, bi, DIB_RGB_COLORS );
                 if (expect_ok)
-                    ok( ret, "SetDIBitsToDevice failed for %u/%u/%u\n", bpp, planes, compr );
+                {
+                    if (todo)
+                        todo_wine ok( ret, "SetDIBitsToDevice failed for %u/%u/%u\n", bpp, planes, compr );
+                    else
+                        ok( ret, "SetDIBitsToDevice failed for %u/%u/%u\n", bpp, planes, compr );
+                }
                 else
                     ok( !ret, "SetDIBitsToDevice succeeded for %u/%u/%u\n", bpp, planes, compr );
                 ret = StretchDIBits( memdc, 0, 0, 1, 1, 0, 0, 1, 1, data, bi, DIB_RGB_COLORS, SRCCOPY );
@@ -1023,7 +1033,7 @@ static void test_dib_formats(void)
     ok( hdib != NULL, "CreateDIBitmap failed with null bitfields\n" );
     DeleteObject( hdib );
     ret = SetDIBitsToDevice( memdc, 0, 0, 1, 1, 0, 0, 0, 1, data, bi, DIB_RGB_COLORS );
-    ok( ret, "SetDIBitsToDevice failed with null bitfields\n" );
+    todo_wine ok( ret, "SetDIBitsToDevice failed with null bitfields\n" );
     ret = StretchDIBits( memdc, 0, 0, 1, 1, 0, 0, 1, 1, data, bi, DIB_RGB_COLORS, SRCCOPY );
     todo_wine ok( ret, "StretchDIBits failed with null bitfields\n" );
     ret = GetDIBits(hdc, hbmp, 0, 2, data, bi, DIB_RGB_COLORS);
diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index ba58f57..df68c2e 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -3713,141 +3713,6 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
     return lines;
 }
 
-/*************************************************************************
- *		X11DRV_SetDIBitsToDevice
- *
- */
-INT X11DRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDest, DWORD cx, DWORD cy,
-                              INT xSrc, INT ySrc, UINT startscan, UINT lines, LPCVOID bits,
-                              BITMAPINFO *info, UINT coloruse )
-{
-    X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
-    X11DRV_DIB_IMAGEBITS_DESCR descr;
-    INT result;
-    LONG height;
-    BOOL top_down;
-    POINT pt;
-    int rop = X11DRV_XROPfunction[GetROP2(dev->hdc) - 1];
-
-    top_down = (info->bmiHeader.biHeight < 0);
-    height = abs( info->bmiHeader.biHeight );
-    descr.infoBpp = info->bmiHeader.biBitCount;
-    descr.compression = info->bmiHeader.biCompression;
-
-    pt.x = xDest;
-    pt.y = yDest;
-    LPtoDP(dev->hdc, &pt, 1);
-    if (GetLayout( dev->hdc ) & LAYOUT_RTL) pt.x -= cx - 1;
-
-    if (!lines || (startscan >= height)) return 0;
-    if (!top_down && startscan + lines > height) lines = height - startscan;
-
-    /* make xSrc,ySrc point to the upper-left corner, not the lower-left one,
-     * and clamp all values to fit inside [startscan,startscan+lines]
-     */
-    if (ySrc + cy <= startscan + lines)
-    {
-        UINT y = startscan + lines - (ySrc + cy);
-        if (ySrc < startscan) cy -= (startscan - ySrc);
-        if (!top_down)
-        {
-            /* avoid getting unnecessary lines */
-            ySrc = 0;
-            if (y >= lines) return 0;
-            lines -= y;
-        }
-        else
-        {
-            if (y >= lines) return lines;
-            ySrc = y;  /* need to get all lines in top down mode */
-        }
-    }
-    else
-    {
-        if (ySrc >= startscan + lines) return 0;
-        pt.y += ySrc + cy - (startscan + lines);
-        cy = startscan + lines - ySrc;
-        ySrc = 0;
-        if (cy > lines) cy = lines;
-    }
-    if (xSrc >= info->bmiHeader.biWidth) return lines;
-    if (xSrc + cx <= 0) return lines;
-    if (xSrc + cx >= info->bmiHeader.biWidth) cx = info->bmiHeader.biWidth - xSrc;
-    if (xSrc < 0)
-    {
-        pt.x -= xSrc;
-        cx += xSrc;
-        xSrc = 0;
-    }
-    if (!cx || !cy) return lines;
-
-    /* Update the pixmap from the DIB section */
-    X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod);
-
-    X11DRV_SetupGCForText( physDev );  /* To have the correct colors */
-    wine_tsx11_lock();
-    XSetFunction(gdi_display, physDev->gc, rop);
-    wine_tsx11_unlock();
-
-    switch (descr.infoBpp)
-    {
-       case 1:
-       case 4:
-       case 8:
-               descr.colorMap = (RGBQUAD *)X11DRV_DIB_BuildColorMap(
-                                            physDev, coloruse,
-                                            physDev->depth, info, &descr.nColorMap );
-               if (!descr.colorMap) return 0;
-               descr.rMask = descr.gMask = descr.bMask = 0;
-               break;
-       case 15:
-       case 16:
-               descr.rMask = (descr.compression == BI_BITFIELDS) ? *(const DWORD *)info->bmiColors       : 0x7c00;
-               descr.gMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)info->bmiColors + 1) : 0x03e0;
-               descr.bMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)info->bmiColors + 2) : 0x001f;
-               descr.colorMap = 0;
-               break;
-
-       case 24:
-       case 32:
-               descr.rMask = (descr.compression == BI_BITFIELDS) ? *(const DWORD *)info->bmiColors       : 0xff0000;
-               descr.gMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)info->bmiColors + 1) : 0x00ff00;
-               descr.bMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)info->bmiColors + 2) : 0x0000ff;
-               descr.colorMap = 0;
-               break;
-    }
-
-    descr.physDev    = physDev;
-    descr.bits       = bits;
-    descr.image      = NULL;
-    descr.palentry   = NULL;
-    descr.lines      = top_down ? -lines : lines;
-    descr.infoWidth  = info->bmiHeader.biWidth;
-    descr.depth      = physDev->depth;
-    descr.shifts     = physDev->color_shifts;
-    descr.drawable   = physDev->drawable;
-    descr.gc         = physDev->gc;
-    descr.xSrc       = xSrc;
-    descr.ySrc       = ySrc;
-    descr.xDest      = physDev->dc_rect.left + pt.x;
-    descr.yDest      = physDev->dc_rect.top + pt.y;
-    descr.width      = cx;
-    descr.height     = cy;
-    descr.shm_mode   = X11DRV_SHM_NONE;
-    descr.dibpitch   = X11DRV_DIB_GetDIBWidthBytes( info->bmiHeader.biWidth, info->bmiHeader.biBitCount );
-    descr.physBitmap = NULL;
-
-    result = X11DRV_DIB_SetImageBits( &descr );
-
-    if (descr.infoBpp <= 8)
-       HeapFree(GetProcessHeap(), 0, descr.colorMap);
-
-    /* Update the DIBSection of the pixmap */
-    X11DRV_UnlockDIBSection(physDev, TRUE);
-
-    return result;
-}
-
 /***********************************************************************
  *           X11DRV_DIB_DoCopyDIBSection
  */
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index 111676c..95e0a0b 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -532,7 +532,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
     X11DRV_SetDCBrushColor,             /* pSetDCBrushColor */
     X11DRV_SetDCPenColor,               /* pSetDCPenColor */
     X11DRV_SetDIBColorTable,            /* pSetDIBColorTable */
-    X11DRV_SetDIBitsToDevice,           /* pSetDIBitsToDevice */
+    NULL,                               /* pSetDIBitsToDevice */
     X11DRV_SetDeviceClipping,           /* pSetDeviceClipping */
     X11DRV_SetDeviceGammaRamp,          /* pSetDeviceGammaRamp */
     NULL,                               /* pSetLayout */
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 69845d3..545182c 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -236,8 +236,6 @@ extern COLORREF X11DRV_SetDCPenColor( PHYSDEV dev, COLORREF crColor ) DECLSPEC_H
 extern void X11DRV_SetDeviceClipping( PHYSDEV dev, HRGN vis_rgn, HRGN clip_rgn ) DECLSPEC_HIDDEN;
 extern BOOL X11DRV_SetDeviceGammaRamp( PHYSDEV dev, LPVOID ramp ) DECLSPEC_HIDDEN;
 extern UINT X11DRV_SetDIBColorTable( PHYSDEV dev, UINT start, UINT count, const RGBQUAD *colors ) DECLSPEC_HIDDEN;
-extern INT X11DRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDest, DWORD cx, DWORD cy, INT xSrc, INT ySrc,
-                                     UINT startscan, UINT lines, LPCVOID bits, BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN;
 extern COLORREF X11DRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
 extern BOOL X11DRV_SetPixelFormat(PHYSDEV dev, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd) DECLSPEC_HIDDEN;
 extern COLORREF X11DRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list