Consolidate: basegfx::clamp -> o3tl::clamp
Change-Id: Iffd8b0a19d4479b6c70dc834c6f64499e87e01b1 Reviewed-on: https://gerrit.libreoffice.org/59265 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 )) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user