vcl/inc/unx/saldisp.hxx | 2 -- vcl/unx/generic/app/saldisp.cxx | 23 ++++------------------- vcl/unx/generic/gdi/salgdi.cxx | 8 ++------ 3 files changed, 6 insertions(+), 27 deletions(-)
New commits: commit 9f308fbc02439e25f8932314a9374c205ebdbc4c Author: Keith Curtis <keit...@gmail.com> Date: Fri Feb 21 19:21:27 2014 -0500 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 <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index 1125608..9b98a76 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 c343552..99060cd 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 018f833..c4b9cf9 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;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits