[ros-diffs] [fireball] 43404: [arwinss] - Sync up to Wine-1.1.31.

fireball at svn.reactos.org fireball at svn.reactos.org
Mon Oct 12 17:03:17 CEST 2009


Author: fireball
Date: Mon Oct 12 17:03:17 2009
New Revision: 43404

URL: http://svn.reactos.org/svn/reactos?rev=43404&view=rev
Log:
[arwinss]
- Sync up to Wine-1.1.31.

Modified:
    branches/arwinss/reactos/dll/win32/winex11.drv/   (props changed)
    branches/arwinss/reactos/dll/win32/winex11.drv/bitblt.c
    branches/arwinss/reactos/dll/win32/winex11.drv/brush.c
    branches/arwinss/reactos/dll/win32/winex11.drv/dib.c
    branches/arwinss/reactos/dll/win32/winex11.drv/event.c
    branches/arwinss/reactos/dll/win32/winex11.drv/winex11.drv.spec
    branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h
    branches/arwinss/reactos/dll/win32/winex11.drv/xfont.c
    branches/arwinss/reactos/dll/win32/winex11.drv/xrender.c

Propchange: branches/arwinss/reactos/dll/win32/winex11.drv/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Oct 12 17:03:17 2009
@@ -1,3 +1,3 @@
 /branches/ros-amd64-bringup/reactos/dll/win32/winex11.drv:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080
 /trunk/reactos/dll/win32/winex11.drv:42000-43126
-/vendor/wine/dlls/winex11.drv/current:43149
+/vendor/wine/dlls/winex11.drv/current:43149,43398

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/bitblt.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/bitblt.c?rev=43404&r1=43403&r2=43404&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/bitblt.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/bitblt.c [iso-8859-1] Mon Oct 12 17:03:17 2009
@@ -1231,19 +1231,137 @@
 
 
 /***********************************************************************
- *           BITBLT_InternalStretchBlt
- *
- * Implementation of PatBlt(), BitBlt() and StretchBlt().
+ *           client_side_dib_copy
  */
-static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
-                                       INT widthDst, INT heightDst,
-                                       X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
-                                       INT widthSrc, INT heightSrc,
-                                       DWORD rop )
+static BOOL client_side_dib_copy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
+                                  X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
+                                  INT width, INT height )
+{
+    DIBSECTION srcDib, dstDib;
+    BYTE *srcPtr, *dstPtr;
+    INT srcRowOffset, dstRowOffset;
+    INT bytesPerPixel;
+    INT bytesToCopy;
+    INT y;
+    static RECT unusedRect;
+
+    if (GetObjectW(physDevSrc->bitmap->hbitmap, sizeof(srcDib), &srcDib) != sizeof(srcDib))
+      return FALSE;
+    if (GetObjectW(physDevDst->bitmap->hbitmap, sizeof(dstDib), &dstDib) != sizeof(dstDib))
+      return FALSE;
+
+    /* check for oversized values, just like X11DRV_DIB_CopyDIBSection() */
+    if (xSrc > srcDib.dsBm.bmWidth || ySrc > srcDib.dsBm.bmHeight)
+      return FALSE;
+    if (xSrc + width > srcDib.dsBm.bmWidth)
+      width = srcDib.dsBm.bmWidth - xSrc;
+    if (ySrc + height > srcDib.dsBm.bmHeight)
+      height = srcDib.dsBm.bmHeight - ySrc;
+
+    if (GetRgnBox(physDevDst->region, &unusedRect) == COMPLEXREGION)
+    {
+      /* for simple regions, the clipping was already done by BITBLT_GetVisRectangles */
+      FIXME("potential optimization: client-side complex region clipping\n");
+      return FALSE;
+    }
+    if (dstDib.dsBm.bmBitsPixel <= 8)
+    {
+      FIXME("potential optimization: client-side color-index mode DIB copy\n");
+      return FALSE;
+    }
+    if (!(srcDib.dsBmih.biCompression == BI_BITFIELDS &&
+          dstDib.dsBmih.biCompression == BI_BITFIELDS &&
+          !memcmp(srcDib.dsBitfields, dstDib.dsBitfields, 3*sizeof(DWORD)))
+        && !(srcDib.dsBmih.biCompression == BI_RGB &&
+             dstDib.dsBmih.biCompression == BI_RGB))
+    {
+      FIXME("potential optimization: client-side compressed DIB copy\n");
+      return FALSE;
+    }
+    if (srcDib.dsBm.bmBitsPixel != dstDib.dsBm.bmBitsPixel)
+    {
+      FIXME("potential optimization: pixel format conversion\n");
+      return FALSE;
+    }
+    if (srcDib.dsBmih.biWidth < 0 || dstDib.dsBmih.biWidth < 0)
+    {
+      FIXME("negative widths not yet implemented\n");
+      return FALSE;
+    }
+
+    switch (dstDib.dsBm.bmBitsPixel)
+    {
+      case 15:
+      case 16:
+        bytesPerPixel = 2;
+        break;
+      case 24:
+        bytesPerPixel = 3;
+        break;
+      case 32:
+        bytesPerPixel = 4;
+        break;
+      default:
+        FIXME("don't know how to work with a depth of %d\n", physDevSrc->depth);
+        return FALSE;
+    }
+
+    bytesToCopy = width * bytesPerPixel;
+
+    if (srcDib.dsBmih.biHeight < 0)
+    {
+      srcPtr = &physDevSrc->bitmap->base[ySrc*srcDib.dsBm.bmWidthBytes + xSrc*bytesPerPixel];
+      srcRowOffset = srcDib.dsBm.bmWidthBytes;
+    }
+    else
+    {
+      srcPtr = &physDevSrc->bitmap->base[(srcDib.dsBm.bmHeight-ySrc-1)*srcDib.dsBm.bmWidthBytes
+        + xSrc*bytesPerPixel];
+      srcRowOffset = -srcDib.dsBm.bmWidthBytes;
+    }
+    if (dstDib.dsBmih.biHeight < 0)
+    {
+      dstPtr = &physDevDst->bitmap->base[yDst*dstDib.dsBm.bmWidthBytes + xDst*bytesPerPixel];
+      dstRowOffset = dstDib.dsBm.bmWidthBytes;
+    }
+    else
+    {
+      dstPtr = &physDevDst->bitmap->base[(dstDib.dsBm.bmHeight-yDst-1)*dstDib.dsBm.bmWidthBytes
+        + xDst*bytesPerPixel];
+      dstRowOffset = -dstDib.dsBm.bmWidthBytes;
+    }
+
+    /* Handle overlapping regions on the same DIB */
+    if (physDevSrc == physDevDst && ySrc < yDst)
+    {
+      srcPtr += srcRowOffset * (height - 1);
+      srcRowOffset = -srcRowOffset;
+      dstPtr += dstRowOffset * (height - 1);
+      dstRowOffset = -dstRowOffset;
+    }
+
+    for (y = yDst; y < yDst + height; ++y)
+    {
+      memmove(dstPtr, srcPtr, bytesToCopy);
+      srcPtr += srcRowOffset;
+      dstPtr += dstRowOffset;
+    }
+
+    return TRUE;
+}
+
+
+/***********************************************************************
+ *           X11DRV_StretchBlt
+ */
+BOOL CDECL X11DRV_StretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, INT widthDst, INT heightDst,
+                              X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc,
+                              DWORD rop )
 {
     BOOL usePat, useSrc, useDst, destUsed, fStretch, fNullBrush;
     RECT visRectDst, visRectSrc;
     INT width, height;
+    INT sDst, sSrc = DIB_Status_None;
     const BYTE *opcode;
     Pixmap pixmaps[3] = { 0, 0, 0 };  /* pixmaps for DST, SRC, TMP */
     GC tmpGC = 0;
@@ -1305,6 +1423,8 @@
                         visRectSrc.right, visRectSrc.bottom,
                         visRectDst.left, visRectDst.top,
                         visRectDst.right, visRectDst.bottom );
+        if (physDevDst != physDevSrc)
+            sSrc = X11DRV_LockDIBSection( physDevSrc, DIB_Status_None );
     }
     else
     {
@@ -1319,6 +1439,21 @@
 
     width  = visRectDst.right - visRectDst.left;
     height = visRectDst.bottom - visRectDst.top;
+
+    sDst = X11DRV_LockDIBSection( physDevDst, DIB_Status_None );
+    if (physDevDst == physDevSrc) sSrc = sDst;
+
+    /* try client-side DIB copy */
+    if (!fStretch && rop == SRCCOPY &&
+        sSrc == DIB_Status_AppMod && sDst == DIB_Status_AppMod &&
+        physDevSrc->depth == physDevDst->depth)
+    {
+        if (client_side_dib_copy( physDevSrc, visRectSrc.left, visRectSrc.top,
+                                  physDevDst, visRectDst.left, visRectDst.top, width, height ))
+            goto done;
+    }
+
+    X11DRV_CoerceDIBSection( physDevDst, DIB_Status_GdiMod );
 
     opcode = BITBLT_Opcodes[(rop >> 16) & 0xff];
 
@@ -1346,7 +1481,7 @@
                                     physDevDst->dc_rect.top + visRectDst.top,
                                     width, height );
                     wine_tsx11_unlock();
-                    return TRUE;
+                    goto done;
                 }
                 break;
             case DSTINVERT:  /* 0x55 */
@@ -1366,7 +1501,7 @@
                                     physDevDst->dc_rect.top + visRectDst.top,
                                     width, height );
                     wine_tsx11_unlock();
-                    return TRUE;
+                    goto done;
                 }
                 break;
             }
@@ -1380,7 +1515,7 @@
                                 width, height );
                 wine_tsx11_unlock();
             }
-            return TRUE;
+            goto done;
         }
         else if (OP_SRCDST(*opcode) == OP_ARGS(SRC,DST))
         {
@@ -1388,6 +1523,19 @@
             {
                 wine_tsx11_lock();
                 XSetFunction( gdi_display, physDevDst->gc, OP_ROP(*opcode) );
+                wine_tsx11_unlock();
+
+                if (physDevSrc != physDevDst)
+                {
+                    if (sSrc == DIB_Status_AppMod)
+                    {
+                        X11DRV_DIB_CopyDIBSection( physDevSrc, physDevDst, visRectSrc.left, visRectSrc.top,
+                                                   visRectDst.left, visRectDst.top, width, height );
+                        goto done;
+                    }
+                    X11DRV_CoerceDIBSection( physDevSrc, DIB_Status_GdiMod );
+                }
+                wine_tsx11_lock();
                 XCopyArea( gdi_display, physDevSrc->drawable,
                            physDevDst->drawable, physDevDst->gc,
                            physDevSrc->dc_rect.left + visRectSrc.left,
@@ -1397,14 +1545,15 @@
                            physDevDst->dc_rect.top + visRectDst.top );
                 physDevDst->exposures++;
                 wine_tsx11_unlock();
-                return TRUE;
+                goto done;
             }
             if (physDevSrc->depth == 1)
             {
                 int fg, bg;
+
+                X11DRV_CoerceDIBSection( physDevSrc, DIB_Status_GdiMod );
                 get_colors(physDevDst, physDevSrc, &fg, &bg);
                 wine_tsx11_lock();
-
                 XSetBackground( gdi_display, physDevDst->gc, fg );
                 XSetForeground( gdi_display, physDevDst->gc, bg );
                 XSetFunction( gdi_display, physDevDst->gc, OP_ROP(*opcode) );
@@ -1417,7 +1566,7 @@
                             physDevDst->dc_rect.top + visRectDst.top, 1 );
                 physDevDst->exposures++;
                 wine_tsx11_unlock();
-                return TRUE;
+                goto done;
             }
         }
     }
@@ -1436,6 +1585,8 @@
         pixmaps[SRC] = XCreatePixmap( gdi_display, root_window, width, height,
                                       physDevDst->depth );
         wine_tsx11_unlock();
+
+        if (physDevDst != physDevSrc) X11DRV_CoerceDIBSection( physDevSrc, DIB_Status_GdiMod );
 
         if(!X11DRV_XRender_GetSrcAreaStretch( physDevSrc, physDevDst, pixmaps[SRC], tmpGC,
                                               widthSrc, heightSrc, widthDst, heightDst,
@@ -1501,263 +1652,9 @@
     if (pixmaps[TMP]) XFreePixmap( gdi_display, pixmaps[TMP] );
     XFreeGC( gdi_display, tmpGC );
     wine_tsx11_unlock();
+
+done:
+    if (useSrc && physDevDst != physDevSrc) X11DRV_UnlockDIBSection( physDevSrc, FALSE );
+    X11DRV_UnlockDIBSection( physDevDst, TRUE );
     return TRUE;
 }
-
-
-/***********************************************************************
- *           X11DRV_PatBlt
- */
-BOOL CDECL X11DRV_PatBlt( X11DRV_PDEVICE *physDev, INT left, INT top, INT width, INT height, DWORD rop )
-{
-    BOOL result;
-
-    X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod );
-    result = BITBLT_InternalStretchBlt( physDev, left, top, width, height, NULL, 0, 0, 0, 0, rop );
-    X11DRV_UnlockDIBSection( physDev, TRUE );
-    return result;
-}
-
-
-/***********************************************************************
- *           X11DRV_ClientSideDIBCopy
- */
-static BOOL X11DRV_ClientSideDIBCopy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
-                                      X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
-                                      INT width, INT height )
-{
-    DIBSECTION srcDib, dstDib;
-    BYTE *srcPtr, *dstPtr;
-    INT srcRowOffset, dstRowOffset;
-    INT bytesPerPixel;
-    INT bytesToCopy;
-    INT y;
-    static RECT unusedRect;
-
-    if (GetObjectW(physDevSrc->bitmap->hbitmap, sizeof(srcDib), &srcDib) != sizeof(srcDib))
-      return FALSE;
-    if (GetObjectW(physDevDst->bitmap->hbitmap, sizeof(dstDib), &dstDib) != sizeof(dstDib))
-      return FALSE;
-
-    /* check for oversized values, just like X11DRV_DIB_CopyDIBSection() */
-    if (xSrc > srcDib.dsBm.bmWidth || ySrc > srcDib.dsBm.bmHeight)
-      return FALSE;
-    if (xSrc + width > srcDib.dsBm.bmWidth)
-      width = srcDib.dsBm.bmWidth - xSrc;
-    if (ySrc + height > srcDib.dsBm.bmHeight)
-      height = srcDib.dsBm.bmHeight - ySrc;
-
-    if (GetRgnBox(physDevDst->region, &unusedRect) == COMPLEXREGION)
-    {
-      /* for simple regions, the clipping was already done by BITBLT_GetVisRectangles */
-      FIXME("potential optimization: client-side complex region clipping\n");
-      return FALSE;
-    }
-    if (dstDib.dsBm.bmBitsPixel <= 8)
-    {
-      FIXME("potential optimization: client-side color-index mode DIB copy\n");
-      return FALSE;
-    }
-    if (!(srcDib.dsBmih.biCompression == BI_BITFIELDS &&
-          dstDib.dsBmih.biCompression == BI_BITFIELDS &&
-          !memcmp(srcDib.dsBitfields, dstDib.dsBitfields, 3*sizeof(DWORD)))
-        && !(srcDib.dsBmih.biCompression == BI_RGB &&
-             dstDib.dsBmih.biCompression == BI_RGB))
-    {
-      FIXME("potential optimization: client-side compressed DIB copy\n");
-      return FALSE;
-    }
-    if (srcDib.dsBm.bmBitsPixel != dstDib.dsBm.bmBitsPixel)
-    {
-      FIXME("potential optimization: pixel format conversion\n");
-      return FALSE;
-    }
-    if (srcDib.dsBmih.biWidth < 0 || dstDib.dsBmih.biWidth < 0)
-    {
-      FIXME("negative widths not yet implemented\n");
-      return FALSE;
-    }
-
-    switch (dstDib.dsBm.bmBitsPixel)
-    {
-      case 15:
-      case 16:
-        bytesPerPixel = 2;
-        break;
-      case 24:
-        bytesPerPixel = 3;
-        break;
-      case 32:
-        bytesPerPixel = 4;
-        break;
-      default:
-        FIXME("don't know how to work with a depth of %d\n", physDevSrc->depth);
-        return FALSE;
-    }
-
-    bytesToCopy = width * bytesPerPixel;
-
-    if (srcDib.dsBmih.biHeight < 0)
-    {
-      srcPtr = &physDevSrc->bitmap->base[ySrc*srcDib.dsBm.bmWidthBytes + xSrc*bytesPerPixel];
-      srcRowOffset = srcDib.dsBm.bmWidthBytes;
-    }
-    else
-    {
-      srcPtr = &physDevSrc->bitmap->base[(srcDib.dsBm.bmHeight-ySrc-1)*srcDib.dsBm.bmWidthBytes
-        + xSrc*bytesPerPixel];
-      srcRowOffset = -srcDib.dsBm.bmWidthBytes;
-    }
-    if (dstDib.dsBmih.biHeight < 0)
-    {
-      dstPtr = &physDevDst->bitmap->base[yDst*dstDib.dsBm.bmWidthBytes + xDst*bytesPerPixel];
-      dstRowOffset = dstDib.dsBm.bmWidthBytes;
-    }
-    else
-    {
-      dstPtr = &physDevDst->bitmap->base[(dstDib.dsBm.bmHeight-yDst-1)*dstDib.dsBm.bmWidthBytes
-        + xDst*bytesPerPixel];
-      dstRowOffset = -dstDib.dsBm.bmWidthBytes;
-    }
-
-    /* Handle overlapping regions on the same DIB */
-    if (physDevSrc == physDevDst && ySrc < yDst)
-    {
-      srcPtr += srcRowOffset * (height - 1);
-      srcRowOffset = -srcRowOffset;
-      dstPtr += dstRowOffset * (height - 1);
-      dstRowOffset = -dstRowOffset;
-    }
-
-    for (y = yDst; y < yDst + height; ++y)
-    {
-      memmove(dstPtr, srcPtr, bytesToCopy);
-      srcPtr += srcRowOffset;
-      dstPtr += dstRowOffset;
-    }
-
-    return TRUE;
-}
-
-
-/***********************************************************************
- *           X11DRV_BitBlt
- */
-BOOL CDECL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
-                    INT width, INT height, X11DRV_PDEVICE *physDevSrc,
-                    INT xSrc, INT ySrc, DWORD rop )
-{
-    BOOL result = FALSE;
-    INT sSrc, sDst;
-    RECT visRectDst, visRectSrc;
-
-    if (((rop >> 16) & 0x55) == ((rop >> 17) & 0x55)) {
-      /* FIXME: seems the ROP doesn't include destination;
-       * now if the destination area include the entire dcDst,
-       * we can pass TRUE instead of FALSE to CoerceDIBSection(dcDst...),
-       * which may avoid a copy in some situations */
-    }
-
-    sDst = X11DRV_LockDIBSection( physDevDst, DIB_Status_None );
-    if (physDevDst != physDevSrc)
-        sSrc = X11DRV_LockDIBSection( physDevSrc, DIB_Status_None );
-    else
-        sSrc = sDst;
-
-    if ((sSrc == DIB_Status_AppMod) && (rop == SRCCOPY) &&
-        (physDevSrc->depth == physDevDst->depth))
-    {
-      POINT pts[2];
-      /* do everything ourselves; map coordinates */
-
-      pts[0].x = xSrc;
-      pts[0].y = ySrc;
-      pts[1].x = xSrc + width;
-      pts[1].y = ySrc + height;
-
-      LPtoDP(physDevSrc->hdc, pts, 2);
-      width = pts[1].x - pts[0].x;
-      height = pts[1].y - pts[0].y;
-      xSrc = pts[0].x;
-      ySrc = pts[0].y;
-
-      pts[0].x = xDst;
-      pts[0].y = yDst;
-      LPtoDP(physDevDst->hdc, pts, 1);
-
-      xDst = pts[0].x;
-      yDst = pts[0].y;
-
-      /* Perform basic clipping */
-      if (!BITBLT_GetVisRectangles( physDevDst, xDst, yDst, width, height,
-                                    physDevSrc, xSrc, ySrc, width, height,
-                                    &visRectSrc, &visRectDst ))
-      {
-        result = TRUE;
-        goto END;
-      }
-
-      xSrc = visRectSrc.left;
-      ySrc = visRectSrc.top;
-      xDst = visRectDst.left;
-      yDst = visRectDst.top;
-      width = visRectDst.right - visRectDst.left;
-      height = visRectDst.bottom - visRectDst.top;
-
-      if (sDst == DIB_Status_AppMod) {
-        result = X11DRV_ClientSideDIBCopy( physDevSrc, xSrc, ySrc,
-                                           physDevDst, xDst, yDst,
-                                           width, height );
-        if (result)
-          goto END;
-        /* fall back to X server copying */
-      }
-      X11DRV_CoerceDIBSection( physDevDst, DIB_Status_GdiMod );
-
-      wine_tsx11_lock();
-      XSetFunction( gdi_display, physDevDst->gc, GXcopy );
-      wine_tsx11_unlock();
-
-      X11DRV_DIB_CopyDIBSection( physDevSrc, physDevDst, xSrc, ySrc, xDst, yDst, width, height );
-      result = TRUE;
-      goto END;
-    }
-
-    X11DRV_CoerceDIBSection( physDevDst, DIB_Status_GdiMod );
-    if (physDevDst != physDevSrc)
-      X11DRV_CoerceDIBSection( physDevSrc, DIB_Status_GdiMod );
-
-    result = BITBLT_InternalStretchBlt( physDevDst, xDst, yDst, width, height,
-                                        physDevSrc, xSrc, ySrc, width, height, rop );
-
-END:
-    if (physDevDst != physDevSrc)
-      X11DRV_UnlockDIBSection( physDevSrc, FALSE );
-    X11DRV_UnlockDIBSection( physDevDst, TRUE );
-
-    return result;
-}
-
-
-/***********************************************************************
- *           X11DRV_StretchBlt
- */
-BOOL CDECL X11DRV_StretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
-                              INT widthDst, INT heightDst,
-                              X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
-                              INT widthSrc, INT heightSrc, DWORD rop )
-{
-    BOOL result;
-
-    X11DRV_LockDIBSection( physDevDst, DIB_Status_GdiMod );
-    if (physDevDst != physDevSrc)
-      X11DRV_LockDIBSection( physDevSrc, DIB_Status_GdiMod );
-
-    result = BITBLT_InternalStretchBlt( physDevDst, xDst, yDst, widthDst, heightDst,
-                                        physDevSrc, xSrc, ySrc, widthSrc, heightSrc, rop );
-
-    if (physDevDst != physDevSrc)
-      X11DRV_UnlockDIBSection( physDevSrc, FALSE );
-    X11DRV_UnlockDIBSection( physDevDst, TRUE );
-    return result;
-}

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/brush.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/brush.c?rev=43404&r1=43403&r2=43404&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/brush.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/brush.c [iso-8859-1] Mon Oct 12 17:03:17 2009
@@ -298,8 +298,7 @@
 
       case BS_DIBPATTERN:
 	TRACE("BS_DIBPATTERN\n");
-#ifndef __REACTOS__
-        if ((bmpInfo = GlobalLock16( logbrush.lbHatch )))
+        if ((bmpInfo = GlobalLock( (HGLOBAL)logbrush.lbHatch )))
 	{
 	    int size = bitmap_info_size( bmpInfo, logbrush.lbColor );
 	    hBitmap = CreateDIBitmap( physDev->hdc, &bmpInfo->bmiHeader,
@@ -308,9 +307,8 @@
                                         (WORD)logbrush.lbColor );
 	    BRUSH_SelectPatternBrush( physDev, hBitmap );
 	    DeleteObject( hBitmap );
-            GlobalUnlock16( logbrush.lbHatch );
+            GlobalUnlock( (HGLOBAL)logbrush.lbHatch );
 	}
-#endif
 	break;
     }
     return hbrush;

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/dib.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/dib.c?rev=43404&r1=43403&r2=43404&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/dib.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/dib.c [iso-8859-1] Mon Oct 12 17:03:17 2009
@@ -4744,19 +4744,23 @@
                                                          &physBitmap->nColorMap );
     }
 
+    if (!X11DRV_XRender_SetPhysBitmapDepth( physBitmap, &dib ))
+    {
+        if (dib.dsBm.bmBitsPixel == 1)
+        {
+            physBitmap->pixmap_depth = 1;
+            physBitmap->trueColor = FALSE;
+        }
+        else
+        {
+            physBitmap->pixmap_depth = screen_depth;
+            physBitmap->pixmap_color_shifts = X11DRV_PALETTE_default_shifts;
+            physBitmap->trueColor = (visual->class == TrueColor || visual->class == DirectColor);
+        }
+    }
+
     /* create pixmap and X image */
     wine_tsx11_lock();
-    if(dib.dsBm.bmBitsPixel == 1)
-    {
-        physBitmap->pixmap_depth = 1;
-        physBitmap->trueColor = FALSE;
-    }
-    else
-    {
-        physBitmap->pixmap_depth = screen_depth;
-        physBitmap->pixmap_color_shifts = X11DRV_PALETTE_default_shifts;
-        physBitmap->trueColor = (visual->class == TrueColor || visual->class == DirectColor);
-    }
 #ifdef HAVE_LIBXXSHM
     physBitmap->shminfo.shmid = -1;
 
@@ -4802,6 +4806,19 @@
 
     wine_tsx11_unlock();
     if (!physBitmap->pixmap || !physBitmap->image) return 0;
+
+    if (physBitmap->trueColor)
+    {
+        ColorShifts *shifts = &physBitmap->pixmap_color_shifts;
+
+        /* When XRender is around and used, we also support dibsections in other formats like 16-bit. In these
+         * cases we need to override the mask of XImages. The reason is that during XImage creation the masks are
+         * derived from a 24-bit visual (no 16-bit ones are around when X runs at 24-bit). SetImageBits and other
+         * functions rely on the color masks for proper color conversion, so we need to override the masks here. */
+        physBitmap->image->red_mask = shifts->physicalRed.max << shifts->physicalRed.shift;
+        physBitmap->image->green_mask = shifts->physicalGreen.max << shifts->physicalGreen.shift;
+        physBitmap->image->blue_mask = shifts->physicalBlue.max << shifts->physicalBlue.shift;
+    }
 
       /* install fault handler */
     InitializeCriticalSection( &physBitmap->lock );

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/event.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/event.c?rev=43404&r1=43403&r2=43404&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/event.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/event.c [iso-8859-1] Mon Oct 12 17:03:17 2009
@@ -324,7 +324,7 @@
 /***********************************************************************
  *           process_events
  */
-static int process_events( Display *display, Bool (*filter)(), ULONG_PTR arg )
+static int process_events( Display *display, Bool (*filter)(Display*, XEvent*,XPointer), ULONG_PTR arg )
 {
     XEvent event, prev_event;
     int count = 0;

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/winex11.drv.spec
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/winex11.drv.spec?rev=43404&r1=43403&r2=43404&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/winex11.drv.spec [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/winex11.drv.spec [iso-8859-1] Mon Oct 12 17:03:17 2009
@@ -2,7 +2,6 @@
 
 @ cdecl AlphaBlend(ptr long long long long ptr long long long long long) X11DRV_AlphaBlend
 @ cdecl Arc(ptr long long long long long long long long) X11DRV_Arc
-@ cdecl BitBlt(ptr long long long long ptr long long long) X11DRV_BitBlt
 @ cdecl ChoosePixelFormat(ptr ptr) X11DRV_ChoosePixelFormat
 @ cdecl Chord(ptr long long long long long long long long) X11DRV_Chord
 @ cdecl CreateBitmap(ptr long ptr) X11DRV_CreateBitmap
@@ -31,7 +30,6 @@
 @ cdecl GetTextMetrics(ptr ptr) X11DRV_GetTextMetrics
 @ cdecl LineTo(ptr long long) X11DRV_LineTo
 @ cdecl PaintRgn(ptr long) X11DRV_PaintRgn
-@ cdecl PatBlt(ptr long long long long long) X11DRV_PatBlt
 @ cdecl Pie(ptr long long long long long long long long) X11DRV_Pie
 @ cdecl PolyPolygon(ptr ptr ptr long) X11DRV_PolyPolygon
 @ cdecl PolyPolyline(ptr ptr ptr long) X11DRV_PolyPolyline

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h?rev=43404&r1=43403&r2=43404&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h [iso-8859-1] Mon Oct 12 17:03:17 2009
@@ -138,7 +138,7 @@
   /* X physical font */
 typedef UINT	 X_PHYSFONT;
 
-typedef struct tagXRENDERINFO *XRENDERINFO;
+struct xrender_info;
 
   /* X physical device */
 typedef struct
@@ -163,7 +163,7 @@
     Drawable      gl_drawable;
     Pixmap        pixmap;      /* Pixmap for a GLXPixmap gl_drawable */
     int           gl_copy;
-    XRENDERINFO   xrender;
+    struct xrender_info *xrender;
 } X11DRV_PDEVICE;
 
 
@@ -178,9 +178,6 @@
                                      INT widthDst, INT heightDst,
                                      X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
                                      INT widthSrc, INT heightSrc, BLENDFUNCTION blendfn );
-extern BOOL CDECL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
-                                 INT width, INT height, X11DRV_PDEVICE *physDevSrc,
-                                 INT xSrc, INT ySrc, DWORD rop );
 extern BOOL CDECL X11DRV_EnumDeviceFonts( X11DRV_PDEVICE *physDev, LPLOGFONTW plf,
                                           FONTENUMPROCW dfeproc, LPARAM lp );
 extern LONG CDECL X11DRV_GetBitmapBits( HBITMAP hbitmap, void *bits, LONG count );
@@ -190,8 +187,6 @@
 extern BOOL CDECL X11DRV_GetTextExtentExPoint( X11DRV_PDEVICE *physDev, LPCWSTR str, INT count,
                                                INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE size );
 extern BOOL CDECL X11DRV_GetTextMetrics(X11DRV_PDEVICE *physDev, TEXTMETRICW *metrics);
-extern BOOL CDECL X11DRV_PatBlt( X11DRV_PDEVICE *physDev, INT left, INT top,
-                                 INT width, INT height, DWORD rop );
 extern BOOL CDECL X11DRV_StretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
                                      INT widthDst, INT heightDst,
                                      X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
@@ -291,6 +286,7 @@
 extern BOOL X11DRV_XRender_ExtTextOut(X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
 				      const RECT *lprect, LPCWSTR wstr,
 				      UINT count, const INT *lpDx);
+extern BOOL X11DRV_XRender_SetPhysBitmapDepth(X_PHYSBITMAP *physBitmap, const DIBSECTION *dib);
 BOOL X11DRV_XRender_GetSrcAreaStretch(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst,
                                       Pixmap pixmap, GC gc,
                                       INT widthSrc, INT heightSrc,
@@ -304,7 +300,7 @@
 /* IME support */
 extern void IME_UnregisterClasses(void);
 extern void IME_SetOpenStatus(BOOL fOpen);
-extern INT IME_GetCursorPos();
+extern INT IME_GetCursorPos(void);
 extern void IME_SetCursorPos(DWORD pos);
 extern void IME_UpdateAssociation(HWND focus);
 extern BOOL IME_SetCompositionString(DWORD dwIndex, LPCVOID lpComp,

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/xfont.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/xfont.c?rev=43404&r1=43403&r2=43404&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/xfont.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/xfont.c [iso-8859-1] Mon Oct 12 17:03:17 2009
@@ -34,7 +34,9 @@
 #endif
 #include <sys/types.h>
 #include <fcntl.h>
+#include <errno.h>
 #include <math.h>
+#include <limits.h>
 
 #include "windef.h"
 #include "winbase.h"
@@ -1828,18 +1830,10 @@
     const char *confdir = "";//wine_get_config_dir();
     const char *display_name = XDisplayName(NULL);
     int len = strlen(confdir) + strlen(INIFontMetrics) + strlen(display_name) + 8;
-    int display = 0;
-    int screen = 0;
+    unsigned int display = 0;
+    unsigned int screen = 0;
     char *p, *ext;
 
-    /*
-    **  Normalize the display name, since on Red Hat systems, DISPLAY
-    **      is commonly set to one of either 'unix:0.0' or ':0' or ':0.0'.
-    **      after this code, all of the above will resolve to ':0.0'.
-    */
-    if (!strncmp( display_name, "unix:", 5 )) display_name += 4;
-    p = strchr(display_name, ':');
-    if (p) sscanf(p + 1, "%d.%d", &display, &screen);
 
     if ((len > *buf_size) &&
         !(buffer = HeapReAlloc( GetProcessHeap(), 0, buffer, *buf_size = len )))
@@ -1852,8 +1846,46 @@
     ext = buffer + strlen(buffer);
     strcpy( ext, display_name );
 
-    if (!(p = strchr( ext, ':' ))) p = ext + strlen(ext);
-    sprintf( p, ":%d.%d", display, screen );
+    /*
+    **  Normalize the display name. The format of DISPLAY is
+    **    [protocol/] [hostname] :[:] num [.num]
+    **
+    **  - on Red Hat systems, DISPLAY is commonly set to one of
+    **    either 'unix:0.0' or ':0' or ':0.0'.
+    **  - on MacOS X systems, DISPLAY is commonly set to
+    **    /tmp/foo/:0
+    **
+    **  after this code, all of the above will resolve to ':0.0'.
+    */
+    p = strrchr(ext, ':');
+    if (p)
+    {
+        sscanf(p + 1, "%u.%u", &display, &screen);
+        *p = 0;
+        if (display > 9999)
+        {
+            WARN("unlikely X11 display number\n");
+            *buffer = 0;
+            return buffer;
+        }
+    }
+    if (!strcmp( ext, "unix" ) ||
+        !strcmp( ext, "localhost" ))
+        *ext = 0;
+    if (!strncmp( ext, "/tmp/", 5 ))
+        *ext = 0; /* assume pathnames are local */
+
+    /* Deal with the possibility of slashes in the display name */
+    for( p = ext; *p; p++ )
+        if ( *p == '/' )
+            *p = '_';
+
+    /* X11 fonts are per-display, not per-screen, so don't
+    ** include the screen number in the font cache filename */
+    sprintf( ext + strlen(ext), ":%u", display );
+
+    TRACE("display '%s' -> cachefile '%s'\n", display_name, buffer);
+
     return buffer;
 }
 
@@ -2156,8 +2188,10 @@
  *
  * INIT ONLY
  */
-static BOOL XFONT_ReadCachedMetrics( int fd, int res, unsigned x_checksum, int x_count )
-{
+static BOOL XFONT_ReadCachedMetrics( const char *path, int res, unsigned x_checksum, int x_count )
+{
+    int fd = open( path, O_RDONLY );
+
     if( fd >= 0 )
     {
 	unsigned u;
@@ -2270,6 +2304,8 @@
         HeapFree( GetProcessHeap(), 0, fontList );
 	fontList = NULL;
 	close( fd );
+    } else {
+        TRACE("fontcache '%s': %s\n", path, strerror(errno));
     }
     return FALSE;
 }
@@ -2855,7 +2891,7 @@
 {
   char**    x_pattern;
   unsigned  x_checksum;
-  int       i, x_count, fd, buf_size;
+  int       i, x_count, buf_size;
   char      *buffer;
   HKEY hkey;
 
@@ -2879,7 +2915,7 @@
      if( j ) x_checksum ^= __genericCheckSum( x_pattern[i], j );
   }
   x_checksum |= X_PFONT_MAGIC;
-  buf_size = 128;
+  buf_size = PATH_MAX;
   buffer = HeapAlloc( GetProcessHeap(), 0, buf_size );
 
   /* deal with systemwide font metrics cache */
@@ -2895,8 +2931,8 @@
 
   if( buffer[0] )
   {
-      fd = open( buffer, O_RDONLY );
-      XFONT_ReadCachedMetrics(fd, DefResolution, x_checksum, x_count);
+      TRACE("system fontcache is '%s'\n", buffer);
+      XFONT_ReadCachedMetrics(buffer, DefResolution, x_checksum, x_count);
   }
   if (fontList == NULL)
   {
@@ -2904,8 +2940,8 @@
       buffer = XFONT_UserMetricsCache( buffer, &buf_size );
       if( buffer[0] )
       {
-	  fd = open( buffer, O_RDONLY );
-	  XFONT_ReadCachedMetrics(fd, DefResolution, x_checksum, x_count);
+          TRACE("user fontcache is '%s'\n", buffer);
+	  XFONT_ReadCachedMetrics(buffer, DefResolution, x_checksum, x_count);
       }
   }
 
@@ -2914,11 +2950,15 @@
       int n_ff = XFONT_BuildMetrics(x_pattern, DefResolution, x_checksum, x_count);
       if( buffer[0] )	 /* update cached metrics */
       {
-	  fd = open( buffer, O_CREAT | O_TRUNC | O_RDWR, 0644 ); /* -rw-r--r-- */
-	  if( XFONT_WriteCachedMetrics( fd, x_checksum, x_count, n_ff ) == FALSE )
+	  int fd = open( buffer, O_CREAT | O_TRUNC | O_RDWR, 0666 );
+	  if ( fd < 0 )
+	  {
+	      WARN("Unable to create fontcache '%s': %s\n", buffer, strerror(errno));
+	  }
+	  else if( XFONT_WriteCachedMetrics( fd, x_checksum, x_count, n_ff ) == FALSE )
 	  {
 	      WARN("Unable to write to fontcache '%s'\n", buffer);
-	      if( fd >= 0) remove( buffer );	/* couldn't write entire file */
+	      remove( buffer );	/* couldn't write entire file */
 	  }
       }
   }

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/xrender.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/xrender.c?rev=43404&r1=43403&r2=43404&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/xrender.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/xrender.c [iso-8859-1] Mon Oct 12 17:03:17 2009
@@ -2,6 +2,7 @@
  * Functions to use the XRender extension
  *
  * Copyright 2001, 2002 Huw D M Davies for CodeWeavers
+ * Copyright 2009 Roderick Colenbrander
  *
  * Some parts also:
  * Copyright 2000 Keith Packard, member of The XFree86 Project, Inc.
@@ -139,7 +140,7 @@
     INT next;
 } gsCacheEntry;
 
-struct tagXRENDERINFO
+struct xrender_info
 {
     int                cache_index;
     Picture            pict;
@@ -205,6 +206,23 @@
 #define get_be_word(x) RtlUshortByteSwap(x)
 #define NATIVE_BYTE_ORDER LSBFirst
 #endif
+
+static struct xrender_info *get_xrender_info(X11DRV_PDEVICE *physDev)
+{
+    if(!physDev->xrender)
+    {
+        physDev->xrender = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev->xrender));
+
+        if(!physDev->xrender)
+        {
+            ERR("Unable to allocate XRENDERINFO!\n");
+            return NULL;
+        }
+        physDev->xrender->cache_index = -1;
+    }
+
+    return physDev->xrender;
+}
 
 static BOOL get_xrender_template(const WineXRenderFormatTemplate *fmt, XRenderPictFormat *templ, unsigned long *mask)
 {
@@ -794,6 +812,7 @@
 BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont)
 {
     LFANDSIZE lfsz;
+    struct xrender_info *info;
 
     GetObjectW(hfont, sizeof(lfsz.lf), &lfsz.lf);
     TRACE("h=%d w=%d weight=%d it=%d charset=%d name=%s\n",
@@ -805,15 +824,13 @@
     GetWorldTransform( physDev->hdc, &lfsz.xform );
     lfsz_calc_hash(&lfsz);
 
+    info = get_xrender_info(physDev);
+    if (!info) return 0;
+
     EnterCriticalSection(&xrender_cs);
-    if(!physDev->xrender) {
-        physDev->xrender = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
-				     sizeof(*physDev->xrender));
-	physDev->xrender->cache_index = -1;
-    }
-    else if(physDev->xrender->cache_index != -1)
-        dec_ref_cache(physDev->xrender->cache_index);
-    physDev->xrender->cache_index = GetCacheEntry(physDev, &lfsz);
+    if(info->cache_index != -1)
+        dec_ref_cache(info->cache_index);
+    info->cache_index = GetCacheEntry(physDev, &lfsz);
     LeaveCriticalSection(&xrender_cs);
     return 0;
 }
@@ -833,6 +850,33 @@
     HeapFree(GetProcessHeap(), 0, physDev->xrender);
     physDev->xrender = NULL;
     return;
+}
+
+BOOL X11DRV_XRender_SetPhysBitmapDepth(X_PHYSBITMAP *physBitmap, const DIBSECTION *dib)
+{
+    WineXRenderFormat *fmt;
+    ColorShifts shifts;
+
+    /* When XRender is not around we can only use the screen_depth and when needed we perform depth conversion
+     * in software. Further we also return the screen depth for paletted formats or TrueColor formats with a low
+     * number of bits because XRender can't handle paletted formats and 8-bit TrueColor does not exist for XRender. */
+    if(!X11DRV_XRender_Installed || dib->dsBm.bmBitsPixel <= 8)
+        return FALSE;
+
+    X11DRV_PALETTE_ComputeColorShifts(&shifts, dib->dsBitfields[0], dib->dsBitfields[1], dib->dsBitfields[2]);
+
+    /* Common formats should be in our picture format table. */
+    fmt = get_xrender_format_from_color_shifts(dib->dsBm.bmBitsPixel, &shifts);
+    if(fmt)
+    {
+        physBitmap->pixmap_depth = fmt->pict_format->depth;
+        physBitmap->trueColor = TRUE;
+        physBitmap->pixmap_color_shifts = shifts;
+        return TRUE;
+    }
+    TRACE("Unhandled dibsection format bpp=%d, redMask=%x, greenMask=%x, blueMask=%x\n",
+          dib->dsBm.bmBitsPixel, dib->dsBitfields[0], dib->dsBitfields[1], dib->dsBitfields[2]);
+    return FALSE;
 }
 
 /***********************************************************************
@@ -2172,6 +2216,11 @@
     wine_tsx11_unlock();
 }
 
+BOOL X11DRV_XRender_SetPhysBitmapDepth(X_PHYSBITMAP *physBitmap, const DIBSECTION *dib)
+{
+    return FALSE;
+}
+
 BOOL X11DRV_XRender_GetSrcAreaStretch(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst,
                                       Pixmap pixmap, GC gc,
                                       INT widthSrc, INT heightSrc,




More information about the Ros-diffs mailing list