summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-03-06 18:39:51 +0100
committerNorbert Thiebaud <nthiebaud@gmail.com>2014-03-12 13:02:13 -0500
commit52cb1085edc66995393d5be5a55cb45b73a95292 (patch)
treee85a1a48ca14167afb0defeaa4090e98d3c23235
parent36abce8d4e0c3ebef609fc4cea094b953c5082dc (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 Reviewed-on: https://gerrit.libreoffice.org/8516 Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
-rw-r--r--include/vcl/outdev.hxx1
-rw-r--r--vcl/source/gdi/outdev.cxx1
-rw-r--r--vcl/source/gdi/virdev.cxx2
-rw-r--r--vcl/source/window/window.cxx8
4 files changed, 12 insertions, 0 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 047a79d46789..1bd07a271e36 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 b777dbe055af..f8ec8723c410 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -349,6 +349,7 @@ OutputDevice::OutputDevice() :
mnOutHeight = 0;
mnDPIX = 0;
mnDPIY = 0;
+ mnDPIScaleFactor = 1;
mnTextOffX = 0;
mnTextOffY = 0;
mnOutOffOrigX = 0;
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 4ef94b9ce462..0e9d3161e7a5 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 60a14f18a972..f1cab6645536 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -982,6 +982,9 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste
}
+ // setup the scale factor for Hi-DPI displays
+ mnDPIScaleFactor = std::max((sal_Int32)1, (mpWindowImpl->mpFrameData->mnDPIY + 48) / 96);
+
const StyleSettings& rStyleSettings = maSettings.GetStyleSettings();
sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom();
mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100;
@@ -1718,12 +1721,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