diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-16 23:10:45 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-17 03:56:59 +0200 |
commit | ea9904c89608d561f6bde3379408208bbb24fe35 (patch) | |
tree | 4648cbc73b7a48ea3361f51280a9713be38f0afd /vcl/source/bitmap/bitmap.cxx | |
parent | 0957ee9f5d379c80fca4027c187b471118d0490d (diff) |
Drop FRound, and use generalized basegfx::fround
Change-Id: I7447e649dc3ef4e51242f69c7486a3e84e103d2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166159
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/source/bitmap/bitmap.cxx')
-rw-r--r-- | vcl/source/bitmap/bitmap.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx index 914e49295524..38a3a90c09dc 100644 --- a/vcl/source/bitmap/bitmap.cxx +++ b/vcl/source/bitmap/bitmap.cxx @@ -340,8 +340,8 @@ void Bitmap::ReassignWithSize(const Bitmap& rBitmap) if ((aOldSizePix != aNewSizePix) && aOldSizePix.Width() && aOldSizePix.Height()) { - aNewPrefSize.setWidth(FRound(maPrefSize.Width() * aNewSizePix.Width() / aOldSizePix.Width())); - aNewPrefSize.setHeight(FRound(maPrefSize.Height() * aNewSizePix.Height() / aOldSizePix.Height())); + aNewPrefSize.setWidth(maPrefSize.Width() * aNewSizePix.Width() / aOldSizePix.Width()); + aNewPrefSize.setHeight(maPrefSize.Height() * aNewSizePix.Height() / aOldSizePix.Height()); } else { @@ -1505,18 +1505,18 @@ bool Bitmap::Adjust( short nLuminancePercent, short nContrastPercent, { if(!msoBrightness) { - cMapR[ nX ] = FRound( std::clamp( nX * fM + fROff, 0.0, 255.0 ) ); - cMapG[ nX ] = FRound( std::clamp( nX * fM + fGOff, 0.0, 255.0 ) ); - cMapB[ nX ] = FRound( std::clamp( nX * fM + fBOff, 0.0, 255.0 ) ); + cMapR[nX] = basegfx::fround<sal_uInt8>(nX * fM + fROff); + cMapG[nX] = basegfx::fround<sal_uInt8>(nX * fM + fGOff); + cMapB[nX] = basegfx::fround<sal_uInt8>(nX * fM + fBOff); } else { // LO simply uses (in a somewhat optimized form) "newcolor = (oldcolor-128)*contrast+brightness+128" // as the formula, i.e. contrast first, brightness afterwards. MSOffice, for whatever weird reason, // use neither first, but apparently it applies half of brightness before contrast and half afterwards. - cMapR[ nX ] = FRound( std::clamp( (nX+fROff/2-128) * fM + 128 + fROff/2, 0.0, 255.0 ) ); - cMapG[ nX ] = FRound( std::clamp( (nX+fGOff/2-128) * fM + 128 + fGOff/2, 0.0, 255.0 ) ); - cMapB[ nX ] = FRound( std::clamp( (nX+fBOff/2-128) * fM + 128 + fBOff/2, 0.0, 255.0 ) ); + cMapR[nX] = basegfx::fround<sal_uInt8>((nX + fROff / 2 - 128) * fM + 128 + fROff / 2); + cMapG[nX] = basegfx::fround<sal_uInt8>((nX + fGOff / 2 - 128) * fM + 128 + fGOff / 2); + cMapB[nX] = basegfx::fround<sal_uInt8>((nX + fBOff / 2 - 128) * fM + 128 + fBOff / 2); } if( bGamma ) { |