diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-08-17 16:32:17 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-08-17 20:13:21 +0200 |
commit | f4351535f3bf10b94cccc721ab395e2c7f5010a4 (patch) | |
tree | 19c18c568867d47918fad11b5c2bd70459cf74cc /svx/source/customshapes | |
parent | 13db6e8671c36e1a028d6a8ad63f518e60f84870 (diff) |
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>
Diffstat (limited to 'svx/source/customshapes')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.cxx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 266dde8a1ad7..7e2111f0dc07 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -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 )) ); } } |