summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2013-12-19 14:47:50 +0100
committerJan Holesovsky <kendy@collabora.com>2013-12-19 14:53:18 +0100
commit6b5cac1ca06a052061d2fe6acff1bc1e3cb45d57 (patch)
tree6fe56be484db4d0ab1bfa3e142b08564b2ad4660
parent7590adfa18c671193f2e5497545f2f4cd62039bc (diff)
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
-rw-r--r--include/vcl/outdev.hxx1
-rw-r--r--vcl/source/gdi/outdev.cxx1
-rw-r--r--vcl/source/gdi/outdev3.cxx7
-rw-r--r--vcl/source/gdi/virdev.cxx2
-rw-r--r--vcl/source/window/window.cxx5
5 files changed, 13 insertions, 3 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index b0d5089743e2..78f768e29b1f 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 b6f894583799..8009275f24da 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 36c7203064ed..850f63a10925 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 54d40f300f5a..4ef472047e02 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 78995af16b6b..e68966884965 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