diff options
author | Keith Curtis <keithcu@gmail.com> | 2014-02-21 19:21:27 -0500 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-03-05 09:10:28 -0600 |
commit | 9f308fbc02439e25f8932314a9374c205ebdbc4c (patch) | |
tree | 99c8a8e85a828f6db0879fd6a24633278ba0cef5 | |
parent | ff6f3164dfc454354bee79eac30d6cc279b8a0ec (diff) |
Simplify resolution calculation
Removed unnecessary complexity with resolutions because X in 2014 isn't
telling the truth about the size of the screen. My brand-new 13" laptop
with the latest X and everything apparently has a 33" x 18" monitor. So
if the data isn't reliable, just use 96 dpi anyway which is a very
reasonable default.
Also got rid of exact resolution member variable. LibreOffice can just
always think it has exact resolution. If it doesn't, then it just means
the code needs to be smarter, not that we need a flag about whether the
data we have is "exact" or not.
Change-Id: Ic41bdc3a82dbd1fdb6a987d6dc49adad8194ce14
Reviewed-on: https://gerrit.libreoffice.org/8166
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/inc/unx/saldisp.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/app/saldisp.cxx | 23 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salgdi.cxx | 8 |
3 files changed, 6 insertions, 27 deletions
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index 112560831065..9b98a762175d 100644 --- a/vcl/inc/unx/saldisp.hxx +++ b/vcl/inc/unx/saldisp.hxx @@ -252,7 +252,6 @@ protected: std::vector< ScreenData > m_aScreens; ScreenData m_aInvalidScreenData; Pair aResolution_; // [dpi] - bool mbExactResolution; sal_uLong nMaxRequestSize_; // [byte] srv_vendor_t meServerVendor; @@ -353,7 +352,6 @@ public: const SalVisual& GetVisual( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aVisual; } RenderEntryMap& GetRenderEntries( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aRenderData; } const Pair &GetResolution() const { return aResolution_; } - bool GetExactResolution() const { return mbExactResolution; } sal_uLong GetProperties() const { return PROPERTY_DEFAULT; } sal_uLong GetMaxRequestSize() const { return nMaxRequestSize_; } XLIB_Time GetLastUserEventTime( bool bAlwaysReget = false ) const; diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index c3435523d4c1..99060cdd5325 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -540,7 +540,7 @@ void SalDisplay::Init() int nDisplayScreens = ScreenCount( pDisp_ ); m_aScreens = std::vector<ScreenData>(nDisplayScreens); - mbExactResolution = false; + bool bExactResolution = false; /* #i15507# * Xft resolution should take precedence since * it is what modern desktops use. @@ -554,27 +554,12 @@ void SalDisplay::Init() if( (nDPI >= 50) && (nDPI <= 500) ) { aResolution_ = Pair( nDPI, nDPI ); - mbExactResolution = true; + bExactResolution = true; } } - if( mbExactResolution == false ) + if( bExactResolution == false ) { - int nDisplayWidth = DisplayWidthMM ( pDisp_, m_nXDefaultScreen.getXScreen() ); - int nDisplayHeight = DisplayHeightMM( pDisp_, m_nXDefaultScreen.getXScreen() ); - - if (nDisplayHeight == 0 || nDisplayWidth == 0) - { - aResolution_ = Pair( 96, 96 ); - SAL_WARN("vcl", "screen width/height reported as 0!, using fallback 96dpi"); - } - else - { - aResolution_ = - Pair( DPI( WidthOfScreen( DefaultScreenOfDisplay( pDisp_ ) ), - nDisplayWidth ), - DPI( HeightOfScreen( DefaultScreenOfDisplay( pDisp_ ) ), - nDisplayHeight ) ); - } + aResolution_ = Pair( 96, 96 ); } nMaxRequestSize_ = XExtendedMaxRequestSize( pDisp_ ) * 4; diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index 018f83328c48..c4b9cf924fea 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -484,12 +484,8 @@ void X11SalGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) // cons rDPIX = pDisplay->GetResolution().A(); rDPIY = pDisplay->GetResolution().B(); - if( !pDisplay->GetExactResolution() && rDPIY < 96 ) - { - rDPIX = Divide( rDPIX * 96, rDPIY ); - rDPIY = 96; - } - else if ( rDPIY > 200 ) + + if ( rDPIY > 200 ) { rDPIX = Divide( rDPIX * 200, rDPIY ); rDPIY = 200; |