std::lround is unnecessary here

because we are then casting to a type <=32 bits

Change-Id: Ief4a93724ccbae8d697edbd40e4085389d74473f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202156
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2026-03-19 15:27:43 +01:00
parent 60b267464c
commit 6993d54041
6 changed files with 16 additions and 16 deletions
+1 -1
View File
@@ -930,7 +930,7 @@ void BGradient::tryToRecreateBorder(basegfx::BColorStops* pAssociatedTransparenc
pAssociatedTransparencyStops->removeSpaceAtStart(fOffset);
// ...and create border value
SetBorder(static_cast<sal_uInt16>(std::lround(fOffset * 100.0)));
SetBorder(static_cast<sal_uInt16>(std::round(fOffset * 100.0)));
}
if (bIsAxial)
+3 -3
View File
@@ -71,9 +71,9 @@ namespace
explicit ColorToBColorConverter(const basegfx::BColor& rBColor)
: ColorToBColorConverter(
sal_uInt8(std::lround(rBColor.getRed() * 255.0)),
sal_uInt8(std::lround(rBColor.getGreen() * 255.0)),
sal_uInt8(std::lround(rBColor.getBlue() * 255.0)))
sal_uInt8(std::round(rBColor.getRed() * 255.0)),
sal_uInt8(std::round(rBColor.getGreen() * 255.0)),
sal_uInt8(std::round(rBColor.getBlue() * 255.0)))
{}
basegfx::BColor getBColor() const
+3 -3
View File
@@ -108,9 +108,9 @@ public:
// constructor to create a tools-Color from ::basegfx::BColor
explicit Color(const basegfx::BColor& rBColor)
: Color(ColorTransparency, 0,
sal_uInt8(std::lround(rBColor.getRed() * 255.0)),
sal_uInt8(std::lround(rBColor.getGreen() * 255.0)),
sal_uInt8(std::lround(rBColor.getBlue() * 255.0)))
sal_uInt8(std::round(rBColor.getRed() * 255.0)),
sal_uInt8(std::round(rBColor.getGreen() * 255.0)),
sal_uInt8(std::round(rBColor.getBlue() * 255.0)))
{}
/** Casts the color to corresponding uInt32.
+1 -1
View File
@@ -938,7 +938,7 @@ void FontworkHelpers::createCharFillPropsFromShape(
if (xPropSetInfo->hasPropertyByName(u"FillTransparence"_ustr)
&& (rXPropSet->getPropertyValue(u"FillTransparence"_ustr) >>= nTransPercent))
{
sal_uInt8 nAlpha = 255 - sal_uInt8(std::lround(double(nTransPercent) * 2.55));
sal_uInt8 nAlpha = 255 - sal_uInt8(std::round(double(nTransPercent) * 2.55));
aColor.SetAlpha(nAlpha);
}
rCharPropVec.push_back(comphelper::makePropertyValue(u"CharColor"_ustr, sal_Int32(aColor)));
+6 -6
View File
@@ -259,9 +259,9 @@ void Color::ApplyTintOrShade(sal_Int16 n100thPercent)
aBColor.setBlue(fResult);
aBColor = basegfx::utils::hsl2rgb(aBColor);
R = sal_uInt8(std::lround(aBColor.getRed() * 255.0));
G = sal_uInt8(std::lround(aBColor.getGreen() * 255.0));
B = sal_uInt8(std::lround(aBColor.getBlue() * 255.0));
R = sal_uInt8(std::round(aBColor.getRed() * 255.0));
G = sal_uInt8(std::round(aBColor.getGreen() * 255.0));
B = sal_uInt8(std::round(aBColor.getBlue() * 255.0));
}
void Color::ApplyLumModOff(sal_Int16 nMod, sal_Int16 nOff)
@@ -291,9 +291,9 @@ void Color::ApplyLumModOff(sal_Int16 nMod, sal_Int16 nOff)
// Switch back to RGB.
aBColor = basegfx::utils::hsl2rgb(aBColor);
R = sal_uInt8(std::lround(aBColor.getRed() * 255.0));
G = sal_uInt8(std::lround(aBColor.getGreen() * 255.0));
B = sal_uInt8(std::lround(aBColor.getBlue() * 255.0));
R = sal_uInt8(std::round(aBColor.getRed() * 255.0));
G = sal_uInt8(std::round(aBColor.getGreen() * 255.0));
B = sal_uInt8(std::round(aBColor.getBlue() * 255.0));
}
namespace color
+2 -2
View File
@@ -239,12 +239,12 @@ void XMLTransGradientStyleExport::exportXML(
}
// Opacity start
::sax::Converter::convertPercent(aOut, static_cast<sal_Int32>(std::lround(fOpacityStartPerc)));
::sax::Converter::convertPercent(aOut, static_cast<sal_Int32>(std::round(fOpacityStartPerc)));
aStrValue = aOut.makeStringAndClear();
rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_START, aStrValue );
// Opacity end
::sax::Converter::convertPercent( aOut, static_cast<sal_Int32>(std::lround(fOpacityEndPerc)));
::sax::Converter::convertPercent( aOut, static_cast<sal_Int32>(std::round(fOpacityEndPerc)));
aStrValue = aOut.makeStringAndClear();
rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_END, aStrValue );