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

dbeurle dbeurle at student.unimelb.edu.au
Mon Jan 19 00:12:21 PST 2015


 svtools/source/control/ruler.cxx |   29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

New commits:
commit 0a612a5c5c2982bccfe0cd6c5a3bba8d9107e043
Author: dbeurle <dbeurle at student.unimelb.edu.au>
Date:   Mon Jan 19 09:47:29 2015 +1100

    Ruler ticks spacing consistent with lowDPI monitors.  Draw ticks with width
    
    Change-Id: Id636fa87ac7fd4a8c33d65bd72822768bc94b592
    Reviewed-on: https://gerrit.libreoffice.org/13987
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    Tested-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 96b6aa0..e97386c 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -463,13 +463,16 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
 {
     double nCenter = nTop + ((nBottom - nTop) / 2);
 
-    long nTickLength3 = (nBottom - nTop) * 0.5 * ruler_tab.DPIScaleFactor;
+    long nTickLength3 = (nBottom - nTop) * 0.5;
     long nTickLength2 = nTickLength3 * 0.66;
     long nTickLength1 = nTickLength2 * 0.66;
 
+    long nScale = ruler_tab.DPIScaleFactor;
+    long DPIOffset = nScale - 1;
+
     double nTick4 = aImplRulerUnitTab[mnUnitIndex].nTick4;
     double nTick2 = 0;
-    double nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1;
+    double nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1 / nScale;
     double nTickUnit = 0;
     long nTickWidth;
     bool bNoTicks = false;
@@ -548,7 +551,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
             else
                 nMulti += 1000;
 
-            // Overeflow - in this case don't draw ticks and exit
+            // Overflow - in this case don't draw ticks and exit
             if ( nMulti < nOldMulti )
             {
                 bNoTicks = true;
@@ -630,10 +633,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
 
                     if(nMin < nHorizontalLocation && nHorizontalLocation < nMax)
                     {
-                        ImplVDrawLine(nHorizontalLocation, nBottom, nHorizontalLocation,
-                            nBottom - 1 * ruler_tab.DPIScaleFactor);
-                        ImplVDrawLine(nHorizontalLocation, nTop,    nHorizontalLocation,
-                            nTop    + 1 * ruler_tab.DPIScaleFactor);
+                        ImplVDrawRect(nHorizontalLocation, nBottom, nHorizontalLocation + DPIOffset,
+                            nBottom - 1 * nScale);
+                        ImplVDrawRect(nHorizontalLocation, nTop,    nHorizontalLocation + DPIOffset,
+                            nTop    + 1 * nScale);
                     }
 
                     nHorizontalLocation = nStart - n;
@@ -641,10 +644,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
 
                     if(nMin < nHorizontalLocation && nHorizontalLocation < nMax)
                     {
-                        ImplVDrawLine( nHorizontalLocation, nBottom, nHorizontalLocation,
-                            nBottom - 1 * ruler_tab.DPIScaleFactor );
-                        ImplVDrawLine( nHorizontalLocation, nTop,    nHorizontalLocation,
-                            nTop    + 1 * ruler_tab.DPIScaleFactor );
+                        ImplVDrawRect( nHorizontalLocation, nBottom, nHorizontalLocation + DPIOffset,
+                            nBottom - 1 * nScale );
+                        ImplVDrawRect( nHorizontalLocation, nTop,    nHorizontalLocation + DPIOffset,
+                            nTop    + 1 * nScale );
                     }
                 }
                 // Tick/Tick2 - Output (Strokes)
@@ -673,10 +676,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
                         nT = nStart + n;
 
                         if ( nT < nMax )
-                            ImplVDrawLine( nT, nT1, nT, nT2 );
+                            ImplVDrawRect( nT, nT1, nT + DPIOffset, nT2 );
                         nT = nStart - n;
                         if ( nT > nMin )
-                            ImplVDrawLine( nT, nT1, nT, nT2 );
+                            ImplVDrawRect( nT, nT1, nT + DPIOffset, nT2 );
                     }
                 }
             }


More information about the Libreoffice-commits mailing list