Huw Davies : gdi32: Only reselect the objects if the linear transform portion changes.

Alexandre Julliard julliard at winehq.org
Mon Aug 1 16:48:57 CDT 2016


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Mon Aug  1 09:43:18 2016 +0100

gdi32: Only reselect the objects if the linear transform portion changes.

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

---

 dlls/gdi32/dc.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 92a98df..27e89ae 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -325,6 +325,17 @@ static void construct_window_to_viewport(DC *dc, XFORM *xform)
 }
 
 /***********************************************************************
+ *        linear_xform_cmp
+ *
+ * Compares the linear transform portion of two XFORMs (i.e. the 2x2 submatrix).
+ * Returns 0 if they match.
+ */
+static inline int linear_xform_cmp( const XFORM *a, const XFORM *b )
+{
+    return memcmp( a, b, FIELD_OFFSET( XFORM, eDx ) );
+}
+
+/***********************************************************************
  *           DC_UpdateXforms
  *
  * Updates the xformWorld2Vport, xformVport2World and vport2WorldValid
@@ -351,7 +362,7 @@ void DC_UpdateXforms( DC *dc )
 
     /* Reselect the font and pen back into the dc so that the size
        gets updated. */
-    if (memcmp(&oldworld2vport, &dc->xformWorld2Vport, sizeof(oldworld2vport)) &&
+    if (linear_xform_cmp( &oldworld2vport, &dc->xformWorld2Vport ) &&
         !GdiIsMetaFileDC(dc->hSelf))
     {
         SelectObject(dc->hSelf, dc->hFont);




More information about the wine-cvs mailing list