summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basegfx/source/color/bcolormodifier.cxx18
-rw-r--r--basegfx/source/polygon/b2dpolypolygontools.cxx3
-rw-r--r--basegfx/source/tools/keystoplerp.cxx3
-rw-r--r--cui/source/tabpages/transfrm.cxx11
-rw-r--r--drawinglayer/source/attribute/fillgraphicattribute.cxx5
-rw-r--r--drawinglayer/source/attribute/sdrfillgraphicattribute.cxx5
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitive2d.cxx15
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx5
-rw-r--r--drawinglayer/source/texture/texture.cxx5
-rw-r--r--drawinglayer/source/texture/texture3d.cxx5
-rw-r--r--filter/source/msfilter/svdfppt.cxx11
-rw-r--r--include/basegfx/color/bcolor.hxx7
-rw-r--r--include/basegfx/numeric/ftools.hxx18
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.cxx3
-rw-r--r--slideshow/source/engine/activities/activitybase.cxx4
-rw-r--r--slideshow/source/engine/animationnodes/animationbasenode.cxx3
-rw-r--r--slideshow/source/engine/shapes/viewshape.cxx4
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx17
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx21
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.cxx11
-rw-r--r--svx/source/unodraw/unobrushitemhelper.cxx5
21 files changed, 97 insertions, 82 deletions
diff --git a/basegfx/source/color/bcolormodifier.cxx b/basegfx/source/color/bcolormodifier.cxx
index 6704f7ea489b..f656552f69b2 100644
--- a/basegfx/source/color/bcolormodifier.cxx
+++ b/basegfx/source/color/bcolormodifier.cxx
@@ -18,7 +18,7 @@
*/
#include <basegfx/color/bcolormodifier.hxx>
-
+#include <o3tl/clamp.hxx>
namespace basegfx
{
@@ -217,11 +217,11 @@ namespace basegfx
{
BColorModifier_RGBLuminanceContrast::BColorModifier_RGBLuminanceContrast(double fRed, double fGreen, double fBlue, double fLuminance, double fContrast)
: BColorModifier(),
- mfRed(basegfx::clamp(fRed, -1.0, 1.0)),
- mfGreen(basegfx::clamp(fGreen, -1.0, 1.0)),
- mfBlue(basegfx::clamp(fBlue, -1.0, 1.0)),
- mfLuminance(basegfx::clamp(fLuminance, -1.0, 1.0)),
- mfContrast(basegfx::clamp(fContrast, -1.0, 1.0)),
+ mfRed(o3tl::clamp(fRed, -1.0, 1.0)),
+ mfGreen(o3tl::clamp(fGreen, -1.0, 1.0)),
+ mfBlue(o3tl::clamp(fBlue, -1.0, 1.0)),
+ mfLuminance(o3tl::clamp(fLuminance, -1.0, 1.0)),
+ mfContrast(o3tl::clamp(fContrast, -1.0, 1.0)),
mfContrastOff(1.0),
mfRedOff(0.0),
mfGreenOff(0.0),
@@ -283,9 +283,9 @@ namespace basegfx
if(mbUseIt)
{
return basegfx::BColor(
- basegfx::clamp(aSourceColor.getRed() * mfContrastOff + mfRedOff, 0.0, 1.0),
- basegfx::clamp(aSourceColor.getGreen() * mfContrastOff + mfGreenOff, 0.0, 1.0),
- basegfx::clamp(aSourceColor.getBlue() * mfContrastOff + mfBlueOff, 0.0, 1.0));
+ o3tl::clamp(aSourceColor.getRed() * mfContrastOff + mfRedOff, 0.0, 1.0),
+ o3tl::clamp(aSourceColor.getGreen() * mfContrastOff + mfGreenOff, 0.0, 1.0),
+ o3tl::clamp(aSourceColor.getBlue() * mfContrastOff + mfBlueOff, 0.0, 1.0));
}
else
{
diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx
index a02373616a50..856a7bc4deb0 100644
--- a/basegfx/source/polygon/b2dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolypolygontools.cxx
@@ -18,6 +18,7 @@
*/
#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <o3tl/clamp.hxx>
#include <osl/diagnose.h>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
@@ -551,7 +552,7 @@ namespace basegfx
}
else
{
- nNumber=clamp<sal_uInt32>(nNumber,'0','9') - '0';
+ nNumber=o3tl::clamp<sal_uInt32>(nNumber,'0','9') - '0';
}
B2DPolygon aCurrSegment;
diff --git a/basegfx/source/tools/keystoplerp.cxx b/basegfx/source/tools/keystoplerp.cxx
index 0b0f230253f1..8e9941519e44 100644
--- a/basegfx/source/tools/keystoplerp.cxx
+++ b/basegfx/source/tools/keystoplerp.cxx
@@ -19,6 +19,7 @@
#include <basegfx/utils/keystoplerp.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+#include <o3tl/clamp.hxx>
#include <osl/diagnose.h>
#include <algorithm>
@@ -86,7 +87,7 @@ namespace basegfx
// everything)
return ResultType(
mnLastIndex,
- clamp(fRawLerp,0.0,1.0));
+ o3tl::clamp(fRawLerp,0.0,1.0));
}
}
}
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index bfc5017e3705..d3c9479ab748 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <o3tl/clamp.hxx>
#include <sfx2/app.hxx>
#include <svx/EnhancedCustomShape2d.hxx>
#include <svx/svdundo.hxx>
@@ -1309,10 +1312,10 @@ void SvxPositionSizeTabPage::SetMinMaxPosition()
}
const double fMaxLong(static_cast<double>(MetricField::ConvertValue( LONG_MAX, 0, MapUnit::Map100thMM, meDlgUnit ) - 1));
- fLeft = basegfx::clamp(fLeft, -fMaxLong, fMaxLong);
- fRight = basegfx::clamp(fRight, -fMaxLong, fMaxLong);
- fTop = basegfx::clamp(fTop, - fMaxLong, fMaxLong);
- fBottom = basegfx::clamp(fBottom, -fMaxLong, fMaxLong);
+ fLeft = o3tl::clamp(fLeft, -fMaxLong, fMaxLong);
+ fRight = o3tl::clamp(fRight, -fMaxLong, fMaxLong);
+ fTop = o3tl::clamp(fTop, - fMaxLong, fMaxLong);
+ fBottom = o3tl::clamp(fBottom, -fMaxLong, fMaxLong);
// #i75273# normalizing when setting the min/max values was wrong, removed
m_xMtrPosX->set_range(basegfx::fround64(fLeft), basegfx::fround64(fRight), FUNIT_NONE);
diff --git a/drawinglayer/source/attribute/fillgraphicattribute.cxx b/drawinglayer/source/attribute/fillgraphicattribute.cxx
index 867fecd79b52..406486ce794b 100644
--- a/drawinglayer/source/attribute/fillgraphicattribute.cxx
+++ b/drawinglayer/source/attribute/fillgraphicattribute.cxx
@@ -18,6 +18,7 @@
*/
#include <drawinglayer/attribute/fillgraphicattribute.hxx>
+#include <o3tl/clamp.hxx>
#include <vcl/graph.hxx>
namespace drawinglayer
@@ -98,8 +99,8 @@ namespace drawinglayer
double fOffsetY)
: mpFillGraphicAttribute(ImpFillGraphicAttribute(
rGraphic, rGraphicRange, bTiling,
- basegfx::clamp(fOffsetX, 0.0, 1.0),
- basegfx::clamp(fOffsetY, 0.0, 1.0)))
+ o3tl::clamp(fOffsetX, 0.0, 1.0),
+ o3tl::clamp(fOffsetY, 0.0, 1.0)))
{
}
diff --git a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
index f1bce0064dd8..84fbaea1d998 100644
--- a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
@@ -19,6 +19,7 @@
#include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
#include <drawinglayer/attribute/fillgraphicattribute.hxx>
+#include <o3tl/clamp.hxx>
#include <rtl/instance.hxx>
#include <vcl/graph.hxx>
@@ -289,8 +290,8 @@ namespace drawinglayer
}
// get offset in percent
- const double fOffsetX(basegfx::clamp(getOffset().getX() * 0.01, 0.0, 1.0));
- const double fOffsetY(basegfx::clamp(getOffset().getY() * 0.01, 0.0, 1.0));
+ const double fOffsetX(o3tl::clamp(getOffset().getX() * 0.01, 0.0, 1.0));
+ const double fOffsetY(o3tl::clamp(getOffset().getY() * 0.01, 0.0, 1.0));
// create FillGraphicAttribute
return FillGraphicAttribute(
diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
index 4c2f80f87327..35ac0366a0fa 100644
--- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
@@ -25,6 +25,7 @@
#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <o3tl/clamp.hxx>
#include <vcl/svapp.hxx>
#include <vcl/outdev.hxx>
@@ -122,12 +123,12 @@ namespace drawinglayer
aRetval = create2DColorModifierEmbeddingsAsNeeded(
aRetval,
aSuppressGraphicAttr.GetDrawMode(),
- basegfx::clamp(aSuppressGraphicAttr.GetLuminance() * 0.01, -1.0, 1.0),
- basegfx::clamp(aSuppressGraphicAttr.GetContrast() * 0.01, -1.0, 1.0),
- basegfx::clamp(aSuppressGraphicAttr.GetChannelR() * 0.01, -1.0, 1.0),
- basegfx::clamp(aSuppressGraphicAttr.GetChannelG() * 0.01, -1.0, 1.0),
- basegfx::clamp(aSuppressGraphicAttr.GetChannelB() * 0.01, -1.0, 1.0),
- basegfx::clamp(aSuppressGraphicAttr.GetGamma(), 0.0, 10.0),
+ o3tl::clamp(aSuppressGraphicAttr.GetLuminance() * 0.01, -1.0, 1.0),
+ o3tl::clamp(aSuppressGraphicAttr.GetContrast() * 0.01, -1.0, 1.0),
+ o3tl::clamp(aSuppressGraphicAttr.GetChannelR() * 0.01, -1.0, 1.0),
+ o3tl::clamp(aSuppressGraphicAttr.GetChannelG() * 0.01, -1.0, 1.0),
+ o3tl::clamp(aSuppressGraphicAttr.GetChannelB() * 0.01, -1.0, 1.0),
+ o3tl::clamp(aSuppressGraphicAttr.GetGamma(), 0.0, 10.0),
aSuppressGraphicAttr.IsInvert());
if(!aRetval.size())
@@ -140,7 +141,7 @@ namespace drawinglayer
if(getGraphicAttr().IsTransparent())
{
// check for transparency
- const double fTransparency(basegfx::clamp(getGraphicAttr().GetTransparency() * (1.0 / 255.0), 0.0, 1.0));
+ const double fTransparency(o3tl::clamp(getGraphicAttr().GetTransparency() * (1.0 / 255.0), 0.0, 1.0));
if(!basegfx::fTools::equalZero(fTransparency))
{
diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index ba5cc8441122..bb0430d3fa68 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -29,6 +29,7 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/numeric/ftools.hxx>
+#include <o3tl/clamp.hxx>
// helper class for animated graphics
@@ -590,8 +591,8 @@ namespace drawinglayer
// original in svtools uses:
// #define WATERMARK_LUM_OFFSET 50
// #define WATERMARK_CON_OFFSET -70
- fLuminance = basegfx::clamp(fLuminance + 0.5, -1.0, 1.0);
- fContrast = basegfx::clamp(fContrast - 0.7, -1.0, 1.0);
+ fLuminance = o3tl::clamp(fLuminance + 0.5, -1.0, 1.0);
+ fContrast = o3tl::clamp(fContrast - 0.7, -1.0, 1.0);
aGraphicDrawMode = GraphicDrawMode::Standard;
}
diff --git a/drawinglayer/source/texture/texture.cxx b/drawinglayer/source/texture/texture.cxx
index cf10feab336d..d8cd40e4e919 100644
--- a/drawinglayer/source/texture/texture.cxx
+++ b/drawinglayer/source/texture/texture.cxx
@@ -21,6 +21,7 @@
#include <basegfx/numeric/ftools.hxx>
#include <basegfx/utils/gradienttools.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <o3tl/clamp.hxx>
#include <converters.hxx>
@@ -697,8 +698,8 @@ namespace drawinglayer
double fOffsetX,
double fOffsetY)
: maRange(rRange),
- mfOffsetX(basegfx::clamp(fOffsetX, 0.0, 1.0)),
- mfOffsetY(basegfx::clamp(fOffsetY, 0.0, 1.0))
+ mfOffsetX(o3tl::clamp(fOffsetX, 0.0, 1.0)),
+ mfOffsetY(o3tl::clamp(fOffsetY, 0.0, 1.0))
{
if(!basegfx::fTools::equalZero(mfOffsetX))
{
diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx
index c021c336bb2c..67e7ed56da19 100644
--- a/drawinglayer/source/texture/texture3d.cxx
+++ b/drawinglayer/source/texture/texture3d.cxx
@@ -18,6 +18,7 @@
*/
#include <drawinglayer/texture/texture3d.hxx>
+#include <o3tl/clamp.hxx>
#include <vcl/bitmapaccess.hxx>
#include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx>
#include <sal/log.hxx>
@@ -288,8 +289,8 @@ namespace drawinglayer
double fOffsetX,
double fOffsetY)
: GeoTexSvxBitmapEx(rBitmapEx, rRange),
- mfOffsetX(basegfx::clamp(fOffsetX, 0.0, 1.0)),
- mfOffsetY(basegfx::clamp(fOffsetY, 0.0, 1.0)),
+ mfOffsetX(o3tl::clamp(fOffsetX, 0.0, 1.0)),
+ mfOffsetY(o3tl::clamp(fOffsetY, 0.0, 1.0)),
mbUseOffsetX(!basegfx::fTools::equalZero(mfOffsetX)),
mbUseOffsetY(!mbUseOffsetX && !basegfx::fTools::equalZero(mfOffsetY))
{
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 8f209d73ea99..8324da907f30 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <o3tl/clamp.hxx>
#include <osl/endian.h>
#include <vcl/svapp.hxx>
#include <unotools/tempfile.hxx>
@@ -283,11 +286,11 @@ SvStream& ReadPptDocumentAtom(SvStream& rIn, PptDocumentAtom& rAtom)
.ReadSChar( nShowComments );
// clamp dodgy data to avoid overflow in later calculations
const sal_Int32 nPageClamp = SAL_MAX_INT32/5;
- rAtom.aSlidesPageSize.setWidth( basegfx::clamp<sal_Int32>(nSlideX, -nPageClamp, nPageClamp) );
- rAtom.aSlidesPageSize.setHeight( basegfx::clamp<sal_Int32>(nSlideY, -nPageClamp, nPageClamp) );
+ rAtom.aSlidesPageSize.setWidth( o3tl::clamp<sal_Int32>(nSlideX, -nPageClamp, nPageClamp) );
+ rAtom.aSlidesPageSize.setHeight( o3tl::clamp<sal_Int32>(nSlideY, -nPageClamp, nPageClamp) );
const sal_Int32 nNoteClamp = 65536;
- rAtom.aNotesPageSize.setWidth( basegfx::clamp<sal_Int32>(nNoticeX, -nNoteClamp, nNoteClamp) );
- rAtom.aNotesPageSize.setHeight( basegfx::clamp<sal_Int32>(nNoticeY, -nNoteClamp, nNoteClamp) );
+ rAtom.aNotesPageSize.setWidth( o3tl::clamp<sal_Int32>(nNoticeX, -nNoteClamp, nNoteClamp) );
+ rAtom.aNotesPageSize.setHeight( o3tl::clamp<sal_Int32>(nNoticeY, -nNoteClamp, nNoteClamp) );
rAtom.eSlidesPageFormat = static_cast<PptPageFormat>(nSlidePageFormat);
rAtom.bEmbeddedTrueType = nEmbeddedTrueType;
rAtom.bTitlePlaceholdersOmitted = nTitlePlaceHoldersOmitted;
diff --git a/include/basegfx/color/bcolor.hxx b/include/basegfx/color/bcolor.hxx
index 02f8fb882790..9722e88c5b65 100644
--- a/include/basegfx/color/bcolor.hxx
+++ b/include/basegfx/color/bcolor.hxx
@@ -27,6 +27,7 @@
#include <basegfx/tuple/b3dtuple.hxx>
#include <vector>
#include <basegfx/basegfxdllapi.h>
+#include <o3tl/clamp.hxx>
namespace com { namespace sun { namespace star { namespace rendering {
class XGraphicDevice;
@@ -158,9 +159,9 @@ namespace basegfx
// clamp color to [0.0..1.0] values in all three intensity components
BColor& clamp()
{
- mfX = basegfx::clamp(mfX, 0.0, 1.0);
- mfY = basegfx::clamp(mfY, 0.0, 1.0);
- mfZ = basegfx::clamp(mfZ, 0.0, 1.0);
+ mfX = o3tl::clamp(mfX, 0.0, 1.0);
+ mfY = o3tl::clamp(mfY, 0.0, 1.0);
+ mfZ = o3tl::clamp(mfZ, 0.0, 1.0);
return *this;
}
diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx
index da453a1a1b3d..5604a64ba626 100644
--- a/include/basegfx/numeric/ftools.hxx
+++ b/include/basegfx/numeric/ftools.hxx
@@ -105,24 +105,6 @@ namespace basegfx
return std::max(fVal, 0.00001);
}
- /** clamp given value against given minimum and maximum values
- */
- template <class T> inline const T& clamp(const T& value, const T& minimum, const T& maximum)
- {
- if(value < minimum)
- {
- return minimum;
- }
- else if(value > maximum)
- {
- return maximum;
- }
- else
- {
- return value;
- }
- }
-
/** Convert value from degrees to radians
*/
constexpr double deg2rad( double v )
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 5b26fe60ff80..36db2f809efd 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/presentation/SlideShow.hpp>
+#include <o3tl/clamp.hxx>
#include <svl/aeitem.hxx>
#include <svl/urihelper.hxx>
@@ -1684,7 +1685,7 @@ void SlideshowImpl::updateSlideShow()
const static sal_Int32 nMaximumFrameCount (60);
const static double nMinimumTimeout (1.0 / nMaximumFrameCount);
const static double nMaximumTimeout (4.0);
- fUpdate = ::basegfx::clamp(fUpdate, nMinimumTimeout, nMaximumTimeout);
+ fUpdate = o3tl::clamp(fUpdate, nMinimumTimeout, nMaximumTimeout);
// Make sure that the maximum frame count has not been set
// too high (only then conversion to milliseconds and long
diff --git a/slideshow/source/engine/activities/activitybase.cxx b/slideshow/source/engine/activities/activitybase.cxx
index 282604232f69..4ee7c84bcc72 100644
--- a/slideshow/source/engine/activities/activitybase.cxx
+++ b/slideshow/source/engine/activities/activitybase.cxx
@@ -17,7 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+#include <o3tl/clamp.hxx>
#include <tools/diagnose_ex.h>
#include <canvas/canvastools.hxx>
@@ -146,7 +148,7 @@ namespace slideshow
// ================================
// clamp nT to permissible [0,1] range
- nT = ::basegfx::clamp( nT, 0.0, 1.0 );
+ nT = o3tl::clamp( nT, 0.0, 1.0 );
// take acceleration/deceleration into account. if the sum
// of mnAccelerationFraction and mnDecelerationFraction
diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx
index 74bd447f7808..f1f320feae89 100644
--- a/slideshow/source/engine/animationnodes/animationbasenode.cxx
+++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx
@@ -20,6 +20,7 @@
#include <cppuhelper/exc_hlp.hxx>
#include <comphelper/anytostring.hxx>
+#include <o3tl/clamp.hxx>
#include <sal/log.hxx>
#include <com/sun/star/presentation/ParagraphTarget.hpp>
#include <com/sun/star/animations/Timing.hpp>
@@ -449,7 +450,7 @@ AnimationBaseNode::fillCommonParameters() const
// Calculate the minimum frame count that depends on the duration and
// the minimum frame count.
- const sal_Int32 nMinFrameCount (basegfx::clamp<sal_Int32>(
+ const sal_Int32 nMinFrameCount (o3tl::clamp<sal_Int32>(
basegfx::fround(nDuration * FrameRate::MinimumFramesPerSecond), 1, 10));
return ActivitiesFactory::CommonParameters(
diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx
index 9fb337a2967a..e26865accbe8 100644
--- a/slideshow/source/engine/shapes/viewshape.cxx
+++ b/slideshow/source/engine/shapes/viewshape.cxx
@@ -17,7 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+#include <o3tl/clamp.hxx>
#include <tools/diagnose_ex.h>
#include <math.h>
@@ -434,7 +436,7 @@ namespace slideshow
if( mbForceUpdate || (nUpdateFlags & UpdateFlags::Alpha) )
{
mpSprite->setAlpha( (pAttr && pAttr->isAlphaValid()) ?
- ::basegfx::clamp(pAttr->getAlpha(),
+ o3tl::clamp(pAttr->getAlpha(),
0.0,
1.0) :
1.0 );
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 17efe6793b3e..8e6d9ea49fef 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <o3tl/clamp.hxx>
#include <svgstyleattributes.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
@@ -1325,7 +1328,7 @@ namespace svgio
setFill(aSvgPaint);
if(aOpacity.isSet())
{
- setOpacity(SvgNumber(basegfx::clamp(aOpacity.getNumber(), 0.0, 1.0)));
+ setOpacity(SvgNumber(o3tl::clamp(aOpacity.getNumber(), 0.0, 1.0)));
}
}
else if(!aURL.isEmpty())
@@ -1352,7 +1355,7 @@ namespace svgio
if(readSingleNumber(aContent, aNum))
{
- maFillOpacity = SvgNumber(basegfx::clamp(aNum.getNumber(), 0.0, 1.0), aNum.getUnit(), aNum.isSet());
+ maFillOpacity = SvgNumber(o3tl::clamp(aNum.getNumber(), 0.0, 1.0), aNum.getUnit(), aNum.isSet());
}
break;
}
@@ -1382,7 +1385,7 @@ namespace svgio
maStroke = aSvgPaint;
if(aOpacity.isSet())
{
- setOpacity(SvgNumber(basegfx::clamp(aOpacity.getNumber(), 0.0, 1.0)));
+ setOpacity(SvgNumber(o3tl::clamp(aOpacity.getNumber(), 0.0, 1.0)));
}
}
else if(!aURL.isEmpty())
@@ -1495,7 +1498,7 @@ namespace svgio
if(readSingleNumber(aContent, aNum))
{
- maStrokeOpacity = SvgNumber(basegfx::clamp(aNum.getNumber(), 0.0, 1.0), aNum.getUnit(), aNum.isSet());
+ maStrokeOpacity = SvgNumber(o3tl::clamp(aNum.getNumber(), 0.0, 1.0), aNum.getUnit(), aNum.isSet());
}
break;
}
@@ -1523,7 +1526,7 @@ namespace svgio
maStopColor = aSvgPaint;
if(aOpacity.isSet())
{
- setOpacity(SvgNumber(basegfx::clamp(aOpacity.getNumber(), 0.0, 1.0)));
+ setOpacity(SvgNumber(o3tl::clamp(aOpacity.getNumber(), 0.0, 1.0)));
}
}
break;
@@ -1836,7 +1839,7 @@ namespace svgio
maColor = aSvgPaint;
if(aOpacity.isSet())
{
- setOpacity(SvgNumber(basegfx::clamp(aOpacity.getNumber(), 0.0, 1.0)));
+ setOpacity(SvgNumber(o3tl::clamp(aOpacity.getNumber(), 0.0, 1.0)));
}
}
break;
@@ -1847,7 +1850,7 @@ namespace svgio
if(readSingleNumber(aContent, aNum))
{
- setOpacity(SvgNumber(basegfx::clamp(aNum.getNumber(), 0.0, 1.0), aNum.getUnit(), aNum.isSet()));
+ setOpacity(SvgNumber(o3tl::clamp(aNum.getNumber(), 0.0, 1.0), aNum.getUnit(), aNum.isSet()));
}
break;
}
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 266dde8a1ad7..7e2111f0dc07 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <o3tl/clamp.hxx>
#include <svx/EnhancedCustomShape2d.hxx>
#include <svx/EnhancedCustomShapeGeometry.hxx>
#include <svx/EnhancedCustomShapeTypeNames.hxx>
@@ -1050,15 +1053,15 @@ Color EnhancedCustomShape2d::GetColorData( const Color& rFillColor, sal_uInt32 n
{
if (dBrightness >=0.0)
{ //lighten, blending with white
- return Color( static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetRed() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )),
- static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetGreen() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )),
- static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetBlue() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )) );
+ return Color( static_cast<sal_uInt8>(static_cast< sal_Int32 >( o3tl::clamp(rFillColor.GetRed() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )),
+ static_cast<sal_uInt8>(static_cast< sal_Int32 >( o3tl::clamp(rFillColor.GetGreen() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )),
+ static_cast<sal_uInt8>(static_cast< sal_Int32 >( o3tl::clamp(rFillColor.GetBlue() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )) );
}
else
{ //darken (indicated by negative sign), blending with black
- return Color( static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetRed() * (1.0+dBrightness), 0.0, 255.0) )),
- static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetGreen() * (1.0+dBrightness), 0.0, 255.0) )),
- static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetBlue() * (1.0+dBrightness), 0.0, 255.0) )) );
+ return Color( static_cast<sal_uInt8>(static_cast< sal_Int32 >( o3tl::clamp(rFillColor.GetRed() * (1.0+dBrightness), 0.0, 255.0) )),
+ static_cast<sal_uInt8>(static_cast< sal_Int32 >( o3tl::clamp(rFillColor.GetGreen() * (1.0+dBrightness), 0.0, 255.0) )),
+ static_cast<sal_uInt8>(static_cast< sal_Int32 >( o3tl::clamp(rFillColor.GetBlue() * (1.0+dBrightness), 0.0, 255.0) )) );
}
}
}
@@ -1089,9 +1092,9 @@ Color EnhancedCustomShape2d::GetColorData( const Color& rFillColor, sal_uInt32 n
}
aHSVColor = basegfx::utils::hsv2rgb(aHSVColor);
- return Color( static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getRed(),0.0,1.0) * 255.0 + 0.5 )),
- static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getGreen(),0.0,1.0) * 255.0 + 0.5 )),
- static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getBlue(),0.0,1.0) * 255.0 + 0.5 )) );
+ return Color( static_cast<sal_uInt8>(static_cast< sal_Int32 >( o3tl::clamp(aHSVColor.getRed(),0.0,1.0) * 255.0 + 0.5 )),
+ static_cast<sal_uInt8>(static_cast< sal_Int32 >( o3tl::clamp(aHSVColor.getGreen(),0.0,1.0) * 255.0 + 0.5 )),
+ static_cast<sal_uInt8>(static_cast< sal_Int32 >( o3tl::clamp(aHSVColor.getBlue(),0.0,1.0) * 255.0 + 0.5 )) );
}
}
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 98c85612e9ae..4e4eaffbb125 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <o3tl/clamp.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
#include "PosSizePropertyPanel.hxx"
#include <svx/sidebar/SidebarDialControl.hxx>
@@ -1044,10 +1047,10 @@ void PosSizePropertyPanel::SetPosSizeMinMax()
fBottom -= maRect.getHeight();
const double fMaxLong(static_cast<double>(MetricField::ConvertValue( LONG_MAX, 0, MapUnit::Map100thMM, meDlgUnit ) - 1));
- fLeft = basegfx::clamp(fLeft, -fMaxLong, fMaxLong);
- fRight = basegfx::clamp(fRight, -fMaxLong, fMaxLong);
- fTop = basegfx::clamp(fTop, - fMaxLong, fMaxLong);
- fBottom = basegfx::clamp(fBottom, -fMaxLong, fMaxLong);
+ fLeft = o3tl::clamp(fLeft, -fMaxLong, fMaxLong);
+ fRight = o3tl::clamp(fRight, -fMaxLong, fMaxLong);
+ fTop = o3tl::clamp(fTop, - fMaxLong, fMaxLong);
+ fBottom = o3tl::clamp(fBottom, -fMaxLong, fMaxLong);
mpMtrPosX->SetMin(basegfx::fround64(fLeft));
mpMtrPosX->SetFirst(basegfx::fround64(fLeft));
diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx
index bc3015e5a9ee..60f4c14cd52e 100644
--- a/svx/source/unodraw/unobrushitemhelper.cxx
+++ b/svx/source/unodraw/unobrushitemhelper.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <o3tl/clamp.hxx>
#include <svx/unobrushitemhelper.hxx>
#include <svx/xfillit0.hxx>
#include <svx/xbtmpit.hxx>
@@ -269,7 +272,7 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt
sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents));
// take half orig transparence, add half transparent, clamp result
- nFillTransparence = basegfx::clamp(static_cast<sal_uInt16>((nFillTransparence / 2) + 50), sal_uInt16(0), sal_uInt16(255));
+ nFillTransparence = o3tl::clamp(static_cast<sal_uInt16>((nFillTransparence / 2) + 50), sal_uInt16(0), sal_uInt16(255));
// #i125189# nFillTransparence is in range [0..100] and needs to be in [0..254] unsigned
// It is necessary to use the maximum of 0xfe for transparence for the SvxBrushItem