basegfx/source/polygon/b2dpolygontools.cxx | 18 ------------------ include/basegfx/polygon/b2dpolygontools.hxx | 19 ++++++++----------- slideshow/source/engine/animationfactory.cxx | 5 +++-- 3 files changed, 11 insertions(+), 31 deletions(-)
New commits: commit f2eda851f7ea3ac65c936d23394129de563ea797 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Mon Aug 18 10:34:45 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon Aug 18 16:30:36 2025 +0200 cid#1660547 avoid Division or modulo by float zero warning and cid#1659880 Division or modulo by float zero drop the default arguments, they are always explicitly set except for one single case. Change-Id: I1fce4e7f6ff5c9421c40628e0b6a1e291650e51c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189862 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index e3d95ef7fa30..9051835a3708 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -534,12 +534,6 @@ namespace basegfx::utils sal_uInt32 nIndex(0); bool bIndexDone(false); - // get length if not given - if(fTools::equalZero(fLength)) - { - fLength = getLength(rCandidate); - } - if (fDistance < 0.0) { // handle fDistance < 0.0 @@ -657,12 +651,6 @@ namespace basegfx::utils B2DPoint getPositionRelative(const B2DPolygon& rCandidate, double fDistance, double fLength) { - // get length if not given - if(fTools::equalZero(fLength)) - { - fLength = getLength(rCandidate); - } - // multiply fDistance with real length to get absolute position and // use getPositionAbsolute return getPositionAbsolute(rCandidate, fDistance * fLength, fLength); @@ -674,12 +662,6 @@ namespace basegfx::utils if(nPointCount) { - // get length if not given - if(fTools::equalZero(fLength)) - { - fLength = getLength(rCandidate); - } - // test and correct fFrom if (fFrom < 0.0) { diff --git a/include/basegfx/polygon/b2dpolygontools.hxx b/include/basegfx/polygon/b2dpolygontools.hxx index a29d1fd06a52..783b7347f018 100644 --- a/include/basegfx/polygon/b2dpolygontools.hxx +++ b/include/basegfx/polygon/b2dpolygontools.hxx @@ -115,21 +115,18 @@ namespace basegfx::utils /** get length of polygon */ BASEGFX_DLLPUBLIC double getLength(const B2DPolygon& rCandidate); - // get position on polygon for absolute given distance. If - // length is given, it is assumed the correct polygon length, if 0.0 it is calculated - // using getLength(...) - BASEGFX_DLLPUBLIC B2DPoint getPositionAbsolute(const B2DPolygon& rCandidate, double fDistance, double fLength = 0.0); + // get position on polygon for absolute given distance. + // length is the polygon length + BASEGFX_DLLPUBLIC B2DPoint getPositionAbsolute(const B2DPolygon& rCandidate, double fDistance, double fLength); - // get position on polygon for relative given distance in range [0.0 .. 1.0]. If - // length is given, it is assumed the correct polygon length, if 0.0 it is calculated - // using getLength(...) - BASEGFX_DLLPUBLIC B2DPoint getPositionRelative(const B2DPolygon& rCandidate, double fDistance, double fLength = 0.0); + // get position on polygon for relative given distance in range [0.0 .. 1.0]. + // length is the polygon length + BASEGFX_DLLPUBLIC B2DPoint getPositionRelative(const B2DPolygon& rCandidate, double fDistance, double fLength); // get a snippet from given polygon for absolute distances. The polygon is assumed // to be opened (not closed). fFrom and fTo need to be in range [0.0 .. fLength], where - // fTo >= fFrom. If length is given, it is assumed the correct polygon length, - // if 0.0 it is calculated using getLength(...) - BASEGFX_DLLPUBLIC B2DPolygon getSnippetAbsolute(const B2DPolygon& rCandidate, double fFrom, double fTo, double fLength = 0.0); + // fTo >= fFrom. length is the polygon length. + BASEGFX_DLLPUBLIC B2DPolygon getSnippetAbsolute(const B2DPolygon& rCandidate, double fFrom, double fTo, double fLength); // Continuity check for point with given index BASEGFX_DLLPUBLIC B2VectorContinuity getContinuityInPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex); diff --git a/slideshow/source/engine/animationfactory.cxx b/slideshow/source/engine/animationfactory.cxx index e399aa2ac530..ce04f4ba933f 100644 --- a/slideshow/source/engine/animationfactory.cxx +++ b/slideshow/source/engine/animationfactory.cxx @@ -304,8 +304,9 @@ namespace slideshow::internal ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape, "PathAnimation::operator(): Invalid ShapeAttributeLayer" ); - ::basegfx::B2DPoint rOutPos = ::basegfx::utils::getPositionRelative( maPathPoly, - nValue ); + ::basegfx::B2DPoint rOutPos = ::basegfx::utils::getPositionRelative(maPathPoly, + nValue, + basegfx::utils::getLength(maPathPoly)); // TODO(F1): Determine whether the path is // absolute, or shape-relative.