diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-08 17:01:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-11 07:35:43 +0100 |
commit | f14b9d30293f180500fc56d81e5390021758e7c1 (patch) | |
tree | a6cd0b853169203cfa0953230e6774e7b1dd81b4 /include/basegfx | |
parent | d11120b95ee27cb4b05db466ed07f7a996dda125 (diff) |
convert (a>b?a:b) to std::max(a,b)
with something like:
git grep -nP '(.*)\s*>\s*(.*)\s*\?\s*\g1\s*:\s*\g2'
Change-Id: I60b9a3a2a09162bc0de4c13fdde2c209696e5413
Reviewed-on: https://gerrit.libreoffice.org/47602
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/basegfx')
-rw-r--r-- | include/basegfx/color/bcolor.hxx | 4 | ||||
-rw-r--r-- | include/basegfx/numeric/ftools.hxx | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/include/basegfx/color/bcolor.hxx b/include/basegfx/color/bcolor.hxx index 300f8db81e81..02f8fb882790 100644 --- a/include/basegfx/color/bcolor.hxx +++ b/include/basegfx/color/bcolor.hxx @@ -151,8 +151,8 @@ namespace basegfx const double fDistG(getDistanceGreen(rColor)); const double fDistB(getDistanceBlue(rColor)); - double fRetval(fDistR > fDistG ? fDistR : fDistG); - return (fRetval > fDistB ? fRetval : fDistB); + double fRetval(std::max(fDistR, fDistG)); + return std::max(fRetval, fDistB); } // clamp color to [0.0..1.0] values in all three intensity components diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx index eb030b2530d1..5836b48406ae 100644 --- a/include/basegfx/numeric/ftools.hxx +++ b/include/basegfx/numeric/ftools.hxx @@ -23,6 +23,7 @@ #include <rtl/math.hxx> #include <basegfx/basegfxdllapi.h> #include <limits> +#include <algorithm> // standard PI defines from solar.h, but we do not want to link against tools @@ -101,7 +102,7 @@ namespace basegfx if(fVal < 0.0) return (fVal < -0.00001 ? fVal : -0.00001); else - return (fVal > 0.00001 ? fVal : 0.00001); + return std::max(fVal, 0.00001); } /** clamp given value against given minimum and maximum values |