From 3d90997fb6f232d8008df4d166d7b97b869c200f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 28 Oct 2020 08:30:36 +0200 Subject: make tools::Long 64-bit on Windows platform This is only for the 64-bit windows platform. I don't see the point in messing with the 32-bit platforms, they are (a) become more and more rare (b) unlikely to even have enough available process memory to load extremely large calc spreadsheets The primary problem we are addressing here is bringing Windows-64bit up to same capability as Linux-64bit when it comes to handling very large spreadsheets, which is caused by things like tools::Rectangle using "long", which means that all the work done to make Libreoffice on 64-bit Linux capable of loading large spreadsheets is useless on Windows, where long is 32-bit. The operator<< for tools::Rectangle needs to be inside the tools namespace because of an interaction with the cppunit printing template stuff that I don't understand. SalPoint changed to use sal_Int32, since it needs to be the same definition as the Windows POINT structure. Change-Id: Iab6f1af88847b6c8d46995e8ceda3f82b6722ff7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104913 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/source/outdev/bitmap.cxx | 26 +++++++++++++------------- vcl/source/outdev/gradient.cxx | 4 ++-- vcl/source/outdev/hatch.cxx | 2 +- vcl/source/outdev/map.cxx | 4 ++-- vcl/source/outdev/rect.cxx | 4 ++-- vcl/source/outdev/text.cxx | 6 +++--- 6 files changed, 23 insertions(+), 23 deletions(-) (limited to 'vcl/source/outdev') diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index ad25020a620e..7b6e8ab6be91 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -726,19 +726,19 @@ namespace struct LinearScaleContext { - std::unique_ptr mpMapX; - std::unique_ptr mpMapY; + std::unique_ptr mpMapX; + std::unique_ptr mpMapY; - std::unique_ptr mpMapXOffset; - std::unique_ptr mpMapYOffset; + std::unique_ptr mpMapXOffset; + std::unique_ptr mpMapYOffset; LinearScaleContext(tools::Rectangle const & aDstRect, tools::Rectangle const & aBitmapRect, Size const & aOutSize, tools::Long nOffX, tools::Long nOffY) - : mpMapX(new long[aDstRect.GetWidth()]) - , mpMapY(new long[aDstRect.GetHeight()]) - , mpMapXOffset(new long[aDstRect.GetWidth()]) - , mpMapYOffset(new long[aDstRect.GetHeight()]) + : mpMapX(new tools::Long[aDstRect.GetWidth()]) + , mpMapY(new tools::Long[aDstRect.GetHeight()]) + , mpMapXOffset(new tools::Long[aDstRect.GetWidth()]) + , mpMapYOffset(new tools::Long[aDstRect.GetHeight()]) { const tools::Long nSrcWidth = aBitmapRect.GetWidth(); const tools::Long nSrcHeight = aBitmapRect.GetHeight(); @@ -760,7 +760,7 @@ private: const double fReverseScale = (std::abs(nOutDimension) > 1) ? (nSrcDimension - 1) / double(std::abs(nOutDimension) - 1) : 0.0; - tools::Long nSampleRange = std::max(0L, nSrcDimension - 2); + tools::Long nSampleRange = std::max(tools::Long(0), nSrcDimension - 2); for (tools::Long i = 0; i < nDstDimension; i++) { @@ -893,14 +893,14 @@ public: struct TradScaleContext { - std::unique_ptr mpMapX; - std::unique_ptr mpMapY; + std::unique_ptr mpMapX; + std::unique_ptr mpMapY; TradScaleContext(tools::Rectangle const & aDstRect, tools::Rectangle const & aBitmapRect, Size const & aOutSize, tools::Long nOffX, tools::Long nOffY) - : mpMapX(new long[aDstRect.GetWidth()]) - , mpMapY(new long[aDstRect.GetHeight()]) + : mpMapX(new tools::Long[aDstRect.GetWidth()]) + , mpMapY(new tools::Long[aDstRect.GetHeight()]) { const tools::Long nSrcWidth = aBitmapRect.GetWidth(); const tools::Long nSrcHeight = aBitmapRect.GetHeight(); diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx index d67430da187d..32852eefc34e 100644 --- a/vcl/source/outdev/gradient.cxx +++ b/vcl/source/outdev/gradient.cxx @@ -479,7 +479,7 @@ void OutputDevice::DrawComplexGradient( const tools::Rectangle& rRect, tools::Long nStepCount = GetGradientSteps( rGradient, rRect, false/*bMtf*/, true/*bComplex*/ ); // at least three steps and at most the number of colour differences - tools::Long nSteps = std::max( nStepCount, 2L ); + tools::Long nSteps = std::max( nStepCount, tools::Long(2) ); tools::Long nCalcSteps = std::abs( nRedSteps ); tools::Long nTempSteps = std::abs( nGreenSteps ); if ( nTempSteps > nCalcSteps ) @@ -829,7 +829,7 @@ void OutputDevice::DrawComplexGradientToMetafile( const tools::Rectangle& rRect, tools::Long nStepCount = GetGradientSteps( rGradient, rRect, true, true ); // at least three steps and at most the number of colour differences - tools::Long nSteps = std::max( nStepCount, 2L ); + tools::Long nSteps = std::max( nStepCount, tools::Long(2) ); tools::Long nCalcSteps = std::abs( nRedSteps ); tools::Long nTempSteps = std::abs( nGreenSteps ); if ( nTempSteps > nCalcSteps ) diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx index bb2cb67cb1ac..44cf941149bb 100644 --- a/vcl/source/outdev/hatch.cxx +++ b/vcl/source/outdev/hatch.cxx @@ -167,7 +167,7 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& { tools::Rectangle aRect( rPolyPoly.GetBoundRect() ); const tools::Long nLogPixelWidth = ImplDevicePixelToLogicWidth( 1 ); - const tools::Long nWidth = ImplDevicePixelToLogicWidth( std::max( ImplLogicWidthToDevicePixel( rHatch.GetDistance() ), 3L ) ); + const tools::Long nWidth = ImplDevicePixelToLogicWidth( std::max( ImplLogicWidthToDevicePixel( rHatch.GetDistance() ), tools::Long(3) ) ); std::unique_ptr pPtBuffer(new Point[ HATCH_MAXPOINTS ]); Point aPt1, aPt2, aEndPt1; Size aInc; diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index 2a1b46ae0b72..a2134bd468d5 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -588,12 +588,12 @@ LineInfo OutputDevice::ImplLogicToDevicePixel( const LineInfo& rLineInfo ) const if( aInfo.GetStyle() == LineStyle::Dash ) { if( aInfo.GetDotCount() && aInfo.GetDotLen() ) - aInfo.SetDotLen( std::max( ImplLogicWidthToDevicePixel( aInfo.GetDotLen() ), 1L ) ); + aInfo.SetDotLen( std::max( ImplLogicWidthToDevicePixel( aInfo.GetDotLen() ), tools::Long(1) ) ); else aInfo.SetDotCount( 0 ); if( aInfo.GetDashCount() && aInfo.GetDashLen() ) - aInfo.SetDashLen( std::max( ImplLogicWidthToDevicePixel( aInfo.GetDashLen() ), 1L ) ); + aInfo.SetDashLen( std::max( ImplLogicWidthToDevicePixel( aInfo.GetDashLen() ), tools::Long(1) ) ); else aInfo.SetDashCount( 0 ); diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx index 252cbc308daf..9252959d0f5e 100644 --- a/vcl/source/outdev/rect.cxx +++ b/vcl/source/outdev/rect.cxx @@ -251,8 +251,8 @@ void OutputDevice::DrawGrid( const tools::Rectangle& rRect, const Size& rDist, D if( mbOutputClipped ) return; - const tools::Long nDistX = std::max( rDist.Width(), 1L ); - const tools::Long nDistY = std::max( rDist.Height(), 1L ); + const tools::Long nDistX = std::max( rDist.Width(), tools::Long(1) ); + const tools::Long nDistY = std::max( rDist.Height(), tools::Long(1) ); tools::Long nX = ( rRect.Left() >= aDstRect.Left() ) ? rRect.Left() : ( rRect.Left() + ( ( aDstRect.Left() - rRect.Left() ) / nDistX ) * nDistX ); tools::Long nY = ( rRect.Top() >= aDstRect.Top() ) ? rRect.Top() : ( rRect.Top() + ( ( aDstRect.Top() - rRect.Top() ) / nDistY ) * nDistY ); const tools::Long nRight = aDstRect.Right(); diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 8573affbae99..0057fb4a2a14 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1622,7 +1622,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta tools::Long nMnemonicY; DeviceCoordinate nMnemonicWidth; - std::unique_ptr const pCaretXArray(new long[2 * nLineLen]); + std::unique_ptr const pCaretXArray(new tools::Long[2 * nLineLen]); /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray.get(), nIndex, nLineLen ); tools::Long lc_x1 = pCaretXArray[2*(nMnemonicPos - nIndex)]; @@ -1691,7 +1691,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta DeviceCoordinate nMnemonicWidth = 0; if ( nMnemonicPos != -1 ) { - std::unique_ptr const pCaretXArray(new long[2 * aStr.getLength()]); + std::unique_ptr const pCaretXArray(new tools::Long[2 * aStr.getLength()]); /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray.get(), 0, aStr.getLength() ); tools::Long lc_x1 = pCaretXArray[2*nMnemonicPos]; tools::Long lc_x2 = pCaretXArray[2*nMnemonicPos+1]; @@ -2129,7 +2129,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr, nMnemonicPos = nLen-1; } - std::unique_ptr const pCaretXArray(new long[2 * nLen]); + std::unique_ptr const pCaretXArray(new tools::Long[2 * nLen]); /*sal_Bool bRet =*/ GetCaretPositions( aStr, pCaretXArray.get(), nIndex, nLen, pGlyphs ); tools::Long lc_x1 = pCaretXArray[ 2*(nMnemonicPos - nIndex) ]; tools::Long lc_x2 = pCaretXArray[ 2*(nMnemonicPos - nIndex)+1 ]; -- cgit v1.2.3