summaryrefslogtreecommitdiff
path: root/vcl/source/outdev
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2016-10-28 23:24:30 +0200
committerTomaž Vajngerl <quikee@gmail.com>2016-10-29 21:47:41 +0000
commit69b6ab1f8de08b3418fd42d56076a73d40a29229 (patch)
treeb9d3ced7be6ab7c70388a91cd8b56b68d3651d07 /vcl/source/outdev
parenta86144696df87cd81795e071a30b74af127c7948 (diff)
tdf#100164 change scaling unit to precentage for *.5x factors
Currently we support DPI scaling by a integer factor. This commit changes that to percentage so we can have scaling factors like 1.5x or 1.25x. This is useful with 2.7k monitors that are in between standard DPI and HiDPI. Thresholding was adjusted to scale to 1.5x when DPI is between 120 and 168 DPI. The old method GetDPIScaleFactor has been changed to return a float value insted of int. Sometimes it is however more accurate to use GetDPIScalePercentage which was added in this commit. Change-Id: Iaecee793ff3d5084d00adeebbcf5d7368c580882 Reviewed-on: https://gerrit.libreoffice.org/30379 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source/outdev')
-rw-r--r--vcl/source/outdev/outdev.cxx2
-rw-r--r--vcl/source/outdev/textline.cxx16
2 files changed, 9 insertions, 9 deletions
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 8555f5cd12d4..5cb45be03b09 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -68,7 +68,7 @@ OutputDevice::OutputDevice() :
mnOutHeight = 0;
mnDPIX = 0;
mnDPIY = 0;
- mnDPIScaleFactor = 1;
+ mnDPIScalePercentage = 100;
mnTextOffX = 0;
mnTextOffY = 0;
mnOutOffOrigX = 0;
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index cdf40b3d6d2a..d742e8fcf098 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -1017,20 +1017,20 @@ void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos )
aStartPt.RotateAround( nEndX, nEndY, -nOrientation );
}
- long nWaveHeight;
-
- nWaveHeight = 3;
+ long nWaveHeight = 3;
nStartY++;
nEndY++;
- if (mnDPIScaleFactor > 1)
+ float fScaleFactor = GetDPIScaleFactor();
+
+ if (fScaleFactor > 1.0f)
{
- nWaveHeight *= mnDPIScaleFactor;
+ nWaveHeight *= fScaleFactor;
- nStartY += mnDPIScaleFactor - 1; // Shift down additional pixel(s) to create more visual separation.
+ nStartY += fScaleFactor - 1; // Shift down additional pixel(s) to create more visual separation.
// odd heights look better than even
- if (mnDPIScaleFactor % 2 == 0)
+ if (nWaveHeight % 2 == 0)
{
nWaveHeight--;
}
@@ -1044,7 +1044,7 @@ void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos )
}
ImplDrawWaveLine(nStartX, nStartY, 0, 0,
nEndX-nStartX, nWaveHeight,
- mnDPIScaleFactor, nOrientation, GetLineColor());
+ fScaleFactor, nOrientation, GetLineColor());
if( mpAlphaVDev )
mpAlphaVDev->DrawWaveLine( rStartPos, rEndPos );