summaryrefslogtreecommitdiff
path: root/include/vcl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-10-04 15:13:53 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-10-05 13:58:12 +0200
commitd205274a014acabbed88b18d5058682a0ca46f9c (patch)
tree826c236b1104d262122f74d0277e0fff206ed273 /include/vcl
parent3c162a7a312022716e0648f95662b33577b5993d (diff)
Drop MinMax in favor of std::clamp
Change-Id: I021f524b232ddbe091981444d859d35dd9cd05ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157582 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/vcl')
-rw-r--r--include/vcl/bitmap.hxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 1c5f7bcc7ec6..b0a26700d6f5 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_VCL_BITMAP_HXX
#include <tools/degree.hxx>
+#include <tools/helpers.hxx>
#include <vcl/checksum.hxx>
#include <vcl/dllapi.h>
#include <vcl/mapmod.hxx>
@@ -30,9 +31,13 @@
#include <o3tl/typed_flags_set.hxx>
+#include <algorithm>
#include <memory>
-#define GAMMA( _def_cVal, _def_InvGamma ) (static_cast<sal_uInt8>(MinMax(FRound(pow( _def_cVal/255.0,_def_InvGamma)*255.0),0,255)))
+inline sal_uInt8 GAMMA(double _def_cVal, double _def_InvGamma)
+{
+ return FRound(std::clamp(pow(_def_cVal / 255.0, _def_InvGamma) * 255.0, 0.0, 255.0));
+}
class Color;