[Libreoffice-commits] core.git: sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Fri Jan 16 14:56:26 PST 2015


 sc/source/ui/view/gridwin4.cxx |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 88562ee6e352b5446bb55e906e8f1c2f34035a49
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Jan 16 17:45:52 2015 -0500

    Get texts to scale correctly with zoom.
    
    We need to set scaling factors to device's map mode *only* for the texts.
    Calc handles scaling for all the rest.  Interesting how it works.
    
    Change-Id: Ia6aa122961ea5ddc2e31eacb28392f3e355a5ebf

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index a8abe26..5e364c2 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -935,10 +935,20 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
     aOutData.DrawShadow();
     aOutData.DrawFrame();
 
-    // TODO : Scaling of strings is incorrect.  Find out why.
+    // Set scaling to map mode only for text rendering, to get texts to scale
+    // correctly.
+    MapMode aOldMapMode = rDevice.GetMapMode();
+    MapMode aNewMapMode = aOldMapMode;
+    aNewMapMode.SetScaleX(aFracX);
+    aNewMapMode.SetScaleY(aFracY);
+    rDevice.SetMapMode(aNewMapMode);
+
     aOutData.DrawStrings(true);
+
     // TODO : Edit texts don't get rendered at all.  Fix this.
     aOutData.DrawEdit(true);
+
+    rDevice.SetMapMode(aOldMapMode);
 }
 
 void ScGridWindow::CheckNeedsRepaint()


More information about the Libreoffice-commits mailing list