diff options
author | Liu Hao <ianahao331@gmail.com> | 2022-08-15 00:11:55 +0800 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-08-23 10:45:41 +0200 |
commit | 3f284b6f12e3eb047398998b223663b38a9bfec8 (patch) | |
tree | 2ab2974b217af76f37a38fdf34f7e5703d974f09 /chart2/source | |
parent | 27892a5e12dada80226f778ab2bd14b1bdaab58a (diff) |
tdf#148251 Use std::swap instead of using temporary values
Change-Id: Ibbc46bfb17d4d27dc40e63c65190b3f3a5f2d9c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138256
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'chart2/source')
-rw-r--r-- | chart2/source/view/axes/VCartesianGrid.cxx | 18 | ||||
-rw-r--r-- | chart2/source/view/inc/PlottingPositionHelper.hxx | 6 | ||||
-rw-r--r-- | chart2/source/view/main/PlottingPositionHelper.cxx | 6 |
3 files changed, 5 insertions, 25 deletions
diff --git a/chart2/source/view/axes/VCartesianGrid.cxx b/chart2/source/view/axes/VCartesianGrid.cxx index a5c44c22b042..07c51d4a23b9 100644 --- a/chart2/source/view/axes/VCartesianGrid.cxx +++ b/chart2/source/view/axes/VCartesianGrid.cxx @@ -74,23 +74,11 @@ GridLinePoints::GridLinePoints( const PlottingPositionHelper* pPosHelper, sal_In pPosHelper->doLogicScaling( &MaxX,&MaxY,&MaxZ ); if(!pPosHelper->isMathematicalOrientationX()) - { - double fHelp = MinX; - MinX = MaxX; - MaxX = fHelp; - } + std::swap( MinX, MaxX ); if(!pPosHelper->isMathematicalOrientationY()) - { - double fHelp = MinY; - MinY = MaxY; - MaxY = fHelp; - } + std::swap( MinY, MaxY ); if(pPosHelper->isMathematicalOrientationZ())//z axis in draw is reverse to mathematical - { - double fHelp = MinZ; - MinZ = MaxZ; - MaxZ = fHelp; - } + std::swap( MinZ, MaxZ ); bool bSwapXY = pPosHelper->isSwapXAndY(); //P0: point on 'back' wall, not on 'left' wall diff --git a/chart2/source/view/inc/PlottingPositionHelper.hxx b/chart2/source/view/inc/PlottingPositionHelper.hxx index c0480a4e3b2c..916668dd6c14 100644 --- a/chart2/source/view/inc/PlottingPositionHelper.hxx +++ b/chart2/source/view/inc/PlottingPositionHelper.hxx @@ -400,11 +400,7 @@ inline bool PlottingPositionHelper::clipYRange( double& rMin, double& rMax ) con { //returns true if something remains if( rMin > rMax ) - { - double fHelp = rMin; - rMin = rMax; - rMax = fHelp; - } + std::swap( rMin, rMax ); if( rMin > getLogicMaxY() ) return false; if( rMax < getLogicMinY() ) diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx index eab2f69e7d9a..dfbf38bbd90e 100644 --- a/chart2/source/view/main/PlottingPositionHelper.cxx +++ b/chart2/source/view/main/PlottingPositionHelper.cxx @@ -418,11 +418,7 @@ double PolarPlottingPositionHelper::getWidthAngleDegree( double& fStartLogicValu { const ExplicitScaleData& rAngleScale = m_bSwapXAndY ? m_aScales[1] : m_aScales[0]; if( rAngleScale.Orientation != AxisOrientation_MATHEMATICAL ) - { - double fHelp = fEndLogicValueOnAngleAxis; - fEndLogicValueOnAngleAxis = fStartLogicValueOnAngleAxis; - fStartLogicValueOnAngleAxis = fHelp; - } + std::swap( fStartLogicValueOnAngleAxis, fEndLogicValueOnAngleAxis ); double fStartAngleDegree = transformToAngleDegree( fStartLogicValueOnAngleAxis ); double fEndAngleDegree = transformToAngleDegree( fEndLogicValueOnAngleAxis ); |