summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2014-09-09 21:31:20 +0200
committerChris Sherlock <chris.sherlock79@gmail.com>2014-09-10 11:20:25 +0000
commita2d4bd6864e108a11d6ca2b69de5ebce265102dc (patch)
tree762032d216b4119b42a7cbe510d91eb5689f74ed
parent74458301569bc9c0e7619e68be85e716d7b6f9f7 (diff)
Refactor DPI settings validity check
Move the validity check for the DPI (>= 50 and <= 500) into its own (static) function, since we're going to use it repeatedly in the fallback DPI detection code. Change-Id: Id5d9b10be385d45549bbb57cfa14939cd51a0324 Reviewed-on: https://gerrit.libreoffice.org/11376 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
-rw-r--r--vcl/unx/generic/app/saldisp.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 5de927c52c15..7c97a2485482 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -120,6 +120,12 @@ static int sal_significantBits( Pixel nMask )
return nBits;
}
+// check if the resolution is sane
+static bool sal_ValidDPI(long nDPI)
+{
+ return (nDPI >= 50) && (nDPI <= 500);
+}
+
static bool sal_GetVisualInfo( Display *pDisplay, XID nVID, XVisualInfo &rVI )
{
int nInfos;
@@ -555,7 +561,7 @@ void SalDisplay::Init()
const OString aValStr( pValStr );
const long nDPI = (long) aValStr.toDouble();
// guard against insane resolution
- if( (nDPI >= 50) && (nDPI <= 500) )
+ if( sal_ValidDPI(nDPI) )
{
aResolution_ = Pair( nDPI, nDPI );
bExactResolution = true;