vcl/unx/generic/app/saldisp.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
New commits: commit a2d4bd6864e108a11d6ca2b69de5ebce265102dc Author: Giuseppe Bilotta <giuseppe.bilo...@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.sherloc...@gmail.com> Tested-by: Chris Sherlock <chris.sherloc...@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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits