diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-01-11 15:26:59 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-01-11 20:25:08 +0100 |
commit | 27cd397b1a1a8a39843c093eff68c5ea6cb249e7 (patch) | |
tree | ecf63804421b12987ae070a24a6ed967f29de1d8 /drawinglayer/source | |
parent | 5b19be032c51e0f7489b29c2c98e484587ed0865 (diff) |
Drop o3tl/clamp.hxx, use C++17 std::clamp instead
Change-Id: I5043c787dcc3b78bc7fdff130564801194e39f46
Reviewed-on: https://gerrit.libreoffice.org/66177
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'drawinglayer/source')
6 files changed, 41 insertions, 23 deletions
diff --git a/drawinglayer/source/attribute/fillgraphicattribute.cxx b/drawinglayer/source/attribute/fillgraphicattribute.cxx index 406486ce794b..72da948fc96c 100644 --- a/drawinglayer/source/attribute/fillgraphicattribute.cxx +++ b/drawinglayer/source/attribute/fillgraphicattribute.cxx @@ -17,8 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <algorithm> + #include <drawinglayer/attribute/fillgraphicattribute.hxx> -#include <o3tl/clamp.hxx> #include <vcl/graph.hxx> namespace drawinglayer @@ -99,8 +102,8 @@ namespace drawinglayer double fOffsetY) : mpFillGraphicAttribute(ImpFillGraphicAttribute( rGraphic, rGraphicRange, bTiling, - o3tl::clamp(fOffsetX, 0.0, 1.0), - o3tl::clamp(fOffsetY, 0.0, 1.0))) + std::clamp(fOffsetX, 0.0, 1.0), + std::clamp(fOffsetY, 0.0, 1.0))) { } diff --git a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx index 84fbaea1d998..b88b2a9a31a5 100644 --- a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx +++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx @@ -17,9 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <algorithm> + #include <drawinglayer/attribute/sdrfillgraphicattribute.hxx> #include <drawinglayer/attribute/fillgraphicattribute.hxx> -#include <o3tl/clamp.hxx> #include <rtl/instance.hxx> #include <vcl/graph.hxx> @@ -290,8 +293,8 @@ namespace drawinglayer } // get offset in percent - 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)); + const double fOffsetX(std::clamp(getOffset().getX() * 0.01, 0.0, 1.0)); + const double fOffsetY(std::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 50aa48efe333..f684227ba1c8 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <algorithm> + #include <drawinglayer/primitive2d/graphicprimitive2d.hxx> #include <drawinglayer/primitive2d/cropprimitive2d.hxx> #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> @@ -25,7 +29,6 @@ #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> @@ -123,12 +126,12 @@ namespace drawinglayer aRetval = create2DColorModifierEmbeddingsAsNeeded( aRetval, aSuppressGraphicAttr.GetDrawMode(), - 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), + std::clamp(aSuppressGraphicAttr.GetLuminance() * 0.01, -1.0, 1.0), + std::clamp(aSuppressGraphicAttr.GetContrast() * 0.01, -1.0, 1.0), + std::clamp(aSuppressGraphicAttr.GetChannelR() * 0.01, -1.0, 1.0), + std::clamp(aSuppressGraphicAttr.GetChannelG() * 0.01, -1.0, 1.0), + std::clamp(aSuppressGraphicAttr.GetChannelB() * 0.01, -1.0, 1.0), + std::clamp(aSuppressGraphicAttr.GetGamma(), 0.0, 10.0), aSuppressGraphicAttr.IsInvert()); if(aRetval.empty()) @@ -141,7 +144,7 @@ namespace drawinglayer if(getGraphicAttr().IsTransparent()) { // check for transparency - const double fTransparency(o3tl::clamp(getGraphicAttr().GetTransparency() * (1.0 / 255.0), 0.0, 1.0)); + const double fTransparency(std::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 48f22b6a3b6c..bdedee85417b 100644 --- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <algorithm> + #include <drawinglayer/primitive2d/graphicprimitivehelper2d.hxx> #include <drawinglayer/animation/animationtiming.hxx> #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> @@ -29,7 +33,6 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/numeric/ftools.hxx> -#include <o3tl/clamp.hxx> // helper class for animated graphics @@ -591,8 +594,8 @@ namespace drawinglayer // original in svtools uses: // #define WATERMARK_LUM_OFFSET 50 // #define WATERMARK_CON_OFFSET -70 - fLuminance = o3tl::clamp(fLuminance + 0.5, -1.0, 1.0); - fContrast = o3tl::clamp(fContrast - 0.7, -1.0, 1.0); + fLuminance = std::clamp(fLuminance + 0.5, -1.0, 1.0); + fContrast = std::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 d8cd40e4e919..c2d1a5468e78 100644 --- a/drawinglayer/source/texture/texture.cxx +++ b/drawinglayer/source/texture/texture.cxx @@ -17,11 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <algorithm> + #include <drawinglayer/texture/texture.hxx> #include <basegfx/numeric/ftools.hxx> #include <basegfx/utils/gradienttools.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> -#include <o3tl/clamp.hxx> #include <converters.hxx> @@ -698,8 +701,8 @@ namespace drawinglayer double fOffsetX, double fOffsetY) : maRange(rRange), - mfOffsetX(o3tl::clamp(fOffsetX, 0.0, 1.0)), - mfOffsetY(o3tl::clamp(fOffsetY, 0.0, 1.0)) + mfOffsetX(std::clamp(fOffsetX, 0.0, 1.0)), + mfOffsetY(std::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 68d2826bfa46..74c0766ad51c 100644 --- a/drawinglayer/source/texture/texture3d.cxx +++ b/drawinglayer/source/texture/texture3d.cxx @@ -17,8 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <algorithm> + #include <drawinglayer/texture/texture3d.hxx> -#include <o3tl/clamp.hxx> #include <vcl/bitmapaccess.hxx> #include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx> #include <sal/log.hxx> @@ -289,8 +292,8 @@ namespace drawinglayer double fOffsetX, double fOffsetY) : GeoTexSvxBitmapEx(rBitmapEx, rRange), - mfOffsetX(o3tl::clamp(fOffsetX, 0.0, 1.0)), - mfOffsetY(o3tl::clamp(fOffsetY, 0.0, 1.0)), + mfOffsetX(std::clamp(fOffsetX, 0.0, 1.0)), + mfOffsetY(std::clamp(fOffsetY, 0.0, 1.0)), mbUseOffsetX(!basegfx::fTools::equalZero(mfOffsetX)), mbUseOffsetY(!mbUseOffsetX && !basegfx::fTools::equalZero(mfOffsetY)) { |