font: don't reselect too often

Huw D M Davies h.davies1 at physics.ox.ac.uk
Mon Nov 10 11:01:38 CST 2003


        Huw Davies <huw at codeweavers.com>
        Only reselect the font if the transformation has actually changed.
-- 
Huw Davies
huw at codeweavers.com
Index: objects/dc.c
===================================================================
RCS file: /home/wine/wine/objects/dc.c,v
retrieving revision 1.103
diff -u -r1.103 dc.c
--- objects/dc.c	5 Nov 2003 23:25:37 -0000	1.103
+++ objects/dc.c	10 Nov 2003 16:59:57 -0000
@@ -242,7 +242,7 @@
  */
 void DC_UpdateXforms( DC *dc )
 {
-    XFORM xformWnd2Vport;
+    XFORM xformWnd2Vport, oldworld2vport;
     FLOAT scaleX, scaleY;
 
     /* Construct a transformation to do the window-to-viewport conversion */
@@ -257,6 +257,7 @@
     xformWnd2Vport.eDy  = (FLOAT)dc->vportOrgY -
         scaleY * (FLOAT)dc->wndOrgY;
 
+    oldworld2vport = dc->xformWorld2Vport;
     /* Combine with the world transformation */
     CombineTransform( &dc->xformWorld2Vport, &dc->xformWorld2Wnd,
         &xformWnd2Vport );
@@ -267,7 +268,8 @@
 
     /* Reselect the font back into the dc so that the font size
        gets updated. */
-    SelectObject(dc->hSelf, GetCurrentObject(dc->hSelf, OBJ_FONT));
+    if(memcmp(&oldworld2vport, &dc->xformWorld2Vport, sizeof(oldworld2vport)))
+        SelectObject(dc->hSelf, GetCurrentObject(dc->hSelf, OBJ_FONT));
 }
 
 



More information about the wine-patches mailing list