include/vcl/outdev.hxx       |    1 +
 vcl/source/gdi/outdev.cxx    |    1 +
 vcl/source/gdi/outdev3.cxx   |    7 ++++---
 vcl/source/gdi/virdev.cxx    |    2 ++
 vcl/source/window/window.cxx |    5 +++++
 5 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 6b5cac1ca06a052061d2fe6acff1bc1e3cb45d57
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Thu Dec 19 14:47:50 2013 +0100

    Introduce DPI scale factor for Hi-DPI displays.
    
    This is supposed to stay 1 (no scale) for printers and default virtual
    devices, but should be set accordingly (2 or 3) for windows and virtual
    devices derived from windows.
    
    Various VCL widgets or paint operations should incrementally become aware of
    this, and changed so that they draw nicely on the Hi-DPI displays.  This 
patch
    only introduces the behavior for waved lines.
    
    The default is currently being set depending on the DPI setting only; could 
be
    changed to a more clever way if necessary.
    
    Change-Id: I71118f9ab6b64028d1eeee76e860e999d5cd9d19

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index b0d5089..78f768e 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -310,6 +310,7 @@ private:
     long                mnOutHeight;
     sal_Int32           mnDPIX;
     sal_Int32           mnDPIY;
+    sal_Int32           mnDPIScaleFactor; ///< For Hi-DPI displays, we want to 
draw everything mnDPIScaleFactor-times larger
     /// font specific text alignment offsets in pixel units
     mutable long        mnTextOffX;
     mutable long        mnTextOffY;
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index b6f8945..8009275 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -344,6 +344,7 @@ OutputDevice::OutputDevice() :
     mnOutHeight         = 0;
     mnDPIX              = 0;
     mnDPIY              = 0;
+    mnDPIScaleFactor    = 1;
     mnTextOffX          = 0;
     mnTextOffY          = 0;
     mnOutOffOrigX       = 0;
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 36c72030..850f63a 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -5319,9 +5319,10 @@ void OutputDevice::DrawWaveLine( const Point& rStartPos, 
const Point& rEndPos,
      if( nWaveHeight > pFontEntry->maMetric.mnWUnderlineSize )
          nWaveHeight = pFontEntry->maMetric.mnWUnderlineSize;
 
-     ImplDrawWaveLine( nStartX, nStartY, 0, 0,
-                      nEndX-nStartX, nWaveHeight, 1,
-                      nOrientation, GetLineColor() );
+    ImplDrawWaveLine(nStartX, nStartY, 0, 0,
+            nEndX-nStartX, nWaveHeight * mnDPIScaleFactor,
+            mnDPIScaleFactor, nOrientation, GetLineColor());
+
     if( mpAlphaVDev )
         mpAlphaVDev->DrawWaveLine( rStartPos, rEndPos, nStyle );
 }
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 54d40f3..4ef4720 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -97,6 +97,7 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* 
pOutDev,
     mpFontCache     = pSVData->maGDIData.mpScreenFontCache;
     mnDPIX          = pOutDev->mnDPIX;
     mnDPIY          = pOutDev->mnDPIY;
+    mnDPIScaleFactor = pOutDev->mnDPIScaleFactor;
     maFont          = pOutDev->maFont;
 
     if( maTextColor != pOutDev->maTextColor )
@@ -406,6 +407,7 @@ void VirtualDevice::ImplSetReferenceDevice( RefDevMode 
i_eRefDevMode, sal_Int32
 {
     mnDPIX = i_nDPIX;
     mnDPIY = i_nDPIY;
+    mnDPIScaleFactor = 1;
 
     EnableOutput( sal_False );  // prevent output on reference device
     mbScreenComp = sal_False;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 78995af..e689668 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1711,12 +1711,17 @@ void Window::ImplInitResolutionSettings()
         sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom();
         mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100;
         mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100;
+
+        // setup the scale factor for Hi-DPI displays
+        mnDPIScaleFactor = std::max(1, (mpWindowImpl->mpFrameData->mnDPIY + 
48) / 96);
+
         SetPointFont( rStyleSettings.GetAppFont() );
     }
     else if ( mpWindowImpl->mpParent )
     {
         mnDPIX  = mpWindowImpl->mpParent->mnDPIX;
         mnDPIY  = mpWindowImpl->mpParent->mnDPIY;
+        mnDPIScaleFactor = mpWindowImpl->mpParent->mnDPIScaleFactor;
     }
 
     // update the recalculated values for logical units
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to