summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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