summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@collabora.co.uk>2024-03-07 12:08:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-03-07 12:53:27 +0100
commit7979508e4328ceb9d6a2dff6a2a080ea64247c7e (patch)
tree3f3b9bfd3c02fbbcf2b6f623828fa3cfedf6e5d5
parenttdf#157518: add uitest for password policy (diff)
downloadcore-7979508e4328ceb9d6a2dff6a2a080ea64247c7e.tar.gz
core-7979508e4328ceb9d6a2dff6a2a080ea64247c7e.zip
Simplify some basegfx::fTools::*orEqual calls
Comparing with zero is simple - the implementation of basegfx::fTools::moreOrEqual calls rtl_math_approxEqual eventually, which special-zases zero. Change-Id: I62f10f63f103d91a201dfeb20e5b3f9010f377c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164526 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--basegfx/source/curve/b2dcubicbezier.cxx2
-rw-r--r--basegfx/source/numeric/ftools.cxx2
-rw-r--r--basegfx/source/polygon/b2dlinegeometry.cxx4
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx6
-rw-r--r--basegfx/source/polygon/b2dpolypolygoncutter.cxx8
-rw-r--r--basegfx/source/polygon/b2dtrapezoid.cxx8
-rw-r--r--basegfx/source/polygon/b3dpolygontools.cxx4
-rw-r--r--basegfx/source/tools/bgradient.cxx3
-rw-r--r--drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx4
-rw-r--r--drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx4
-rw-r--r--svgio/inc/SvgNumber.hxx2
-rw-r--r--svgio/source/svgreader/svgsvgnode.cxx4
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dpolygon.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx2
-rw-r--r--svx/source/svdraw/svdfmtf.cxx2
15 files changed, 28 insertions, 29 deletions
diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx
index d33cd82b194d..927230fabcb1 100644
--- a/basegfx/source/curve/b2dcubicbezier.cxx
+++ b/basegfx/source/curve/b2dcubicbezier.cxx
@@ -541,7 +541,7 @@ namespace basegfx
B2DVector B2DCubicBezier::getTangent(double t) const
{
- if(fTools::lessOrEqual(t, 0.0))
+ if(t <= 0.0)
{
// tangent in start point
B2DVector aTangent(getControlPointA() - getStartPoint());
diff --git a/basegfx/source/numeric/ftools.cxx b/basegfx/source/numeric/ftools.cxx
index 246d8d548aac..4a01a4c0eca0 100644
--- a/basegfx/source/numeric/ftools.cxx
+++ b/basegfx/source/numeric/ftools.cxx
@@ -99,7 +99,7 @@ namespace basegfx
double normalizeToRange(double v, const double fRange)
{
- if(fTools::lessOrEqual(fRange, 0.0))
+ if(fRange <= 0.0)
{
// with a zero (or less) range, all normalizes to 0.0
return 0.0;
diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx
index 437ebcbb496e..4f5de36a8295 100644
--- a/basegfx/source/polygon/b2dlinegeometry.cxx
+++ b/basegfx/source/polygon/b2dlinegeometry.cxx
@@ -147,7 +147,7 @@ namespace basegfx
const B2DVector aTangentA(rCandidate.getTangent(0.0));
const double fScalarAE(aEdge.scalar(aTangentA));
- if(fTools::lessOrEqual(fScalarAE, 0.0))
+ if(fScalarAE <= 0.0)
{
// angle between TangentA and Edge is bigger or equal 90 degrees
return false;
@@ -174,7 +174,7 @@ namespace basegfx
const B2DVector aTangentB(rCandidate.getTangent(1.0));
const double fScalarBE(aEdge.scalar(aTangentB));
- if(fTools::lessOrEqual(fScalarBE, 0.0))
+ if(fScalarBE <= 0.0)
{
// angle between TangentB and Edge is bigger or equal 90 degrees
return false;
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index b3f43669ddf4..0d9dbc15b42d 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -1239,12 +1239,12 @@ namespace basegfx::utils
const sal_uInt32 nPointCount(rCandidate.count());
const sal_uInt32 nDotDashCount(rDotDashArray.size());
- if(fTools::lessOrEqual(fDotDashLength, 0.0))
+ if(fDotDashLength <= 0.0)
{
fDotDashLength = std::accumulate(rDotDashArray.begin(), rDotDashArray.end(), 0.0);
}
- if(fTools::lessOrEqual(fDotDashLength, 0.0) || (!rLineTargetCallback && !rGapTargetCallback) || !nPointCount)
+ if(fDotDashLength <= 0.0 || (!rLineTargetCallback && !rGapTargetCallback) || !nPointCount)
{
// parameters make no sense, just add source to targets
if (rLineTargetCallback)
@@ -2846,7 +2846,7 @@ namespace basegfx::utils
{
OSL_ENSURE(rOld1.count() == rOld2.count(), "B2DPolygon interpolate: Different geometry (!)");
- if(fTools::lessOrEqual(t, 0.0) || rOld1 == rOld2)
+ if(t <= 0.0 || rOld1 == rOld2)
{
return rOld1;
}
diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
index 42cfed615fe3..4ad6eb5b219d 100644
--- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx
+++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
@@ -146,16 +146,16 @@ namespace basegfx
if(rVecA.cross(rVecB) > 0.0)
{
// b is left turn seen from a, test if Test is left of both and so inside (left is seen as inside)
- const bool bBoolA(fTools::moreOrEqual(rVecA.cross(rTest), 0.0));
- const bool bBoolB(fTools::lessOrEqual(rVecB.cross(rTest), 0.0));
+ const bool bBoolA(rVecA.cross(rTest) >= 0.0);
+ const bool bBoolB(rVecB.cross(rTest) <= 0.0);
return (bBoolA && bBoolB);
}
else
{
// b is right turn seen from a, test if Test is right of both and so outside (left is seen as inside)
- const bool bBoolA(fTools::lessOrEqual(rVecA.cross(rTest), 0.0));
- const bool bBoolB(fTools::moreOrEqual(rVecB.cross(rTest), 0.0));
+ const bool bBoolA(rVecA.cross(rTest) <= 0.0);
+ const bool bBoolB(rVecB.cross(rTest) >= 0.0);
return (!(bBoolA && bBoolB));
}
diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx
index 2870c46d8236..654adc094ef9 100644
--- a/basegfx/source/polygon/b2dtrapezoid.cxx
+++ b/basegfx/source/polygon/b2dtrapezoid.cxx
@@ -293,7 +293,7 @@ namespace basegfx::trapezoidhelper
const double fOldDeltaYStart(rCutPoint.getY() - aEdge.getStart().getY());
- if(fTools::lessOrEqual(fOldDeltaYStart, 0.0))
+ if(fOldDeltaYStart <= 0.0)
{
// do not split: the resulting edge would be horizontal
// correct it to new start point
@@ -303,7 +303,7 @@ namespace basegfx::trapezoidhelper
const double fNewDeltaYStart(aEdge.getEnd().getY() - rCutPoint.getY());
- if(fTools::lessOrEqual(fNewDeltaYStart, 0.0))
+ if(fNewDeltaYStart <= 0.0)
{
// do not split: the resulting edge would be horizontal
// correct it to new end point
@@ -949,7 +949,7 @@ namespace basegfx::utils
const B2DPoint& rPointB,
double fLineWidth)
{
- if(fTools::lessOrEqual(fLineWidth, 0.0))
+ if(fLineWidth <= 0.0)
{
// no line width
return;
@@ -1121,7 +1121,7 @@ namespace basegfx::utils
const B2DPolygon& rPolygon,
double fLineWidth)
{
- if(fTools::lessOrEqual(fLineWidth, 0.0))
+ if(fLineWidth <= 0.0)
{
return;
}
diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx
index 7c92f5ddcea5..968624e0f28b 100644
--- a/basegfx/source/polygon/b3dpolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolygontools.cxx
@@ -179,12 +179,12 @@ namespace basegfx::utils
const sal_uInt32 nPointCount(rCandidate.count());
const sal_uInt32 nDotDashCount(rDotDashArray.size());
- if(fTools::lessOrEqual(fDotDashLength, 0.0))
+ if(fDotDashLength <= 0.0)
{
fDotDashLength = std::accumulate(rDotDashArray.begin(), rDotDashArray.end(), 0.0);
}
- if(fTools::lessOrEqual(fDotDashLength, 0.0) || !rLineTargetCallback || !nPointCount)
+ if(fDotDashLength <= 0.0 || !rLineTargetCallback || !nPointCount)
{
// parameters make no sense, just add source to targets
if (rLineTargetCallback)
diff --git a/basegfx/source/tools/bgradient.cxx b/basegfx/source/tools/bgradient.cxx
index 86e1812d21ac..b22df74d52e8 100644
--- a/basegfx/source/tools/bgradient.cxx
+++ b/basegfx/source/tools/bgradient.cxx
@@ -200,8 +200,7 @@ void BColorStops::replaceStartColor(const BColor& rStart)
// search for highest existing non-StartColor - CAUTION,
// there might be none, one or multiple with StopOffset 0.0
- while (a1stNonStartColor != end()
- && basegfx::fTools::lessOrEqual(a1stNonStartColor->getStopOffset(), 0.0))
+ while (a1stNonStartColor != end() && a1stNonStartColor->getStopOffset() <= 0.0)
a1stNonStartColor++;
// create new ColorStops by 1st adding new one and then all
diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
index 34f4d8472284..ed0e8d41c4ab 100644
--- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
@@ -410,13 +410,13 @@ namespace drawinglayer::primitive3d
mbCloseBack(bCloseBack)
{
// make sure depth is positive
- if(basegfx::fTools::lessOrEqual(getDepth(), 0.0))
+ if(getDepth() <= 0.0)
{
mfDepth = 0.0;
}
// make sure the percentage value getDiagonal() is between 0.0 and 1.0
- if(basegfx::fTools::lessOrEqual(getDiagonal(), 0.0))
+ if(getDiagonal() <= 0.0)
{
mfDiagonal = 0.0;
}
diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
index ca6e11eec4d4..682ea0c54042 100644
--- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
@@ -266,13 +266,13 @@ namespace drawinglayer::primitive3d
mbCloseBack(bCloseBack)
{
// make sure Rotation is positive
- if(basegfx::fTools::lessOrEqual(getRotation(), 0.0))
+ if(getRotation() <= 0.0)
{
mfRotation = 0.0;
}
// make sure the percentage value getDiagonal() is between 0.0 and 1.0
- if(basegfx::fTools::lessOrEqual(getDiagonal(), 0.0))
+ if(getDiagonal() <= 0.0)
{
mfDiagonal = 0.0;
}
diff --git a/svgio/inc/SvgNumber.hxx b/svgio/inc/SvgNumber.hxx
index 4d03335cf424..b2fc51b6f7ac 100644
--- a/svgio/inc/SvgNumber.hxx
+++ b/svgio/inc/SvgNumber.hxx
@@ -99,7 +99,7 @@ public:
bool isPositive() const
{
- return basegfx::fTools::moreOrEqual(mfNumber, 0.0);
+ return mfNumber >= 0.0;
}
// Only usable in cases, when the unit is not SvgUnit::percent, otherwise use method solve
diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx
index 7d2b935b544e..e3c52053a839 100644
--- a/svgio/source/svgreader/svgsvgnode.cxx
+++ b/svgio/source/svgreader/svgsvgnode.cxx
@@ -484,8 +484,8 @@ namespace svgio::svgreader
{
// Svg defines that a negative value is an error and that 0.0 disables rendering
// isPositive() not usable because it allows 0.0 in contrast to mathematical definition of 'positive'
- const bool bWidthInvalid(getWidth().isSet() && basegfx::fTools::lessOrEqual(getWidth().getNumber(), 0.0));
- const bool bHeightInvalid(getHeight().isSet() && basegfx::fTools::lessOrEqual(getHeight().getNumber(), 0.0));
+ const bool bWidthInvalid(getWidth().isSet() && getWidth().getNumber() <= 0.0);
+ const bool bHeightInvalid(getHeight().isSet() && getHeight().getNumber() <= 0.0);
if(!bWidthInvalid && !bHeightInvalid)
{
basegfx::B2DRange aSvgCanvasRange; // viewport
diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
index f0e2e02d5432..ec4e55b688b4 100644
--- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
@@ -131,7 +131,7 @@ namespace sdr::contact
fHeight = aObjectRange.getHeight();
}
- if(basegfx::fTools::lessOrEqual(fWidth, 0.0) ||basegfx::fTools::lessOrEqual(fHeight, 0.0))
+ if(fWidth <= 0.0 || fHeight <= 0.0)
{
// no texture; fallback to very small size
aTextureSize.setX(0.01);
diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
index 77e32e35e48e..7868303c5c08 100644
--- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
@@ -85,7 +85,7 @@ namespace drawinglayer::primitive2d
const double fOffsetX((aScale.getX() - aPrefSize.getWidth()) / 2.0);
const double fOffsetY((aScale.getY() - aPrefSize.getHeight()) / 2.0);
- if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0))
+ if(fOffsetX >= 0.0 && fOffsetY >= 0.0)
{
// if content fits into frame, create it
basegfx::B2DHomMatrix aInnerObjectMatrix(basegfx::utils::createScaleTranslateB2DHomMatrix(
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 0ea228dc4c28..87865e6a0b04 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -1540,7 +1540,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct)
const basegfx::BColor aMedium(basegfx::average(aStart, aEnd));
fTransparence = aMedium.luminance();
- if(basegfx::fTools::lessOrEqual(fTransparence, 0.0))
+ if(fTransparence <= 0.0)
{
// no transparence needed, all done
}