[Libreoffice-commits] core.git: vcl/unx
Giuseppe Bilotta
giuseppe.bilotta at gmail.com
Wed Sep 10 04:20:52 PDT 2014
vcl/unx/generic/app/saldisp.cxx | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
New commits:
commit a2d4bd6864e108a11d6ca2b69de5ebce265102dc
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date: Tue Sep 9 21:31:20 2014 +0200
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 at gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79 at gmail.com>
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 5de927c..7c97a24 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;
More information about the Libreoffice-commits
mailing list