[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - vcl/source

Jan Holesovsky kendy at collabora.com
Wed Mar 12 11:03:29 PDT 2014


 vcl/source/gdi/outdev3.cxx |   29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

New commits:
commit ab2739b37d8c331aa5ed26346c7e29199a369571
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Mar 6 18:40:36 2014 +0100

    hidpi: Nicer painting of the waved lines.
    
    Change-Id: I8773b47967bc1aa8cf33b9a1edc4f826291d3554
    Reviewed-on: https://gerrit.libreoffice.org/8518
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index afe06f7..d97b71b 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -419,6 +419,7 @@ static void ImplFontSubstitute( OUString& rFontName,
     }
 }
 
+//hidpi TODO: This routine has hard-coded font-sizes that break places such as DialControl
 Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang,
                                    sal_uLong nFlags, const OutputDevice* pOutDev )
 {
@@ -5339,11 +5340,24 @@ void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos,
     }
 
     long nWaveHeight;
+
     if ( nStyle == WAVE_NORMAL )
     {
         nWaveHeight = 3;
         nStartY++;
         nEndY++;
+
+        if (mnDPIScaleFactor > 1)
+        {
+            nWaveHeight *= mnDPIScaleFactor;
+
+            // odd heights look better than even
+            if (mnDPIScaleFactor % 2 == 0)
+            {
+                nStartY++; // Shift down an additional pixel to create more visual separation.
+                nWaveHeight--;
+            }
+        }
     }
     else if( nStyle == WAVE_SMALL )
     {
@@ -5354,14 +5368,15 @@ void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos,
     else // WAVE_FLAT
         nWaveHeight = 1;
 
-     // #109280# make sure the waveline does not exceed the descent to avoid paint problems
-     ImplFontEntry* pFontEntry = mpFontEntry;
-     if( nWaveHeight > pFontEntry->maMetric.mnWUnderlineSize )
-         nWaveHeight = pFontEntry->maMetric.mnWUnderlineSize;
+    // #109280# make sure the waveline does not exceed the descent to avoid paint problems
+    ImplFontEntry* pFontEntry = mpFontEntry;
+    if( nWaveHeight > pFontEntry->maMetric.mnWUnderlineSize )
+        nWaveHeight = pFontEntry->maMetric.mnWUnderlineSize;
+
+    ImplDrawWaveLine(nStartX, nStartY, 0, 0,
+            nEndX-nStartX, nWaveHeight,
+            mnDPIScaleFactor, nOrientation, GetLineColor());
 
-     ImplDrawWaveLine( nStartX, nStartY, 0, 0,
-                      nEndX-nStartX, nWaveHeight, 1,
-                      nOrientation, GetLineColor() );
     if( mpAlphaVDev )
         mpAlphaVDev->DrawWaveLine( rStartPos, rEndPos, nStyle );
 }


More information about the Libreoffice-commits mailing list