Piotr Caban : gdi32/enhmfdrv: Don't drop viewport/ window transformation in StretchBlt.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Apr 22 09:55:13 CDT 2016


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Apr 21 17:41:21 2016 +0200

gdi32/enhmfdrv: Don't drop viewport/window transformation in StretchBlt.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/enhmfdrv/bitblt.c |  2 +-
 dlls/gdi32/tests/metafile.c  | 60 ++++++++++++++++++++++++++++++++++++--------
 2 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/dlls/gdi32/enhmfdrv/bitblt.c b/dlls/gdi32/enhmfdrv/bitblt.c
index d6d0fe7..ed03c1f 100644
--- a/dlls/gdi32/enhmfdrv/bitblt.c
+++ b/dlls/gdi32/enhmfdrv/bitblt.c
@@ -122,7 +122,7 @@ BOOL EMFDRV_StretchBlt( PHYSDEV devDst, struct bitblt_coords *dst,
     pEMR->dwRop = rop;
     pEMR->xSrc = src->log_x;
     pEMR->ySrc = src->log_y;
-    GetWorldTransform(devSrc->hdc, &pEMR->xformSrc);
+    GetTransform(devSrc->hdc, 0x204, &pEMR->xformSrc);
     pEMR->crBkColorSrc = GetBkColor(devSrc->hdc);
     pEMR->iUsageSrc = DIB_RGB_COLORS;
     pEMR->offBmiSrc = emrSize;
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index b9e7522..c77112d 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -989,7 +989,7 @@ static void test_mf_SaveDC(void)
 /* with the nominal results. */
 
 /* Maximum size of sample metafiles in bytes. */
-#define MF_BUFSIZE 512
+#define MF_BUFSIZE 1024
 
 /* 8x8 bitmap data for a pattern brush */
 static const unsigned char SAMPLE_PATTERN_BRUSH[] = {
@@ -1231,16 +1231,16 @@ static const unsigned char EMF_BITBLT[] =
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x6a, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00,
+    0x4f, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00,
     0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
-    0xa0, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+    0x64, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
     0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x23, 0x04, 0x00, 0x00, 0x3b, 0x02, 0x00, 0x00,
-    0x75, 0x01, 0x00, 0x00, 0xc9, 0x00, 0x00, 0x00,
+    0x80, 0x07, 0x00, 0x00, 0xb0, 0x04, 0x00, 0x00,
+    0xfc, 0x01, 0x00, 0x00, 0x3e, 0x01, 0x00, 0x00,
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x08, 0xb1, 0x05, 0x00,
-    0x28, 0x11, 0x03, 0x00, 0x4c, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x07, 0x00,
+    0x30, 0xda, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00,
     0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
     0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1276,9 +1276,34 @@ static const unsigned char EMF_BITBLT[] =
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
-    0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
+    0x00, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00,
+    0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+    0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+    0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0xcc, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x0a, 0xd7, 0xa3, 0x3b, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0x23, 0x3c,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x6c, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
+    0x94, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+    0x90, 0x01, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00,
+    0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+    0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+    0x14, 0x00, 0x00, 0x00
 };
 
 static const unsigned char EMF_DCBRUSH_BITS[] =
@@ -1858,6 +1883,7 @@ static void test_emf_BitBlt(void)
         0,      /* biClrImportant */
     };
     void *bits;
+    XFORM xform;
     BOOL ret;
 
     hdcDisplay = CreateDCA("DISPLAY", NULL, NULL, NULL);
@@ -1865,6 +1891,7 @@ static void test_emf_BitBlt(void)
 
     hdcBitmap = CreateCompatibleDC(hdcDisplay);
     ok( hdcBitmap != 0, "CreateCompatibleDC failed\n" );
+    ok(SetGraphicsMode(hdcBitmap, GM_ADVANCED), "SetGraphicsMode failed\n");
     bmih.biXPelsPerMeter = MulDiv(GetDeviceCaps(hdcDisplay, LOGPIXELSX), 100, 3937);
     bmih.biYPelsPerMeter = MulDiv(GetDeviceCaps(hdcDisplay, LOGPIXELSY), 100, 3937);
     hBitmap = CreateDIBSection(hdcDisplay, (const BITMAPINFO *)&bmih,
@@ -1883,6 +1910,19 @@ static void test_emf_BitBlt(void)
     ret = BitBlt(hdcMetafile, 0, 0, BMP_DIM, BMP_DIM, 0, 0, 0, WHITENESS);
     ok( ret, "BitBlt(WHITENESS) failed\n" );
 
+    ok(SetMapMode(hdcBitmap, MM_ANISOTROPIC), "SetMapMode failed\n");
+    ok(SetWindowOrgEx(hdcBitmap, 0, 0, NULL), "SetWindowOrgEx failed\n");
+    ok(SetWindowExtEx(hdcBitmap, 400, 400, NULL), "SetWindowExtEx failed\n");
+    ok(SetViewportOrgEx(hdcBitmap, 0, 0, NULL), "SetViewportOrgEx failed\n");
+    ok(SetViewportExtEx(hdcBitmap, BMP_DIM, BMP_DIM, NULL), "SetViewportExtEx failed\n");
+    memset(&xform, 0, sizeof(xform));
+    xform.eM11 = 0.5;
+    xform.eM22 = 1.0;
+    ok(SetWorldTransform(hdcBitmap, &xform), "SetWorldTransform failed\n");
+
+    ret = StretchBlt(hdcMetafile, 0, 0, BMP_DIM, BMP_DIM, hdcBitmap, 0, 0, 400, 400, SRCCOPY);
+    ok( ret, "StretchBlt(SRCCOPY) failed\n" );
+
     hMetafile = CloseEnhMetaFile(hdcMetafile);
     ok( hMetafile != 0, "CloseEnhMetaFile failed\n" );
 




More information about the wine-cvs mailing list