[Gdi32]
[reactos.git] / reactos / win32ss / gdi / gdi32 / wine / enhmetafile.c
index b78b51e..fde60bb 100644 (file)
@@ -547,7 +547,6 @@ static void EMF_Update_MF_Xform(HDC hdc, const enum_emh_data *info)
     if (!SetWorldTransform(hdc, &final_trans))
     {
         __debugbreak();
-        SetWorldTransform(hdc, &final_trans);
         ERR("World transform failed!\n");
     }
 }
@@ -1140,9 +1139,9 @@ BOOL WINAPI PlayEnhMetaFileRecord(
        rc.top = pExtTextOutA->emrtext.rcl.top;
        rc.right = pExtTextOutA->emrtext.rcl.right;
        rc.bottom = pExtTextOutA->emrtext.rcl.bottom;
-        TRACE("EMR_EXTTEXTOUTA: x,y = %d, %d. rect = %d, %d - %d, %d. flags %08x\n",
+        TRACE("EMR_EXTTEXTOUTA: x,y = %d, %d. rect = %s. flags %08x\n",
               pExtTextOutA->emrtext.ptlReference.x, pExtTextOutA->emrtext.ptlReference.y,
-              rc.left, rc.top, rc.right, rc.bottom, pExtTextOutA->emrtext.fOptions);
+              wine_dbgstr_rect(&rc), pExtTextOutA->emrtext.fOptions);
 
         old_mode = SetGraphicsMode(hdc, pExtTextOutA->iGraphicsMode);
         /* Reselect the font back into the dc so that the transformation
@@ -1176,9 +1175,9 @@ BOOL WINAPI PlayEnhMetaFileRecord(
        rc.top = pExtTextOutW->emrtext.rcl.top;
        rc.right = pExtTextOutW->emrtext.rcl.right;
        rc.bottom = pExtTextOutW->emrtext.rcl.bottom;
-        TRACE("EMR_EXTTEXTOUTW: x,y = %d, %d.  rect = %d, %d - %d, %d. flags %08x\n",
+        TRACE("EMR_EXTTEXTOUTW: x,y = %d, %d.  rect = %s. flags %08x\n",
               pExtTextOutW->emrtext.ptlReference.x, pExtTextOutW->emrtext.ptlReference.y,
-              rc.left, rc.top, rc.right, rc.bottom, pExtTextOutW->emrtext.fOptions);
+              wine_dbgstr_rect(&rc), pExtTextOutW->emrtext.fOptions);
 
         old_mode = SetGraphicsMode(hdc, pExtTextOutW->iGraphicsMode);
         /* Reselect the font back into the dc so that the transformation
@@ -1232,13 +1231,18 @@ BOOL WINAPI PlayEnhMetaFileRecord(
     case EMR_EXTSELECTCLIPRGN:
       {
        const EMREXTSELECTCLIPRGN *lpRgn = (const EMREXTSELECTCLIPRGN *)mr;
+#ifdef __REACTOS__
        const RGNDATA *pRgnData = (const RGNDATA *)lpRgn->RgnData;
        DWORD dwSize = sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount * sizeof(RECT);
+#endif
        HRGN hRgn = 0;
 
         if (mr->nSize >= sizeof(*lpRgn) + sizeof(RGNDATAHEADER))
+#ifdef __REACTOS__
             hRgn = ExtCreateRegion( &info->init_transform, dwSize, pRgnData );
-
+#else
+            hRgn = ExtCreateRegion( &info->init_transform, 0, (const RGNDATA *)lpRgn->RgnData );
+#endif
        ExtSelectClipRgn(hdc, hRgn, (INT)(lpRgn->iMode));
        /* ExtSelectClipRgn created a copy of the region */
        DeleteObject(hRgn);
@@ -1824,6 +1828,7 @@ BOOL WINAPI PlayEnhMetaFileRecord(
             HBITMAP hBmp = 0, hBmpOld = 0;
             const BITMAPINFO *pbi = (const BITMAPINFO *)((const BYTE *)mr + pBitBlt->offBmiSrc);
 
+            SetGraphicsMode(hdcSrc, GM_ADVANCED);
             SetWorldTransform(hdcSrc, &pBitBlt->xformSrc);
 
             hBrush = CreateSolidBrush(pBitBlt->crBkColorSrc);
@@ -1866,6 +1871,7 @@ BOOL WINAPI PlayEnhMetaFileRecord(
             HBITMAP hBmp = 0, hBmpOld = 0;
             const BITMAPINFO *pbi = (const BITMAPINFO *)((const BYTE *)mr + pStretchBlt->offBmiSrc);
 
+            SetGraphicsMode(hdcSrc, GM_ADVANCED);
             SetWorldTransform(hdcSrc, &pStretchBlt->xformSrc);
 
             hBrush = CreateSolidBrush(pStretchBlt->crBkColorSrc);
@@ -1908,6 +1914,7 @@ BOOL WINAPI PlayEnhMetaFileRecord(
             const BITMAPINFO *pbi = (const BITMAPINFO *)((const BYTE *)mr + pAlphaBlend->offBmiSrc);
             void *bits;
 
+            SetGraphicsMode(hdcSrc, GM_ADVANCED);
             SetWorldTransform(hdcSrc, &pAlphaBlend->xformSrc);
 
             hBmp = CreateDIBSection(hdc, pbi, pAlphaBlend->iUsageSrc, &bits, NULL, 0);
@@ -1933,6 +1940,7 @@ BOOL WINAPI PlayEnhMetaFileRecord(
        HBITMAP hBmp, hBmpOld, hBmpMask;
        const BITMAPINFO *pbi;
 
+        SetGraphicsMode(hdcSrc, GM_ADVANCED);
        SetWorldTransform(hdcSrc, &pMaskBlt->xformSrc);
 
        hBrush = CreateSolidBrush(pMaskBlt->crBkColorSrc);
@@ -1981,6 +1989,7 @@ BOOL WINAPI PlayEnhMetaFileRecord(
        const BITMAPINFO *pbi;
        POINT pts[3];
 
+        SetGraphicsMode(hdcSrc, GM_ADVANCED);
        SetWorldTransform(hdcSrc, &pPlgBlt->xformSrc);
 
        pts[0].x = pPlgBlt->aptlDest[0].x; pts[0].y = pPlgBlt->aptlDest[0].y;
@@ -2179,6 +2188,14 @@ BOOL WINAPI PlayEnhMetaFileRecord(
        break;
     }
 
+    case EMR_GRADIENTFILL:
+    {
+        EMRGRADIENTFILL *grad = (EMRGRADIENTFILL *)mr;
+        GdiGradientFill( hdc, grad->Ver, grad->nVer, grad->Ver + grad->nVer,
+                         grad->nTri, grad->ulMode );
+        break;
+    }
+
     case EMR_POLYDRAW16:
     case EMR_GLSRECORD:
     case EMR_GLSBOUNDEDRECORD:
@@ -2192,7 +2209,6 @@ BOOL WINAPI PlayEnhMetaFileRecord(
     case EMR_SETICMPROFILEA:
     case EMR_SETICMPROFILEW:
     case EMR_TRANSPARENTBLT:
-    case EMR_GRADIENTFILL:
     case EMR_SETLINKEDUFI:
     case EMR_COLORMATCHTOTARGETW:
     case EMR_CREATECOLORSPACEW:
@@ -2206,8 +2222,7 @@ BOOL WINAPI PlayEnhMetaFileRecord(
   tmprc.left = tmprc.top = 0;
   tmprc.right = tmprc.bottom = 1000;
   LPtoDP(hdc, (POINT*)&tmprc, 2);
-  TRACE("L:0,0 - 1000,1000 -> D:%d,%d - %d,%d\n", tmprc.left,
-       tmprc.top, tmprc.right, tmprc.bottom);
+  TRACE("L:0,0 - 1000,1000 -> D:%s\n", wine_dbgstr_rect(&tmprc));
 
   return TRUE;
 }
@@ -2375,8 +2390,7 @@ BOOL WINAPI EnumEnhMetaFile(
             double xSrcPixSize, ySrcPixSize, xscale, yscale;
             XFORM xform;
 
-            TRACE("rect: %d,%d - %d,%d. rclFrame: %d,%d - %d,%d\n",
-               lpRect->left, lpRect->top, lpRect->right, lpRect->bottom,
+            TRACE("rect: %s. rclFrame: (%d,%d)-(%d,%d)\n", wine_dbgstr_rect(lpRect),
                emh->rclFrame.left, emh->rclFrame.top, emh->rclFrame.right,
                emh->rclFrame.bottom);