File 0001-wineps.drv-Fix-bug-applying-transform-matrixes-twice.patch of Package wine

From eefbf9d7ef0bf0d5840c15d92029bd9f6ea8e973 Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker@freenet.de>
Date: Thu, 11 Sep 2014 15:37:38 +0200
Subject: [PATCH] wineps.drv: Fix bug applying transform matrixes twice in case
 gdi uses null driver drawing functions.

---
 dlls/gdi32/dc.c          | 7 +++++++
 dlls/gdi32/gdi_private.h | 1 +
 dlls/wineps.drv/init.c   | 2 ++
 dlls/wineps.drv/ps.c     | 3 +++
 4 files changed, 13 insertions(+)

diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 67e5704..93162c9 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -116,6 +116,7 @@ static void set_initial_dc_state( DC *dc )
     dc->xformWorld2Vport    = dc->xformWorld2Wnd;
     dc->xformVport2World    = dc->xformWorld2Wnd;
     dc->vport2WorldValid    = TRUE;
+    dc->disableTransform    = 0;
 
     reset_bounds( &dc->bounds );
 }
@@ -338,6 +339,10 @@ void DC_UpdateXforms( DC *dc )
 {
     XFORM xformWnd2Vport, oldworld2vport;
 
+    if (dc->disableTransform) {
+      TRACE("dc=%p disabled\n", dc);
+      return;
+    }
     construct_window_to_viewport(dc, &xformWnd2Vport);
 
     oldworld2vport = dc->xformWorld2Vport;
@@ -413,6 +413,7 @@
     newdc->xformWorld2Vport = dc->xformWorld2Vport;
     newdc->xformVport2World = dc->xformVport2World;
     newdc->vport2WorldValid = dc->vport2WorldValid;
+    newdc->disableTransform = dc->disableTransform;
     newdc->wnd_org          = dc->wnd_org;
     newdc->wnd_ext          = dc->wnd_ext;
     newdc->vport_org        = dc->vport_org;
@@ -490,6 +491,7 @@
     dc->xformWorld2Vport = dcs->xformWorld2Vport;
     dc->xformVport2World = dcs->xformVport2World;
     dc->vport2WorldValid = dcs->vport2WorldValid;
+    dc->disableTransform = dcs->disableTransform;
     dc->wnd_org          = dcs->wnd_org;
     dc->wnd_ext          = dcs->wnd_ext;
     dc->vport_org        = dcs->vport_org;
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index edd4bf6..2f73e9a 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -132,6 +132,7 @@ typedef struct tagDC
     XFORM         xformVport2World;  /* Inverse of the above transformation */
     BOOL          vport2WorldValid;  /* Is xformVport2World valid? */
     RECT          bounds;            /* Current bounding rect */
+    INT           disableTransform;
 } DC;
 
 /* Certain functions will do no further processing if the driver returns this.
diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c
index d6f79df..2f53b60 100644
--- a/dlls/wineps.drv/init.c
+++ b/dlls/wineps.drv/init.c
@@ -419,6 +419,8 @@ static BOOL PSDRV_CreateDC( PHYSDEV *pdev, LPCWSTR driver, LPCWSTR device,
     PSDRV_UpdateDevCaps(physDev);
     SelectObject( (*pdev)->hdc, PSDRV_DefaultFont );
     push_dc_driver( pdev, &physDev->dev, &psdrv_funcs );
+
+    // we need to set dc's disableTransform, which is performed in PSDRV_SetWorldTransform and PSDRV_ModifyWorldTransform
     return TRUE;
 }
 
diff --git a/dlls/wineps.drv/ps.c b/dlls/wineps.drv/ps.c
index fa53edd..4b34358 100644
--- a/dlls/wineps.drv/ps.c
+++ b/dlls/wineps.drv/ps.c
@@ -523,6 +523,8 @@ BOOL PSDRV_SetWorldTransform( PHYSDEV dev, const XFORM *xform )
     PHYSDEV nulldrv = find_null_driver( dev );
     DC *dc = _get_nulldrv_dc( nulldrv );
     dc->xformWorld2Wnd = *xform;
+    // we assume that vport2world and world2vport are identity matrixes
+    dc->disableTransform = 1;
     return TRUE;
 }
 
@@ -531,6 +533,7 @@ BOOL PSDRV_WriteWorldTransform( PHYSDEV dev )
     PHYSDEV nulldrv = find_null_driver( dev );
     DC *dc = _get_nulldrv_dc( nulldrv );
     char *buf;
+    dc->disableTransform = 1;
 
     XFORM *xform  = &dc->xformWorld2Wnd;
 
-- 
1.8.4.5
openSUSE Build Service is sponsored by