[Libreoffice-commits] core.git: basegfx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jan 28 22:14:30 UTC 2019


 basegfx/source/polygon/b2dpolygontools.cxx |   20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

New commits:
commit a2f5a7d69d1bec0b5761e48d3feb5346193a969b
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Jan 28 20:01:53 2019 +0100
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Jan 28 23:14:06 2019 +0100

    basegfx: just use the std::clamp for clamping the input
    
    Change-Id: Ia7d6c103956c8e3cebd6ebe656fd88586d33a9c8
    Reviewed-on: https://gerrit.libreoffice.org/67032
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index 5b00b312587d..38d9bb192696 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -1509,24 +1509,8 @@ namespace basegfx
             const double fZero(0.0);
             const double fOne(1.0);
 
-            // crop to useful values
-            if(fTools::less(fRadiusX, fZero))
-            {
-                fRadiusX = fZero;
-            }
-            else if(fTools::more(fRadiusX, fOne))
-            {
-                fRadiusX = fOne;
-            }
-
-            if(fTools::less(fRadiusY, fZero))
-            {
-                fRadiusY = fZero;
-            }
-            else if(fTools::more(fRadiusY, fOne))
-            {
-                fRadiusY = fOne;
-            }
+            fRadiusX = std::clamp(fRadiusX, 0.0, 1.0);
+            fRadiusY = std::clamp(fRadiusY, 0.0, 1.0);
 
             if(rtl::math::approxEqual(fZero, fRadiusX) || rtl::math::approxEqual(fZero, fRadiusY))
             {


More information about the Libreoffice-commits mailing list