diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2022-06-13 17:20:15 +1000 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2022-07-13 18:54:28 +0200 |
commit | ac2a6ee9618e377806e529ed641f67e88684f7e7 (patch) | |
tree | 1572db055b02358bba8e666d87ea418b66398206 /basegfx | |
parent | d818c341206895a6dda1c19fc8b32f04b5b7c520 (diff) |
basegfx: zoomIn() and zoomOut() should be sal_uInt16
All zoom functions use sal_uInt16 values. For some reason, basegfx used
long when zoomIn and zoomOut were created in 2012 (see commit
315d2ddc16: "optimized zoom to use more common intervals"), this then
got mass converted to tools::Long in commit 387a88fa25: "use tools::Long
in basegfx..chart2".
So fix is to change zoomIn/Out() to use sal_uInt16.
Change-Id: I2a56d6f58e14f77aeb8741d332fe9bc282eb969f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135715
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/tools/zoomtools.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/basegfx/source/tools/zoomtools.cxx b/basegfx/source/tools/zoomtools.cxx index 4fedb8ee848c..dd4c7a6cbbd3 100644 --- a/basegfx/source/tools/zoomtools.cxx +++ b/basegfx/source/tools/zoomtools.cxx @@ -26,7 +26,7 @@ const double ZOOM_FACTOR = 1.12246205; * @param nCurrent current value * @param nMultiple multiple against which the current value is rounded */ -static tools::Long roundMultiple(tools::Long nCurrent, int nMultiple) +static sal_uInt16 roundMultiple(sal_uInt16 nCurrent, int nMultiple) { // round zoom to a multiple of nMultiple return (( nCurrent + nMultiple / 2 ) - ( nCurrent + nMultiple / 2 ) % nMultiple); @@ -39,10 +39,10 @@ static tools::Long roundMultiple(tools::Long nCurrent, int nMultiple) * * @param nCurrent current zoom factor */ -static tools::Long roundZoom(double nCurrent) +static sal_uInt16 roundZoom(double nCurrent) { // convert nCurrent properly to int - tools::Long nNew = nCurrent + 0.5; + sal_uInt16 nNew = nCurrent + 0.5; // round to more common numbers above 50 if (nNew > 1000) { @@ -66,7 +66,7 @@ static tools::Long roundZoom(double nCurrent) * @param nPrevious previous zoom factor * @param nStep step which shouldn't be skipped */ -static tools::Long enforceStep(tools::Long nCurrent, tools::Long nPrevious, int nStep) +static sal_uInt16 enforceStep(sal_uInt16 nCurrent, sal_uInt16 nPrevious, unsigned int nStep) { if ((( nCurrent > nStep ) && ( nPrevious < nStep )) || (( nCurrent < nStep ) && ( nPrevious > nStep ))) @@ -80,9 +80,9 @@ static tools::Long enforceStep(tools::Long nCurrent, tools::Long nPrevious, int * * @param nCurrent current zoom factor */ -tools::Long zoomIn(tools::Long nCurrent) +sal_uInt16 zoomIn(sal_uInt16 nCurrent) { - tools::Long nNew = roundZoom( nCurrent * ZOOM_FACTOR ); + sal_uInt16 nNew = roundZoom( nCurrent * ZOOM_FACTOR ); // make sure some values are not skipped nNew = enforceStep(nNew, nCurrent, 200); nNew = enforceStep(nNew, nCurrent, 100); @@ -97,9 +97,9 @@ tools::Long zoomIn(tools::Long nCurrent) * * @param nCurrent current zoom factor */ -tools::Long zoomOut(tools::Long nCurrent) +sal_uInt16 zoomOut(sal_uInt16 nCurrent) { - tools::Long nNew = roundZoom( nCurrent / ZOOM_FACTOR ); + sal_uInt16 nNew = roundZoom( nCurrent / ZOOM_FACTOR ); // make sure some values are not skipped nNew = enforceStep(nNew, nCurrent, 200); nNew = enforceStep(nNew, nCurrent, 100); |