summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-04-16 23:10:45 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-04-17 03:56:59 +0200
commitea9904c89608d561f6bde3379408208bbb24fe35 (patch)
tree4648cbc73b7a48ea3361f51280a9713be38f0afd
parent0957ee9f5d379c80fca4027c187b471118d0490d (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>
-rw-r--r--cui/source/dialogs/cuigrfflt.cxx8
-rw-r--r--filter/source/svg/svgwriter.cxx22
-rw-r--r--include/basegfx/numeric/ftools.hxx34
-rw-r--r--include/svx/svdtrans.hxx12
-rw-r--r--include/tools/helpers.hxx8
-rw-r--r--include/vcl/bitmap.hxx5
-rw-r--r--sc/source/core/data/drwlayer.cxx8
-rw-r--r--sd/source/ui/app/optsitem.cxx4
-rw-r--r--sd/source/ui/dlg/vectdlg.cxx6
-rw-r--r--sd/source/ui/func/fuoaprms.cxx3
-rw-r--r--sd/source/ui/view/drviews8.cxx4
-rw-r--r--sfx2/source/doc/objcont.cxx4
-rw-r--r--slideshow/source/engine/shapes/drawinglayeranimation.cxx6
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx4
-rw-r--r--svx/source/dialog/_contdlg.cxx4
-rw-r--r--svx/source/gallery2/galobj.cxx4
-rw-r--r--svx/source/svdraw/gradtrns.cxx24
-rw-r--r--svx/source/svdraw/sdrpagewindow.cxx7
-rw-r--r--svx/source/svdraw/svdedtv1.cxx4
-rw-r--r--svx/source/svdraw/svdfmtf.cxx7
-rw-r--r--svx/source/svdraw/svdhdl.cxx12
-rw-r--r--svx/source/svdraw/svdoashp.cxx18
-rw-r--r--svx/source/svdraw/svdobj.cxx6
-rw-r--r--svx/source/svdraw/svdocapt.cxx6
-rw-r--r--svx/source/svdraw/svdocirc.cxx11
-rw-r--r--svx/source/svdraw/svdoedge.cxx4
-rw-r--r--svx/source/svdraw/svdograf.cxx2
-rw-r--r--svx/source/svdraw/svdomeas.cxx16
-rw-r--r--svx/source/svdraw/svdopath.cxx37
-rw-r--r--svx/source/svdraw/svdorect.cxx2
-rw-r--r--svx/source/svdraw/svdotext.cxx10
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx12
-rw-r--r--svx/source/svdraw/svdpdf.cxx12
-rw-r--r--svx/source/svdraw/svdpoev.cxx9
-rw-r--r--svx/source/svdraw/svdtrans.cxx24
-rw-r--r--svx/source/xoutdev/_xpoly.cxx7
-rw-r--r--sw/source/core/graphic/ndgrf.cxx3
-rw-r--r--sw/source/core/layout/fly.cxx2
-rw-r--r--tools/CppunitTest_tools_test.mk1
-rw-r--r--tools/qa/cppunit/test_fround.cxx62
-rw-r--r--tools/source/generic/color.cxx7
-rw-r--r--tools/source/generic/line.cxx7
-rw-r--r--tools/source/generic/poly.cxx37
-rw-r--r--vcl/osx/salframeview.mm3
-rw-r--r--vcl/skia/salbmp.cxx3
-rw-r--r--vcl/source/animate/AnimationRenderer.cxx8
-rw-r--r--vcl/source/bitmap/BitmapEmbossGreyFilter.cxx4
-rw-r--r--vcl/source/bitmap/BitmapFastScaleFilter.cxx4
-rw-r--r--vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx4
-rw-r--r--vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx8
-rw-r--r--vcl/source/bitmap/BitmapScaleSuperFilter.cxx4
-rw-r--r--vcl/source/bitmap/BitmapTools.cxx8
-rw-r--r--vcl/source/bitmap/Vectorizer.cxx6
-rw-r--r--vcl/source/bitmap/bitmap.cxx16
-rw-r--r--vcl/source/filter/eps/eps.cxx4
-rw-r--r--vcl/source/filter/wmf/emfwr.cxx6
-rw-r--r--vcl/source/filter/wmf/wmfwr.cxx4
-rw-r--r--vcl/source/gdi/gdimtf.cxx28
-rw-r--r--vcl/source/gdi/metaact.cxx30
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx8
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx8
-rw-r--r--vcl/source/gdi/print.cxx10
-rw-r--r--vcl/source/gdi/regband.cxx7
-rw-r--r--vcl/source/graphic/GraphicObject.cxx16
-rw-r--r--vcl/source/helper/canvastools.cxx4
-rw-r--r--vcl/source/outdev/hatch.cxx19
-rw-r--r--vcl/source/outdev/rect.cxx16
-rw-r--r--vcl/source/outdev/textline.cxx4
-rw-r--r--vcl/source/outdev/transparent.cxx2
-rw-r--r--vcl/source/window/window2.cxx6
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx3
-rw-r--r--xmloff/source/draw/shapeexport.cxx17
72 files changed, 356 insertions, 389 deletions
diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx
index c29bc4947e00..69896cd53c0d 100644
--- a/cui/source/dialogs/cuigrfflt.cxx
+++ b/cui/source/dialogs/cuigrfflt.cxx
@@ -192,8 +192,8 @@ Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic,
Graphic aRet;
tools::Long nTileWidth = static_cast<tools::Long>(mxMtrWidth->get_value(FieldUnit::PIXEL));
tools::Long nTileHeight = static_cast<tools::Long>(mxMtrHeight->get_value(FieldUnit::PIXEL));
- const Size aSize( std::max( FRound( nTileWidth * fScaleX ), tools::Long(1) ),
- std::max( FRound( nTileHeight * fScaleY ), tools::Long(1) ) );
+ const Size aSize( std::max( basegfx::fround<tools::Long>( nTileWidth * fScaleX ), tools::Long(1) ),
+ std::max( basegfx::fround<tools::Long>( nTileHeight * fScaleY ), tools::Long(1) ) );
if( rGraphic.IsAnimated() )
{
@@ -270,7 +270,7 @@ GraphicFilterSolarize::GraphicFilterSolarize(weld::Window* pParent, const Graphi
, mxMtrThreshold(m_xBuilder->weld_metric_spin_button("value", FieldUnit::PERCENT))
, mxCbxInvert(m_xBuilder->weld_check_button("invert"))
{
- mxMtrThreshold->set_value(FRound(cGreyThreshold / 2.55), FieldUnit::PERCENT);
+ mxMtrThreshold->set_value(basegfx::fround(cGreyThreshold / 2.55), FieldUnit::PERCENT);
mxMtrThreshold->connect_value_changed(LINK(this, GraphicFilterSolarize, EditModifyHdl));
mxCbxInvert->set_active(bInvert);
@@ -290,7 +290,7 @@ IMPL_LINK_NOARG(GraphicFilterSolarize, EditModifyHdl, weld::MetricSpinButton&, v
Graphic GraphicFilterSolarize::GetFilteredGraphic( const Graphic& rGraphic, double, double )
{
Graphic aRet;
- sal_uInt8 nGreyThreshold = static_cast<sal_uInt8>(FRound(mxMtrThreshold->get_value(FieldUnit::PERCENT) * 2.55));
+ sal_uInt8 nGreyThreshold = basegfx::fround<sal_uInt8>(mxMtrThreshold->get_value(FieldUnit::PERCENT) * 2.55);
if( rGraphic.IsAnimated() )
{
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index adfdda948f76..5d6fa5a2c854 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -2187,7 +2187,7 @@ void SVGActionWriter::ImplWriteShape( const SVGShapeDescriptor& rShape )
for( size_t k = 0; k < rShape.maDashArray.size(); ++k )
{
- const sal_Int32 nDash = ImplMap( FRound( rShape.maDashArray[ k ] ) );
+ const sal_Int32 nDash = ImplMap(basegfx::fround(rShape.maDashArray[k]));
if( k )
aDashArrayStr.append(",");
@@ -2535,8 +2535,8 @@ void SVGActionWriter::ImplWriteMask(GDIMetaFile& rMtf, const Point& rDestPt, con
if (fScaleX != 1.0 || fScaleY != 1.0)
{
rMtf.Scale(fScaleX, fScaleY);
- aSrcPt.setX(FRound(aSrcPt.X() * fScaleX));
- aSrcPt.setY(FRound(aSrcPt.Y() * fScaleY));
+ aSrcPt.setX(basegfx::fround<tools::Long>(aSrcPt.X() * fScaleX));
+ aSrcPt.setY(basegfx::fround<tools::Long>(aSrcPt.Y() * fScaleY));
}
nMoveX = rDestPt.X() - aSrcPt.X();
@@ -2736,7 +2736,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
const double fFactor = static_cast<double>(nWidth) / aNormSize.Width();
for( i = 0; i < ( nLen - 1 ); i++ )
- aTmpArray.set(i, FRound(aTmpArray[i] * fFactor));
+ aTmpArray.set(i, basegfx::fround(aTmpArray[i] * fFactor));
}
else
{
@@ -2800,11 +2800,11 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
return;
tools::Polygon aPoly( 4 );
- const tools::Long nLineHeight = std::max<tools::Long>( FRound( aMetric.GetLineHeight() * 0.05 ), 1 );
+ const tools::Long nLineHeight = std::max<tools::Long>( basegfx::fround<tools::Long>( aMetric.GetLineHeight() * 0.05 ), 1 );
if( rFont.GetStrikeout() )
{
- const tools::Long nYLinePos = aBaseLinePos.Y() - FRound( aMetric.GetAscent() * 0.26 );
+ const tools::Long nYLinePos = aBaseLinePos.Y() - basegfx::fround<tools::Long>( aMetric.GetAscent() * 0.26 );
aPoly[ 0 ].setX( aBaseLinePos.X() ); aPoly[ 0 ].setY( nYLinePos - ( nLineHeight >> 1 ) );
aPoly[ 1 ].setX( aBaseLinePos.X() + aNormSize.Width() - 1 ); aPoly[ 1 ].setY( aPoly[ 0 ].Y() );
@@ -3312,8 +3312,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
// i.e. invisible line, because it makes it visible,
// resulting an extra line behind the normal shape line
if ( aNewLineColor.GetAlpha() > 0 )
- aNewLineColor.SetAlpha( 255 - sal::static_int_cast<sal_uInt8>( FRound( pA->GetTransparence() * 2.55 ) ) );
- aNewFillColor.SetAlpha( 255 - sal::static_int_cast<sal_uInt8>( FRound( pA->GetTransparence() * 2.55 ) ) );
+ aNewLineColor.SetAlpha( 255 - basegfx::fround<sal_uInt8>( pA->GetTransparence() * 2.55 ) );
+ aNewFillColor.SetAlpha( 255 - basegfx::fround<sal_uInt8>( pA->GetTransparence() * 2.55 ) );
maAttributeWriter.AddPaintAttr( aNewLineColor, aNewFillColor );
ImplWritePolyPolygon( rPolyPoly, false );
@@ -3479,7 +3479,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
mapCurShape->maShapePolyPoly = aShapePolyPoly;
mapCurShape->maShapeFillColor = aFill.getFillColor();
- mapCurShape->maShapeFillColor.SetAlpha( 255 - static_cast<sal_uInt8>(FRound( 255.0 * aFill.getTransparency() )) );
+ mapCurShape->maShapeFillColor.SetAlpha( 255 - basegfx::fround<sal_uInt8>( 255.0 * aFill.getTransparency() ) );
if( bGradient )
{
@@ -3569,8 +3569,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
}
mapCurShape->maShapeLineColor = mpVDev->GetLineColor();
- mapCurShape->maShapeLineColor.SetAlpha( 255 - static_cast<sal_uInt8>(FRound( aStroke.getTransparency() * 255.0 )) );
- mapCurShape->mnStrokeWidth = FRound( aStroke.getStrokeWidth() );
+ mapCurShape->maShapeLineColor.SetAlpha( 255 - basegfx::fround<sal_uInt8>( aStroke.getTransparency() * 255.0 ) );
+ mapCurShape->mnStrokeWidth = basegfx::fround(aStroke.getStrokeWidth());
aStroke.getDashArray( mapCurShape->maDashArray );
// added support for LineJoin
diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx
index 62850c32670b..8404dc2babcd 100644
--- a/include/basegfx/numeric/ftools.hxx
+++ b/include/basegfx/numeric/ftools.hxx
@@ -35,41 +35,25 @@ namespace basegfx
@return the nearest integer
*/
- inline sal_Int32 fround32( double fVal )
+ template <class Int = sal_Int32> requires std::is_integral_v<Int>
+ inline Int fround(double fVal)
{
if (fVal >= 0.0)
{
- if (fVal >= std::numeric_limits<sal_Int32>::max() - .5)
- return std::numeric_limits<sal_Int32>::max();
- return static_cast<sal_Int32>(fVal + .5);
+ if (fVal >= static_cast<double>(std::numeric_limits<Int>::max()) - 0.5)
+ return std::numeric_limits<Int>::max();
+ return static_cast<Int>(fVal + .5);
}
- if (fVal <= std::numeric_limits<sal_Int32>::min() + .5)
- return std::numeric_limits<sal_Int32>::min();
- return static_cast<sal_Int32>(fVal - .5);
+ if (fVal <= static_cast<double>(std::numeric_limits<Int>::min()) + 0.5)
+ return std::numeric_limits<Int>::min();
+ return static_cast<Int>(fVal - .5);
}
/** Round double to nearest integer
@return the nearest 64 bit integer
*/
- inline sal_Int64 fround64( double fVal )
- {
- return fVal > 0.0 ? static_cast<sal_Int64>( fVal + .5 ) : -static_cast<sal_Int64>( -fVal + .5 );
- }
-
- /** Round double to nearest integer
-
- @return the nearest integer
- */
- template <class Int = sal_Int32>
- requires std::is_integral_v<Int> && std::is_signed_v<Int>
- inline Int fround(double fVal)
- {
- if constexpr (sizeof(Int) == sizeof(sal_Int64))
- return fround64(fVal);
- else
- return fround32(fVal);
- }
+ inline sal_Int64 fround64(double fVal) { return fround<sal_Int64>(fVal); }
/** Prune a small epsilon range around zero.
diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx
index ae225426afd6..2b32386e1004 100644
--- a/include/svx/svdtrans.hxx
+++ b/include/svx/svdtrans.hxx
@@ -94,27 +94,27 @@ inline void ResizePoint(Point& rPnt, const Point& rRef, const Fraction& xFract,
{
double nxFract = xFract.IsValid() ? static_cast<double>(xFract) : 1.0;
double nyFract = yFract.IsValid() ? static_cast<double>(yFract) : 1.0;
- rPnt.setX(rRef.X() + FRound( (rPnt.X() - rRef.X()) * nxFract ));
- rPnt.setY(rRef.Y() + FRound( (rPnt.Y() - rRef.Y()) * nyFract ));
+ rPnt.setX(rRef.X() + basegfx::fround<tools::Long>((rPnt.X() - rRef.X()) * nxFract));
+ rPnt.setY(rRef.Y() + basegfx::fround<tools::Long>((rPnt.Y() - rRef.Y()) * nyFract));
}
inline void RotatePoint(Point& rPnt, const Point& rRef, double sn, double cs)
{
tools::Long dx=rPnt.X()-rRef.X();
tools::Long dy=rPnt.Y()-rRef.Y();
- rPnt.setX(FRound(rRef.X()+dx*cs+dy*sn));
- rPnt.setY(FRound(rRef.Y()+dy*cs-dx*sn));
+ rPnt.setX(basegfx::fround<tools::Long>(rRef.X() + dx * cs + dy * sn));
+ rPnt.setY(basegfx::fround<tools::Long>(rRef.Y() + dy * cs - dx * sn));
}
inline void ShearPoint(Point& rPnt, const Point& rRef, double tn, bool bVShear)
{
if (!bVShear) { // Horizontal
if (rPnt.Y()!=rRef.Y()) { // else not needed
- rPnt.AdjustX(-FRound((rPnt.Y()-rRef.Y())*tn));
+ rPnt.AdjustX(basegfx::fround<tools::Long>((rRef.Y() - rPnt.Y()) * tn));
}
} else { // or else vertical
if (rPnt.X()!=rRef.X()) { // else not needed
- rPnt.AdjustY(-FRound((rPnt.X()-rRef.X())*tn));
+ rPnt.AdjustY(basegfx::fround<tools::Long>((rRef.X() - rPnt.X()) * tn));
}
}
}
diff --git a/include/tools/helpers.hxx b/include/tools/helpers.hxx
index 1c224179ab58..6e499a6564a0 100644
--- a/include/tools/helpers.hxx
+++ b/include/tools/helpers.hxx
@@ -23,14 +23,6 @@ inline sal_uInt32 AlignedWidth4Bytes(sal_uInt32 nWidthBits)
return (nWidthBits >> 5) << 2;
}
-inline tools::Long FRound( double fVal )
-{
- return fVal > 0.0
- ? fVal == double(std::numeric_limits<tools::Long>::max())
- ? std::numeric_limits<tools::Long>::max() : static_cast<tools::Long>( fVal + 0.5 )
- : static_cast<tools::Long>( fVal - 0.5 );
-}
-
//valid range: (-180,180]
template <typename T>
[[nodiscard]] inline typename std::enable_if<std::is_signed<T>::value, T>::type
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 24cc1245e1f5..886c796e6c67 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -20,6 +20,9 @@
#ifndef INCLUDED_VCL_BITMAP_HXX
#define INCLUDED_VCL_BITMAP_HXX
+#include <sal/config.h>
+
+#include <basegfx/numeric/ftools.hxx>
#include <tools/degree.hxx>
#include <tools/helpers.hxx>
#include <vcl/checksum.hxx>
@@ -35,7 +38,7 @@
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));
+ return basegfx::fround<sal_uInt8>(pow(_def_cVal / 255.0, _def_InvGamma) * 255.0);
}
class Color;
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index f6f5737dbc54..c34cad1f28d5 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1020,10 +1020,10 @@ void ScDrawLayer::InitializeCellAnchoredObj(SdrObject* pObj, ScDrawObjData& rDat
static_cast<SdrPathObj*>(pObj)->GetPathPoly().getB2DPolygon(0));
const basegfx::B2DPoint aB2DPoint0(aPoly.getB2DPoint(0));
const basegfx::B2DPoint aB2DPoint1(aPoly.getB2DPoint(1));
- const Point aPointLT(FRound(std::min(aB2DPoint0.getX(), aB2DPoint1.getX())),
- FRound(std::min(aB2DPoint0.getY(), aB2DPoint1.getY())));
- const Point aPointRB(FRound(std::max(aB2DPoint0.getX(), aB2DPoint1.getX())),
- FRound(std::max(aB2DPoint0.getY(), aB2DPoint1.getY())));
+ const Point aPointLT(basegfx::fround<tools::Long>(std::min(aB2DPoint0.getX(), aB2DPoint1.getX())),
+ basegfx::fround<tools::Long>(std::min(aB2DPoint0.getY(), aB2DPoint1.getY())));
+ const Point aPointRB(basegfx::fround<tools::Long>(std::max(aB2DPoint0.getX(), aB2DPoint1.getX())),
+ basegfx::fround<tools::Long>(std::max(aB2DPoint0.getY(), aB2DPoint1.getY())));
const tools::Rectangle aObjRect(aPointLT, aPointRB);
GetCellAnchorFromPosition(aObjRect, rNoRotatedAnchor, *pDoc, nTab1,
false /*bHiddenAsZero*/);
diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx
index 1aee9d7d7afc..5f93655f1fb1 100644
--- a/sd/source/ui/app/optsitem.cxx
+++ b/sd/source/ui/app/optsitem.cxx
@@ -971,13 +971,13 @@ bool SdOptionsGrid::ReadData( const Any* pValues )
if( pValues[2].hasValue() )
{
- const sal_uInt32 nDivX = FRound( *o3tl::doAccess<double>(pValues[ 2 ]) );
+ const sal_uInt32 nDivX = basegfx::fround<sal_uInt32>(*o3tl::doAccess<double>(pValues[2]));
SetFieldDivisionX( SvxOptionsGrid::GetFieldDrawX() / ( nDivX + 1 ) );
}
if( pValues[3].hasValue() )
{
- const sal_uInt32 nDivY = FRound( *o3tl::doAccess<double>(pValues[ 3 ]) );
+ const sal_uInt32 nDivY = basegfx::fround<sal_uInt32>(*o3tl::doAccess<double>(pValues[3]));
SetFieldDivisionY( SvxOptionsGrid::GetFieldDrawY() / ( nDivY + 1 ) );
}
if( pValues[4].hasValue() ) SetUseGridSnap( *o3tl::doAccess<bool>(pValues[ 4 ]) );
diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx
index 3ef7aa9ac494..93e9c3ed6e73 100644
--- a/sd/source/ui/dlg/vectdlg.cxx
+++ b/sd/source/ui/dlg/vectdlg.cxx
@@ -225,9 +225,9 @@ void SdVectorizeDlg::AddTile( BitmapReadAccess const * pRAcc, GDIMetaFile& rMtf,
}
}
- const Color aColor( static_cast<sal_uInt8>(FRound( nSumR * fMult )),
- static_cast<sal_uInt8>(FRound( nSumG * fMult )),
- static_cast<sal_uInt8>(FRound( nSumB * fMult )) );
+ const Color aColor( basegfx::fround<sal_uInt8>( nSumR * fMult ),
+ basegfx::fround<sal_uInt8>( nSumG * fMult ),
+ basegfx::fround<sal_uInt8>( nSumB * fMult ) );
::tools::Rectangle aRect( Point( nPosX, nPosY ), Size( nWidth + 1, nHeight + 1 ) );
const Size& rMaxSize = rMtf.GetPrefSize();
diff --git a/sd/source/ui/func/fuoaprms.cxx b/sd/source/ui/func/fuoaprms.cxx
index fd01f9befd1d..b9bfbaf9c4fb 100644
--- a/sd/source/ui/func/fuoaprms.cxx
+++ b/sd/source/ui/func/fuoaprms.cxx
@@ -661,7 +661,8 @@ void FuObjectAnimationParameters::DoExecute( SfxRequest& rReq )
const ::basegfx::B2DPolygon& aPolygon(rPolyPolygon.getB2DPolygon(nNoOfPolygons - 1));
sal_uInt32 nPoints(aPolygon.count());
const ::basegfx::B2DPoint aNewB2DCenter(aPolygon.getB2DPoint(nPoints - 1));
- const Point aNewCenter(FRound(aNewB2DCenter.getX()), FRound(aNewB2DCenter.getY()));
+ const Point aNewCenter(basegfx::fround<::tools::Long>(aNewB2DCenter.getX()),
+ basegfx::fround<::tools::Long>(aNewB2DCenter.getY()));
Size aDistance(aNewCenter.X() - aCurCenter.X(), aNewCenter.Y() - aCurCenter.Y());
pRunningObj->Move(aDistance);
diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx
index 0f2907d424ba..15be1d1c95d0 100644
--- a/sd/source/ui/view/drviews8.cxx
+++ b/sd/source/ui/view/drviews8.cxx
@@ -74,13 +74,13 @@ void DrawViewShell::ScannerEvent()
if( fGrfWH < fWinWH )
{
- aBmpSize.setWidth( FRound( aPageSize.Height() * fGrfWH ) );
+ aBmpSize.setWidth( basegfx::fround<::tools::Long>( aPageSize.Height() * fGrfWH ) );
aBmpSize.setHeight( aPageSize.Height() );
}
else if( fGrfWH > 0.F )
{
aBmpSize.setWidth( aPageSize.Width() );
- aBmpSize.setHeight( FRound( aPageSize.Width() / fGrfWH ) );
+ aBmpSize.setHeight( basegfx::fround<::tools::Long>( aPageSize.Width() / fGrfWH ) );
}
}
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index 8c3939b5f392..7c1f6b72014c 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -172,13 +172,13 @@ bool SfxObjectShell::CreatePreview_Impl( bool bFullContent, VirtualDevice* pDevi
double fWH = static_cast< double >( aSizePix.Width() ) / aSizePix.Height();
if ( fWH <= 1.0 )
{
- aSizePix.setWidth( FRound( nMaximumExtent * fWH ) );
+ aSizePix.setWidth(basegfx::fround<tools::Long>(nMaximumExtent * fWH));
aSizePix.setHeight( nMaximumExtent );
}
else
{
aSizePix.setWidth( nMaximumExtent );
- aSizePix.setHeight( FRound( nMaximumExtent / fWH ) );
+ aSizePix.setHeight(basegfx::fround<tools::Long>(nMaximumExtent / fWH));
}
}
// do it 4x larger to be able to scale it down & get beautiful antialias
diff --git a/slideshow/source/engine/shapes/drawinglayeranimation.cxx b/slideshow/source/engine/shapes/drawinglayeranimation.cxx
index d0d3acb66369..ea765eea9649 100644
--- a/slideshow/source/engine/shapes/drawinglayeranimation.cxx
+++ b/slideshow/source/engine/shapes/drawinglayeranimation.cxx
@@ -422,7 +422,7 @@ void ActivityImpl::ImpForceScrollTextAnimNodes()
const double fNumberSteps =
(fRelativeDistance * fDistanceLogic) / GetStepWidthLogic();
- nLoopTime = FRound(fNumberSteps * mnFrequency);
+ nLoopTime = basegfx::fround<sal_uInt32>(fNumberSteps * mnFrequency);
// init loop
ScrollTextAnimNode aInitNode(
@@ -451,7 +451,7 @@ void ActivityImpl::ImpForceScrollTextAnimNodes()
const double fNumberSteps =
(fRelativeDistance * fDistanceLogic) / GetStepWidthLogic();
- nLoopTime = FRound(fNumberSteps * mnFrequency);
+ nLoopTime = basegfx::fround<sal_uInt32>(fNumberSteps * mnFrequency);
if(0 == mnRepeat)
{
@@ -501,7 +501,7 @@ void ActivityImpl::ImpForceScrollTextAnimNodes()
const double fNumberSteps =
(fRelativeDistance * fDistanceLogic) / GetStepWidthLogic();
- nLoopTime = FRound(fNumberSteps * mnFrequency);
+ nLoopTime = basegfx::fround<sal_uInt32>(fNumberSteps * mnFrequency);
// exit loop
ScrollTextAnimNode aExitNode(
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index ae194b8fcdea..082532d75f2d 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -1185,9 +1185,9 @@ bool EnhancedCustomShape2d::GetHandlePosition( const sal_uInt32 nIndex, Point& r
double fY =-dx * sin( a );
rReturnPosition =
Point(
- FRound( fX + aReferencePoint.X() ),
+ basegfx::fround<tools::Long>( fX + aReferencePoint.X() ),
basegfx::fTools::equalZero(m_fXScale) ? aReferencePoint.Y() :
- FRound( ( fY * m_fYScale ) / m_fXScale + aReferencePoint.Y() ) );
+ basegfx::fround<tools::Long>( ( fY * m_fYScale ) / m_fXScale + aReferencePoint.Y() ) );
}
else
{
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index da7077956917..117d6e7849c1 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -135,12 +135,12 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic,
if( fWH <= 1.0 )
{
aSizePix.setHeight(512);
- aSizePix.setWidth( FRound( ( aSizePix.Height() ) * fWH ) );
+ aSizePix.setWidth(basegfx::fround<tools::Long>(aSizePix.Height() * fWH));
}
else
{
aSizePix.setWidth(512);
- aSizePix.setHeight( FRound( ( aSizePix.Width() ) / fWH ) );
+ aSizePix.setHeight(basegfx::fround<tools::Long>(aSizePix.Width() / fWH));
}
}
diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx
index f083ad85bb78..2c11af446b17 100644
--- a/svx/source/gallery2/galobj.cxx
+++ b/svx/source/gallery2/galobj.cxx
@@ -118,9 +118,9 @@ bool SgaObject::CreateThumb( const Graphic& rGraphic )
double fFactorPix = static_cast< double >( aBmpSize.Width() ) / aBmpSize.Height();
if( fFactorPix > fFactorLog )
- aBmpSize.setWidth( FRound( aBmpSize.Height() * fFactorLog ) );
+ aBmpSize.setWidth( basegfx::fround<tools::Long>( aBmpSize.Height() * fFactorLog ) );
else
- aBmpSize.setHeight( FRound( aBmpSize.Width() / fFactorLog ) );
+ aBmpSize.setHeight( basegfx::fround<tools::Long>( aBmpSize.Width() / fFactorLog ) );
aBmpEx.Scale(aBmpSize, BmpScaleFlag::BestQuality);
}
diff --git a/svx/source/svdraw/gradtrns.cxx b/svx/source/svdraw/gradtrns.cxx
index 82a4ea0a29d1..28b61f5e9208 100644
--- a/svx/source/svdraw/gradtrns.cxx
+++ b/svx/source/svdraw/gradtrns.cxx
@@ -239,7 +239,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r
}
// to int and set
- Degree10 nNewAngle( FRound(fNewFullAngle));
+ Degree10 nNewAngle(basegfx::fround<sal_Int16>(fNewFullAngle));
if(nNewAngle != rGOld.aGradient.GetAngle())
{
@@ -256,7 +256,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r
const double fFullLen(aFullVec.getLength());
const double fOldLen(aOldVec.getLength());
const double fNewBorder((fFullLen * 100.0) / fOldLen);
- sal_Int32 nNewBorder(100 - FRound(fNewBorder));
+ sal_Int32 nNewBorder(100 - basegfx::fround(fNewBorder));
// clip
if(nNewBorder < 0)
@@ -287,7 +287,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r
const double fFullLen(aFullVec.getLength());
const double fOldLen(aOldVec.getLength());
const double fNewBorder((fFullLen * 100.0) / fOldLen);
- sal_Int32 nNewBorder = 100 - FRound(fNewBorder);
+ sal_Int32 nNewBorder = 100 - basegfx::fround(fNewBorder);
// clip
if(nNewBorder < 0)
@@ -323,7 +323,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r
}
// to int and set
- const Degree10 nNewAngle(FRound(fNewFullAngle));
+ const Degree10 nNewAngle(basegfx::fround<sal_Int16>(fNewFullAngle));
if(nNewAngle != rGOld.aGradient.GetAngle())
{
@@ -340,8 +340,8 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r
{
const basegfx::B2DPoint aTopLeft(aRange.getMinX(), aRange.getMinY());
const basegfx::B2DPoint aOffset(aEndPos - aTopLeft);
- sal_Int32 nNewXOffset(FRound((aOffset.getX() * 100.0) / aRange.getWidth()));
- sal_Int32 nNewYOffset(FRound((aOffset.getY() * 100.0) / aRange.getHeight()));
+ sal_Int32 nNewXOffset(basegfx::fround(aOffset.getX() * 100.0 / aRange.getWidth()));
+ sal_Int32 nNewYOffset(basegfx::fround(aOffset.getY() * 100.0 / aRange.getHeight()));
// clip
if(nNewXOffset < 0)
@@ -380,7 +380,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r
const double fFullLen(aFullVec.getLength());
const double fOldLen(aOldVec.getLength());
const double fNewBorder((fFullLen * 100.0) / fOldLen);
- sal_Int32 nNewBorder(100 - FRound(fNewBorder));
+ sal_Int32 nNewBorder(100 - basegfx::fround(fNewBorder));
// clip
if(nNewBorder < 0)
@@ -418,7 +418,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r
}
// to int and set
- const Degree10 nNewAngle(FRound(fNewFullAngle));
+ const Degree10 nNewAngle(basegfx::fround<sal_Int16>(fNewFullAngle));
if(nNewAngle != rGOld.aGradient.GetAngle())
{
@@ -435,8 +435,8 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r
{
const basegfx::B2DPoint aTopLeft(aRange.getMinX(), aRange.getMinY());
const basegfx::B2DPoint aOffset(aEndPos - aTopLeft);
- sal_Int32 nNewXOffset(FRound((aOffset.getX() * 100.0) / aRange.getWidth()));
- sal_Int32 nNewYOffset(FRound((aOffset.getY() * 100.0) / aRange.getHeight()));
+ sal_Int32 nNewXOffset(basegfx::fround(aOffset.getX() * 100.0 / aRange.getWidth()));
+ sal_Int32 nNewYOffset(basegfx::fround(aOffset.getY() * 100.0 / aRange.getHeight()));
// clip
if(nNewXOffset < 0)
@@ -475,7 +475,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r
const double fFullLen(aFullVec.getLength());
const double fOldLen(aOldVec.getLength());
const double fNewBorder((fFullLen * 100.0) / fOldLen);
- sal_Int32 nNewBorder(100 - FRound(fNewBorder));
+ sal_Int32 nNewBorder(100 - basegfx::fround(fNewBorder));
// clip
if(nNewBorder < 0)
@@ -513,7 +513,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r
}
// to int and set
- const Degree10 nNewAngle(FRound(fNewFullAngle));
+ const Degree10 nNewAngle(basegfx::fround<sal_Int16>(fNewFullAngle));
if(nNewAngle != rGOld.aGradient.GetAngle())
{
diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx
index fa8e5f4d7f84..f45ab9276981 100644
--- a/svx/source/svdraw/sdrpagewindow.cxx
+++ b/svx/source/svdraw/sdrpagewindow.cxx
@@ -231,6 +231,7 @@ void SdrPageWindow::PrepareRedraw(const vcl::Region& rReg)
// clip test
#ifdef CLIPPER_TEST
#include <svx/svdopath.hxx>
+#include <basegfx/numeric/ftools.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <tools/helpers.hxx>
#include <basegfx/polygon/b2dpolygoncutandtouch.hxx>
@@ -262,8 +263,10 @@ namespace
{
const basegfx::B2DPoint aBStart(aCandidate.getB2DPoint(a));
const basegfx::B2DPoint aBEnd(aCandidate.getB2DPoint((a + 1) % aCandidate.count()));
- const Point aStart(FRound(aBStart.getX()), FRound(aBStart.getY()));
- const Point aEnd(FRound(aBEnd.getX()), FRound(aBEnd.getY()));
+ const Point aStart(basegfx::fround<tools::Long>(aBStart.getX()),
+ basegfx::fround<tools::Long>(aBStart.getY()));
+ const Point aEnd(basegfx::fround<tools::Long>(aBEnd.getX()),
+ basegfx::fround<tools::Long>(aBEnd.getY()));
rOutDev.DrawLine(aStart, aEnd);
}
}
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 7729cb52d06c..db0e27d748b1 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -558,7 +558,7 @@ void SdrEditView::ImpCrookObj(SdrObject* pO, const Point& rRef, const Point& rRa
aCtr1 -= aCtr0;
if(bRotOk)
- pO->Rotate(aCtr0, Degree100(FRound(basegfx::rad2deg<100>(nAngle))), nSin, nCos);
+ pO->Rotate(aCtr0, Degree100(basegfx::fround(basegfx::rad2deg<100>(nAngle))), nSin, nCos);
pO->Move(Size(aCtr1.X(),aCtr1.Y()));
}
@@ -1674,7 +1674,7 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin
double nNew = tan(toRadians(nNewShearAngle));
nNew-=nOld;
nNew = basegfx::rad2deg<100>(atan(nNew));
- nShearAngle=Degree100(FRound(nNew));
+ nShearAngle = Degree100(basegfx::fround(nNew));
} else {
nShearAngle=nNewShearAngle-nOldShearAngle;
}
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 84bb470b5741..90d2c509f837 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -393,7 +393,7 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr
if(bText && mbFntDirty)
{
vcl::Font aFnt(mpVD->GetFont());
- const sal_uInt32 nHeight(FRound(aFnt.GetFontSize().Height() * mfScaleY));
+ const sal_uInt32 nHeight(basegfx::fround(aFnt.GetFontSize().Height() * mfScaleY));
mpTextAttr->Put( SvxFontItem( aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO ) );
mpTextAttr->Put( SvxFontItem( aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK ) );
@@ -1001,11 +1001,12 @@ void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const OUString& rSt
sal_Int32 nTextWidth = static_cast<sal_Int32>( mpVD->GetTextWidth( rStr ) * mfScaleX );
sal_Int32 nTextHeight = static_cast<sal_Int32>( mpVD->GetTextHeight() * mfScaleY );
- Point aPos( FRound(rPos.X() * mfScaleX + maOfs.X()), FRound(rPos.Y() * mfScaleY + maOfs.Y()) );
+ Point aPos(basegfx::fround<tools::Long>(rPos.X() * mfScaleX + maOfs.X()),
+ basegfx::fround<tools::Long>(rPos.Y() * mfScaleY + maOfs.Y()));
Size aSize( nTextWidth, nTextHeight );
if ( eAlg == ALIGN_BASELINE )
- aPos.AdjustY( -(FRound(aFontMetric.GetAscent() * mfScaleY)) );
+ aPos.AdjustY(basegfx::fround<tools::Long>(aFontMetric.GetAscent() * -mfScaleY));
else if ( eAlg == ALIGN_BOTTOM )
aPos.AdjustY( -nTextHeight );
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index d32d01edb4bc..993b2e26dd57 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -1420,16 +1420,20 @@ void SdrHdlGradient::FromIAOToItem(SdrObject* _pObj, bool bSetItemOnObject, bool
// back transformation, set values on pIAOHandle
GradTransformer::GradToVec(aGradTransGradient, aGradTransVector, _pObj);
- SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
- Set2ndPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
+ SetPos({ basegfx::fround<tools::Long>(aGradTransVector.maPositionA.getX()),
+ basegfx::fround<tools::Long>(aGradTransVector.maPositionA.getY()) });
+ Set2ndPos({ basegfx::fround<tools::Long>(aGradTransVector.maPositionB.getX()),
+ basegfx::fround<tools::Long>(aGradTransVector.maPositionB.getY()) });
if(m_pColHdl1)
{
- m_pColHdl1->SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
+ m_pColHdl1->SetPos({ basegfx::fround<tools::Long>(aGradTransVector.maPositionA.getX()),
+ basegfx::fround<tools::Long>(aGradTransVector.maPositionA.getY()) });
m_pColHdl1->SetColor(aGradTransVector.aCol1);
}
if(m_pColHdl2)
{
- m_pColHdl2->SetPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
+ m_pColHdl2->SetPos({ basegfx::fround<tools::Long>(aGradTransVector.maPositionB.getX()),
+ basegfx::fround<tools::Long>(aGradTransVector.maPositionB.getY()) });
m_pColHdl2->SetColor(aGradTransVector.aCol2);
}
}
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index cbe19a8e8e2e..0f952aae08bd 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -3045,7 +3045,8 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix,
}
// scale
- Size aSize(FRound(fabs(aScale.getX())), FRound(fabs(aScale.getY())));
+ Size aSize(basegfx::fround<tools::Long>(fabs(aScale.getX())),
+ basegfx::fround<tools::Long>(fabs(aScale.getY())));
// fdo#47434 We need a valid rectangle here
if( !aSize.Height() ) aSize.setHeight( 1 );
if( !aSize.Width() ) aSize.setWidth( 1 );
@@ -3065,7 +3066,7 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix,
// #i123181# The fix for #121932# here was wrong, the trunk version does not correct the
// mirrored shear values, neither at the object level, nor on the API or XML level. Taking
// back the mirroring of the shear angle
- aGeoStat.m_nShearAngle = Degree100(FRound(basegfx::rad2deg<100>(atan(fShearX))));
+ aGeoStat.m_nShearAngle = Degree100(basegfx::fround(basegfx::rad2deg<100>(atan(fShearX))));
aGeoStat.RecalcTan();
Shear(Point(), aGeoStat.m_nShearAngle, aGeoStat.mfTanShearAngle, false);
}
@@ -3078,7 +3079,7 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix,
// #i78696#
// fRotate is mathematically correct, but aGeoStat.nRotationAngle is
// mirrored -> mirror value here
- aGeoStat.m_nRotationAngle = NormAngle36000(Degree100(FRound(-basegfx::rad2deg<100>(fRotate))));
+ aGeoStat.m_nRotationAngle = NormAngle36000(Degree100(basegfx::fround(-basegfx::rad2deg<100>(fRotate))));
aGeoStat.RecalcSinCos();
Rotate(Point(), aGeoStat.m_nRotationAngle, aGeoStat.mfSinRotationAngle, aGeoStat.mfCosRotationAngle);
}
@@ -3086,7 +3087,8 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix,
// translate?
if(!aTranslate.equalZero())
{
- Move(Size(FRound(aTranslate.getX()), FRound(aTranslate.getY())));
+ Move(Size(basegfx::fround<tools::Long>(aTranslate.getX()),
+ basegfx::fround<tools::Long>(aTranslate.getY())));
}
// Apply flipping from enhanced geometry at center of the shape.
@@ -3107,11 +3109,11 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix,
double fCenterX = aCenter.getX();
double fCenterY = aCenter.getY();
if (bIsMirroredX) // vertical axis
- Mirror(Point(FRound(fCenterX),FRound(fCenterY)),
- Point(FRound(fCenterX), FRound(fCenterY + 1000.0)));
+ Mirror(Point(basegfx::fround<tools::Long>(fCenterX), basegfx::fround<tools::Long>(fCenterY)),
+ Point(basegfx::fround<tools::Long>(fCenterX), basegfx::fround<tools::Long>(fCenterY + 1000.0)));
if (bIsMirroredY) // horizontal axis
- Mirror(Point(FRound(fCenterX),FRound(fCenterY)),
- Point(FRound(fCenterX + 1000.0), FRound(fCenterY)));
+ Mirror(Point(basegfx::fround<tools::Long>(fCenterX), basegfx::fround<tools::Long>(fCenterY)),
+ Point(basegfx::fround<tools::Long>(fCenterX + 1000.0), basegfx::fround<tools::Long>(fCenterY)));
}
// taking fObjectRotation instead of aGeo.nAngle
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index f169ba06056f..ccc79daed1dd 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -3003,8 +3003,10 @@ void SdrObject::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const ba
}
// build BaseRect
- Point aPoint(FRound(aTranslate.getX()), FRound(aTranslate.getY()));
- tools::Rectangle aBaseRect(aPoint, Size(FRound(aScale.getX()), FRound(aScale.getY())));
+ Point aPoint(basegfx::fround<tools::Long>(aTranslate.getX()),
+ basegfx::fround<tools::Long>(aTranslate.getY()));
+ tools::Rectangle aBaseRect(aPoint, Size(basegfx::fround<tools::Long>(aScale.getX()),
+ basegfx::fround<tools::Long>(aScale.getY())));
// set BaseRect
SetSnapRect(aBaseRect);
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index 98c86664c28a..d7dc7d926ba1 100644
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -738,8 +738,10 @@ void SdrCaptionObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, cons
}
// build BaseRect
- Point aPoint(FRound(aTranslate.getX()), FRound(aTranslate.getY()));
- tools::Rectangle aBaseRect(aPoint, Size(FRound(aScale.getX()), FRound(aScale.getY())));
+ Point aPoint(basegfx::fround<tools::Long>(aTranslate.getX()),
+ basegfx::fround<tools::Long>(aTranslate.getY()));
+ tools::Rectangle aBaseRect(aPoint, Size(basegfx::fround<tools::Long>(aScale.getX()),
+ basegfx::fround<tools::Long>(aScale.getY())));
// set BaseRect, but rescue TailPos over this call
const Point aTailPoint = GetTailPos();
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index becc496c76f1..ba656c32f353 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -57,7 +57,8 @@ static Point GetAnglePnt(const tools::Rectangle& rR, Degree100 nAngle)
tools::Long nHgt=rR.Bottom()-rR.Top();
tools::Long nMaxRad=(std::max(nWdt,nHgt)+1) /2;
double a = toRadians(nAngle);
- Point aRetval(FRound(cos(a)*nMaxRad),-FRound(sin(a)*nMaxRad));
+ Point aRetval(basegfx::fround<tools::Long>(cos(a) * nMaxRad),
+ basegfx::fround<tools::Long>(-sin(a) * nMaxRad));
if (nWdt==0) aRetval.setX(0 );
if (nHgt==0) aRetval.setY(0 );
if (nWdt!=nHgt) {
@@ -888,13 +889,15 @@ void SdrCircObj::NbcMirror(const Point& rRef1, const Point& rRef2)
tools::Long nMaxRad=(std::max(nWdt,nHgt)+1) /2;
// starting point
double a = toRadians(nStartAngle);
- aTmpPt1=Point(FRound(cos(a)*nMaxRad),-FRound(sin(a)*nMaxRad));
+ aTmpPt1 = Point(basegfx::fround<tools::Long>(cos(a) * nMaxRad),
+ basegfx::fround<tools::Long>(-sin(a) * nMaxRad));
if (nWdt==0) aTmpPt1.setX(0 );
if (nHgt==0) aTmpPt1.setY(0 );
aTmpPt1+=aCenter;
// finishing point
a = toRadians(nEndAngle);
- aTmpPt2=Point(FRound(cos(a)*nMaxRad),-FRound(sin(a)*nMaxRad));
+ aTmpPt2 = Point(basegfx::fround<tools::Long>(cos(a) * nMaxRad),
+ basegfx::fround<tools::Long>(-sin(a) * nMaxRad));
if (nWdt==0) aTmpPt2.setX(0 );
if (nHgt==0) aTmpPt2.setY(0 );
aTmpPt2+=aCenter;
@@ -1013,7 +1016,7 @@ void SdrCircObj::TakeUnrotatedSnapRect(tools::Rectangle& rRect) const
if (maGeo.m_nShearAngle==0_deg100)
return;
- tools::Long nDst = FRound((rRect.Bottom() - rRect.Top()) * maGeo.mfTanShearAngle);
+ tools::Long nDst = basegfx::fround<tools::Long>((rRect.Bottom() - rRect.Top()) * maGeo.mfTanShearAngle);
if (maGeo.m_nShearAngle > 0_deg100)
{
Point aRef(rRect.TopLeft());
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 414bc53ddea4..4107b36149a9 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -1517,8 +1517,8 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, tools::Long nAngle1, co
// corresponding bentConnector as calculated above.
auto SegmentPoint = [&aXP1](const sal_uInt16& nEnd, const double& fFactor) {
return Point(
- aXP1[nEnd - 1].X() + FRound(fFactor * (aXP1[nEnd].X() - aXP1[nEnd - 1].X())),
- aXP1[nEnd - 1].Y() + FRound(fFactor * (aXP1[nEnd].Y() - aXP1[nEnd - 1].Y())));
+ aXP1[nEnd - 1].X() + basegfx::fround<tools::Long>(fFactor * (aXP1[nEnd].X() - aXP1[nEnd - 1].X())),
+ aXP1[nEnd - 1].Y() + basegfx::fround<tools::Long>(fFactor * (aXP1[nEnd].Y() - aXP1[nEnd - 1].Y())));
};
// We change the path going from end to start. Thus inserting points does not affect the index
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 0d03e5934fa7..bfe9b7d5eedb 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -1039,7 +1039,7 @@ void SdrGrafObj::ImpSetAttrToGrafInfo()
aGrafInfo.SetChannelG( rSet.Get( SDRATTR_GRAFGREEN ).GetValue() );
aGrafInfo.SetChannelB( rSet.Get( SDRATTR_GRAFBLUE ).GetValue() );
aGrafInfo.SetGamma( rSet.Get( SDRATTR_GRAFGAMMA ).GetValue() * 0.01 );
- aGrafInfo.SetAlpha( 255 - static_cast<sal_uInt8>(FRound( std::min( nTrans, sal_uInt16(100) ) * 2.55 )) );
+ aGrafInfo.SetAlpha(255 - basegfx::fround<sal_uInt8>(nTrans * 2.55));
aGrafInfo.SetInvert( rSet.Get( SDRATTR_GRAFINVERT ).GetValue() );
aGrafInfo.SetDrawMode( rSet.Get( SDRATTR_GRAFMODE ).GetValue() );
aGrafInfo.SetCrop( rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom() );
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index 5778cbe5622d..242bded04171 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -462,14 +462,14 @@ void SdrMeasureObj::ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly&
tools::Long nOverhang=rRec.nHelplineOverhang;
tools::Long nHelplineDist=rRec.nHelplineDist;
- tools::Long dx= FRound(nLineDist*nHlpCos);
- tools::Long dy=-FRound(nLineDist*nHlpSin);
- tools::Long dxh1a= FRound((nHelplineDist-rRec.nHelpline1Len)*nHlpCos);
- tools::Long dyh1a=-FRound((nHelplineDist-rRec.nHelpline1Len)*nHlpSin);
- tools::Long dxh1b= FRound((nHelplineDist-rRec.nHelpline2Len)*nHlpCos);
- tools::Long dyh1b=-FRound((nHelplineDist-rRec.nHelpline2Len)*nHlpSin);
- tools::Long dxh2= FRound((nLineDist+nOverhang)*nHlpCos);
- tools::Long dyh2=-FRound((nLineDist+nOverhang)*nHlpSin);
+ tools::Long dx = basegfx::fround<tools::Long>(nLineDist * nHlpCos);
+ tools::Long dy = basegfx::fround<tools::Long>(nLineDist * -nHlpSin);
+ tools::Long dxh1a = basegfx::fround<tools::Long>((nHelplineDist - rRec.nHelpline1Len) * nHlpCos);
+ tools::Long dyh1a = basegfx::fround<tools::Long>((nHelplineDist - rRec.nHelpline1Len) * -nHlpSin);
+ tools::Long dxh1b = basegfx::fround<tools::Long>((nHelplineDist - rRec.nHelpline2Len) * nHlpCos);
+ tools::Long dyh1b = basegfx::fround<tools::Long>((nHelplineDist - rRec.nHelpline2Len) * -nHlpSin);
+ tools::Long dxh2 = basegfx::fround<tools::Long>((nLineDist + nOverhang) * nHlpCos);
+ tools::Long dyh2 = basegfx::fround<tools::Long>((nLineDist + nOverhang) * -nHlpSin);
// extension line 1
rPol.aHelpline1.aP1=Point(aP1.X()+dxh1a,aP1.Y()+dyh1a);
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index d76faf320439..322b7444960f 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -324,18 +324,18 @@ void ImpPathCreateUser::CalcCircle(const Point& rP1, const Point& rP2, const Poi
if (bRet) {
double cs = cos(toRadians(nTmpAngle));
double nR=static_cast<double>(GetLen(Point(dx,dy)))/cs/2;
- nRad=std::abs(FRound(nR));
+ nRad = std::abs(basegfx::fround<tools::Long>(nR));
}
if (dAngle<18000_deg100) {
nCircStAngle=NormAngle36000(nTangAngle-9000_deg100);
nCircRelAngle=NormAngle36000(2_deg100*dAngle);
- aCircCenter.AdjustX(FRound(nRad * cos(toRadians(nTangAngle + 9000_deg100))));
- aCircCenter.AdjustY(-(FRound(nRad * sin(toRadians(nTangAngle + 9000_deg100)))));
+ aCircCenter.AdjustX(basegfx::fround<tools::Long>(nRad * cos(toRadians(nTangAngle + 9000_deg100))));
+ aCircCenter.AdjustY(basegfx::fround<tools::Long>(nRad * -sin(toRadians(nTangAngle + 9000_deg100))));
} else {
nCircStAngle=NormAngle36000(nTangAngle+9000_deg100);
nCircRelAngle=-NormAngle36000(36000_deg100-2_deg100*dAngle);
- aCircCenter.AdjustX(FRound(nRad * cos(toRadians(nTangAngle - 9000_deg100))));
- aCircCenter.AdjustY(-(FRound(nRad * sin(toRadians(nTangAngle - 9000_deg100)))));
+ aCircCenter.AdjustX(basegfx::fround<tools::Long>(nRad * cos(toRadians(nTangAngle - 9000_deg100))));
+ aCircCenter.AdjustY(basegfx::fround<tools::Long>(nRad * -sin(toRadians(nTangAngle - 9000_deg100))));
}
bAngleSnap=pView!=nullptr && pView->IsAngleSnapEnabled();
if (bAngleSnap) {
@@ -457,8 +457,8 @@ void ImpPathCreateUser::CalcRect(const Point& rP1, const Point& rP2, const Point
double sn=sin(a);
double cs=cos(a);
double nGKathLen=nHypLen*sn;
- y+=FRound(nGKathLen*sn);
- x+=FRound(nGKathLen*cs);
+ y += basegfx::fround<tools::Long>(nGKathLen * sn);
+ x += basegfx::fround<tools::Long>(nGKathLen * cs);
}
aRectP2.AdjustX(x );
aRectP2.AdjustY(y );
@@ -1659,8 +1659,8 @@ static tools::Rectangle lcl_ImpGetBoundRect(const basegfx::B2DPolyPolygon& rPoly
return tools::Rectangle();
return tools::Rectangle(
- FRound(aRange.getMinX()), FRound(aRange.getMinY()),
- FRound(aRange.getMaxX()), FRound(aRange.getMaxY()));
+ basegfx::fround<tools::Long>(aRange.getMinX()), basegfx::fround<tools::Long>(aRange.getMinY()),
+ basegfx::fround<tools::Long>(aRange.getMaxX()), basegfx::fround<tools::Long>(aRange.getMaxY()));
}
void SdrPathObj::ImpForceLineAngle()
@@ -1671,10 +1671,13 @@ void SdrPathObj::ImpForceLineAngle()
const basegfx::B2DPolygon aPoly(GetPathPoly().getB2DPolygon(0));
const basegfx::B2DPoint aB2DPoint0(aPoly.getB2DPoint(0));
const basegfx::B2DPoint aB2DPoint1(aPoly.getB2DPoint(1));
- const Point aPoint0(FRound(aB2DPoint0.getX()), FRound(aB2DPoint0.getY()));
- const Point aPoint1(FRound(aB2DPoint1.getX()), FRound(aB2DPoint1.getY()));
+ const Point aPoint0(basegfx::fround<tools::Long>(aB2DPoint0.getX()),
+ basegfx::fround<tools::Long>(aB2DPoint0.getY()));
+ const Point aPoint1(basegfx::fround<tools::Long>(aB2DPoint1.getX()),
+ basegfx::fround<tools::Long>(aB2DPoint1.getY()));
const basegfx::B2DPoint aB2DDelt(aB2DPoint1 - aB2DPoint0);
- const Point aDelt(FRound(aB2DDelt.getX()), FRound(aB2DDelt.getY()));
+ const Point aDelt(basegfx::fround<tools::Long>(aB2DDelt.getX()),
+ basegfx::fround<tools::Long>(aB2DDelt.getY()));
maGeo.m_nRotationAngle=GetAngle(aDelt);
maGeo.m_nShearAngle=0_deg100;
@@ -2414,7 +2417,8 @@ Point SdrPathObj::GetSnapPoint(sal_uInt32 nSnapPnt) const
}
const basegfx::B2DPoint aB2DPoint(GetPathPoly().getB2DPolygon(nPoly).getB2DPoint(nPnt));
- return Point(FRound(aB2DPoint.getX()), FRound(aB2DPoint.getY()));
+ return Point(basegfx::fround<tools::Long>(aB2DPoint.getX()),
+ basegfx::fround<tools::Long>(aB2DPoint.getY()));
}
bool SdrPathObj::IsPolyObj() const
@@ -2443,7 +2447,8 @@ Point SdrPathObj::GetPoint(sal_uInt32 nHdlNum) const
{
const basegfx::B2DPolygon aPoly(GetPathPoly().getB2DPolygon(nPoly));
const basegfx::B2DPoint aPoint(aPoly.getB2DPoint(nPnt));
- aRetval = Point(FRound(aPoint.getX()), FRound(aPoint.getY()));
+ aRetval = Point(basegfx::fround<tools::Long>(aPoint.getX()),
+ basegfx::fround<tools::Long>(aPoint.getY()));
}
return aRetval;
@@ -2953,7 +2958,7 @@ void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
if(!basegfx::fTools::equalZero(fShearX))
{
aTransform.shearX(tan(-atan(fShearX)));
- maGeo.m_nShearAngle = Degree100(FRound(basegfx::rad2deg<100>(atan(fShearX))));
+ maGeo.m_nShearAngle = Degree100(basegfx::fround(basegfx::rad2deg<100>(atan(fShearX))));
maGeo.RecalcTan();
}
@@ -2967,7 +2972,7 @@ void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
// #i78696#
// fRotate is mathematically correct, but aGeoStat.nRotationAngle is
// mirrored -> mirror value here
- maGeo.m_nRotationAngle = NormAngle36000(Degree100(FRound(-basegfx::rad2deg<100>(fRotate))));
+ maGeo.m_nRotationAngle = NormAngle36000(Degree100(basegfx::fround(-basegfx::rad2deg<100>(fRotate))));
maGeo.RecalcSinCos();
}
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index 7f805a2d2892..fc07af830bfb 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -181,7 +181,7 @@ void SdrRectObj::TakeUnrotatedSnapRect(tools::Rectangle& rRect) const
if (maGeo.m_nShearAngle==0_deg100)
return;
- tools::Long nDst=FRound((getRectangle().Bottom()-getRectangle().Top()) * maGeo.mfTanShearAngle);
+ tools::Long nDst=basegfx::fround<tools::Long>((getRectangle().Bottom()-getRectangle().Top()) * maGeo.mfTanShearAngle);
if (maGeo.m_nShearAngle>0_deg100)
{
Point aRef(rRect.TopLeft());
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index e66e8ad01459..83e22a5ce60f 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1626,7 +1626,8 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
}
// build and set BaseRect (use scale)
- Size aSize(FRound(aScale.getX()), FRound(aScale.getY()));
+ Size aSize(basegfx::fround<tools::Long>(aScale.getX()),
+ basegfx::fround<tools::Long>(aScale.getY()));
tools::Rectangle aBaseRect(Point(), aSize);
SetSnapRect(aBaseRect);
@@ -1644,7 +1645,7 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
if(!basegfx::fTools::equalZero(fShearX))
{
GeoStat aGeoStat;
- aGeoStat.m_nShearAngle = Degree100(FRound(basegfx::rad2deg<100>(atan(fShearX))));
+ aGeoStat.m_nShearAngle = Degree100(basegfx::fround(basegfx::rad2deg<100>(atan(fShearX))));
aGeoStat.RecalcTan();
Shear(Point(), aGeoStat.m_nShearAngle, aGeoStat.mfTanShearAngle, false);
}
@@ -1657,7 +1658,7 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
// #i78696#
// fRotate is matematically correct, but aGeoStat.nRotationAngle is
// mirrored -> mirror value here
- aGeoStat.m_nRotationAngle = NormAngle36000(Degree100(FRound(-basegfx::rad2deg<100>(fRotate))));
+ aGeoStat.m_nRotationAngle = NormAngle36000(Degree100(basegfx::fround(-basegfx::rad2deg<100>(fRotate))));
aGeoStat.RecalcSinCos();
Rotate(Point(), aGeoStat.m_nRotationAngle, aGeoStat.mfSinRotationAngle, aGeoStat.mfCosRotationAngle);
}
@@ -1665,7 +1666,8 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
// translate?
if(!aTranslate.equalZero())
{
- Move(Size(FRound(aTranslate.getX()), FRound(aTranslate.getY())));
+ Move(Size(basegfx::fround<tools::Long>(aTranslate.getX()),
+ basegfx::fround<tools::Long>(aTranslate.getY())));
}
}
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index a2582da5e885..fcc4bf0bd85e 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -910,8 +910,8 @@ void SdrTextObj::impDecomposeAutoFitTextPrimitive(
setSuitableOutlinerBg(rOutliner);
// add one to range sizes to get back to the old Rectangle and outliner measurements
- const sal_uInt32 nAnchorTextWidth(FRound(aAnchorTextRange.getWidth() + 1));
- const sal_uInt32 nAnchorTextHeight(FRound(aAnchorTextRange.getHeight() + 1));
+ const sal_uInt32 nAnchorTextWidth(basegfx::fround<sal_uInt32>(aAnchorTextRange.getWidth() + 1));
+ const sal_uInt32 nAnchorTextHeight(basegfx::fround<sal_uInt32>(aAnchorTextRange.getHeight() + 1));
const OutlinerParaObject* pOutlinerParaObject = rSdrAutofitTextPrimitive.getSdrText()->GetOutlinerParaObject();
OSL_ENSURE(pOutlinerParaObject, "impDecomposeBlockTextPrimitive used with no OutlinerParaObject (!)");
const bool bVerticalWriting(pOutlinerParaObject->IsEffectivelyVertical());
@@ -1101,8 +1101,8 @@ void SdrTextObj::impDecomposeBlockTextPrimitive(
setSuitableOutlinerBg(rOutliner);
// add one to range sizes to get back to the old Rectangle and outliner measurements
- const sal_uInt32 nAnchorTextWidth(FRound(aAnchorTextRange.getWidth() + 1));
- const sal_uInt32 nAnchorTextHeight(FRound(aAnchorTextRange.getHeight() + 1));
+ const sal_uInt32 nAnchorTextWidth(basegfx::fround<sal_uInt32>(aAnchorTextRange.getWidth() + 1));
+ const sal_uInt32 nAnchorTextHeight(basegfx::fround<sal_uInt32>(aAnchorTextRange.getHeight() + 1));
const bool bVerticalWriting(rSdrBlockTextPrimitive.getOutlinerParaObject().IsEffectivelyVertical());
const bool bTopToBottom(rSdrBlockTextPrimitive.getOutlinerParaObject().IsTopToBottom());
const Size aAnchorTextSize(Size(nAnchorTextWidth, nAnchorTextHeight));
@@ -1717,8 +1717,8 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000));
// add one to range sizes to get back to the old Rectangle and outliner measurements
- const sal_uInt32 nAnchorTextWidth(FRound(aAnchorTextRange.getWidth() + 1));
- const sal_uInt32 nAnchorTextHeight(FRound(aAnchorTextRange.getHeight() + 1));
+ const sal_uInt32 nAnchorTextWidth(basegfx::fround<sal_uInt32>(aAnchorTextRange.getWidth() + 1));
+ const sal_uInt32 nAnchorTextHeight(basegfx::fround<sal_uInt32>(aAnchorTextRange.getHeight() + 1));
// Text
const OutlinerParaObject* pOutlinerParaObject = rSdrChainedTextPrimitive.getSdrText()->GetOutlinerParaObject();
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 102d7f8bf495..cf2c4ac28f1a 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -341,7 +341,8 @@ void ImpSdrPdfImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr)
if (bText && mbFntDirty)
{
vcl::Font aFnt(mpVD->GetFont());
- const sal_uInt32 nHeight(FRound(aFnt.GetFontSize().Height() * mfScaleY));
+ const sal_uInt32 nHeight(
+ basegfx::fround<sal_uInt32>(aFnt.GetFontSize().Height() * mfScaleY));
mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(),
aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO));
@@ -781,12 +782,13 @@ void ImpSdrPdfImport::InsertTextObject(const Point& rPos, const Size& rSize, con
// sal_Int32 nTextWidth = static_cast<sal_Int32>(mpVD->GetTextWidth(rStr) * mfScaleX);
sal_Int32 nTextHeight = static_cast<sal_Int32>(mpVD->GetTextHeight() * mfScaleY);
- Point aPosition(FRound(rPos.X() * mfScaleX + maOfs.X()),
- FRound(rPos.Y() * mfScaleY + maOfs.Y()));
- Size aSize(FRound(rSize.Width() * mfScaleX), FRound(rSize.Height() * mfScaleY));
+ Point aPosition(basegfx::fround<tools::Long>(rPos.X() * mfScaleX + maOfs.X()),
+ basegfx::fround<tools::Long>(rPos.Y() * mfScaleY + maOfs.Y()));
+ Size aSize(basegfx::fround<tools::Long>(rSize.Width() * mfScaleX),
+ basegfx::fround<tools::Long>(rSize.Height() * mfScaleY));
if (eAlignment == ALIGN_BASELINE)
- aPosition.AdjustY(-FRound(aFontMetric.GetAscent() * mfScaleY));
+ aPosition.AdjustY(basegfx::fround<tools::Long>(aFontMetric.GetAscent() * -mfScaleY));
else if (eAlignment == ALIGN_BOTTOM)
aPosition.AdjustY(-nTextHeight);
diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx
index 1cfca1ab94b8..8cd55cdbd019 100644
--- a/svx/source/svdraw/svdpoev.cxx
+++ b/svx/source/svdraw/svdpoev.cxx
@@ -553,19 +553,22 @@ void SdrPolyEditView::ImpTransformMarkedPoints(PPolyTrFunc pTrFunc, const void*
bool bC2(false);
const basegfx::B2DPoint aB2DPos(aNewXP.getB2DPoint(nPointNum));
- aPos = Point(FRound(aB2DPos.getX()), FRound(aB2DPos.getY()));
+ aPos = Point(basegfx::fround<tools::Long>(aB2DPos.getX()),
+ basegfx::fround<tools::Long>(aB2DPos.getY()));
if(aNewXP.isPrevControlPointUsed(nPointNum))
{
const basegfx::B2DPoint aB2DC1(aNewXP.getPrevControlPoint(nPointNum));
- aC1 = Point(FRound(aB2DC1.getX()), FRound(aB2DC1.getY()));
+ aC1 = Point(basegfx::fround<tools::Long>(aB2DC1.getX()),
+ basegfx::fround<tools::Long>(aB2DC1.getY()));
bC1 = true;
}
if(aNewXP.isNextControlPointUsed(nPointNum))
{
const basegfx::B2DPoint aB2DC2(aNewXP.getNextControlPoint(nPointNum));
- aC2 = Point(FRound(aB2DC2.getX()), FRound(aB2DC2.getY()));
+ aC2 = Point(basegfx::fround<tools::Long>(aB2DC2.getX()),
+ basegfx::fround<tools::Long>(aB2DC2.getY()));
bC2 = true;
}
diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx
index 23c7495ad7d7..9c5fb73060d7 100644
--- a/svx/source/svdraw/svdtrans.cxx
+++ b/svx/source/svdraw/svdtrans.cxx
@@ -46,8 +46,8 @@ void ResizeRect(tools::Rectangle& rRect, const Point& rRef, const Fraction& rxFa
tools::Long nWdt = rRect.Right() - rRect.Left();
if (nWdt == 0) rRect.AdjustRight( 1 );
}
- rRect.SetLeft( rRef.X() + FRound( (rRect.Left() - rRef.X()) * double(aXFact) ) );
- rRect.SetRight( rRef.X() + FRound( (rRect.Right() - rRef.X()) * double(aXFact) ) );
+ rRect.SetLeft( rRef.X() + basegfx::fround<tools::Long>( (rRect.Left() - rRef.X()) * double(aXFact) ) );
+ rRect.SetRight( rRef.X() + basegfx::fround<tools::Long>( (rRect.Right() - rRef.X()) * double(aXFact) ) );
if (!aYFact.IsValid()) {
SAL_WARN( "svx.svdraw", "invalid fraction yFract, using Fraction(1,1)" );
@@ -55,8 +55,8 @@ void ResizeRect(tools::Rectangle& rRect, const Point& rRef, const Fraction& rxFa
tools::Long nHgt = rRect.Bottom() - rRect.Top();
if (nHgt == 0) rRect.AdjustBottom( 1 );
}
- rRect.SetTop( rRef.Y() + FRound( (rRect.Top() - rRef.Y()) * double(aYFact) ) );
- rRect.SetBottom( rRef.Y() + FRound( (rRect.Bottom() - rRef.Y()) * double(aYFact) ) );
+ rRect.SetTop( rRef.Y() + basegfx::fround<tools::Long>( (rRect.Top() - rRef.Y()) * double(aYFact) ) );
+ rRect.SetBottom( rRef.Y() + basegfx::fround<tools::Long>( (rRect.Bottom() - rRef.Y()) * double(aYFact) ) );
rRect.Normalize();
}
@@ -178,7 +178,7 @@ double CrookRotateXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCent
// move into the direction of the center, as a basic position for the rotation
pC1->AdjustY( -y0 );
// resize, account for the distance from the center
- pC1->setY(FRound(static_cast<double>(pC1->Y()) /rRad.X()*(cx-pC1->X())) );
+ pC1->setY(basegfx::fround<tools::Long>(static_cast<double>(pC1->Y()) /rRad.X()*(cx-pC1->X())) );
pC1->AdjustY(cy );
} else {
// move into the direction of the center, as a basic position for the rotation
@@ -186,7 +186,7 @@ double CrookRotateXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCent
// resize, account for the distance from the center
tools::Long nPntRad=cy-pC1->Y();
double nFact=static_cast<double>(nPntRad)/static_cast<double>(rRad.Y());
- pC1->setX(FRound(static_cast<double>(pC1->X())*nFact) );
+ pC1->setX(basegfx::fround<tools::Long>(static_cast<double>(pC1->X()) * nFact));
pC1->AdjustX(cx );
}
RotatePoint(*pC1,rCenter,sn,cs);
@@ -196,7 +196,7 @@ double CrookRotateXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCent
// move into the direction of the center, as a basic position for the rotation
pC2->AdjustY( -y0 );
// resize, account for the distance from the center
- pC2->setY(FRound(static_cast<double>(pC2->Y()) /rRad.X()*(rCenter.X()-pC2->X())) );
+ pC2->setY(basegfx::fround<tools::Long>(static_cast<double>(pC2->Y()) /rRad.X()*(rCenter.X()-pC2->X())) );
pC2->AdjustY(cy );
} else {
// move into the direction of the center, as a basic position for the rotation
@@ -204,7 +204,7 @@ double CrookRotateXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCent
// resize, account for the distance from the center
tools::Long nPntRad=rCenter.Y()-pC2->Y();
double nFact=static_cast<double>(nPntRad)/static_cast<double>(rRad.Y());
- pC2->setX(FRound(static_cast<double>(pC2->X())*nFact) );
+ pC2->setX(basegfx::fround<tools::Long>(static_cast<double>(pC2->X()) * nFact));
pC2->AdjustX(cx );
}
RotatePoint(*pC2,rCenter,sn,cs);
@@ -283,7 +283,7 @@ double CrookStretchXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCen
tools::Long dy=rPnt.Y()-y0;
double a=static_cast<double>(y0-nTop)/nHgt;
a*=dy;
- rPnt.setY(y0+FRound(a) );
+ rPnt.setY(y0 + basegfx::fround<tools::Long>(a));
}
return 0.0;
}
@@ -393,7 +393,7 @@ Degree100 GetAngle(const Point& rPnt)
if (rPnt.Y()>0) a=-9000_deg100;
else a=9000_deg100;
} else {
- a = Degree100(FRound(basegfx::rad2deg<100>(atan2(static_cast<double>(-rPnt.Y()), static_cast<double>(rPnt.X())))));
+ a = Degree100(basegfx::fround(basegfx::rad2deg<100>(atan2(-static_cast<double>(rPnt.Y()), static_cast<double>(rPnt.X())))));
}
return a;
}
@@ -423,7 +423,7 @@ tools::Long GetLen(const Point& rPnt)
x*=x;
y*=y;
x+=y;
- x=FRound(sqrt(static_cast<double>(x)));
+ x = basegfx::fround<tools::Long>(sqrt(x));
return x;
} else {
double nx=x;
@@ -435,7 +435,7 @@ tools::Long GetLen(const Point& rPnt)
if (nx>0x7FFFFFFF) {
return 0x7FFFFFFF; // we can't go any further, for fear of an overrun!
} else {
- return FRound(nx);
+ return basegfx::fround<tools::Long>(nx);
}
}
}
diff --git a/svx/source/xoutdev/_xpoly.cxx b/svx/source/xoutdev/_xpoly.cxx
index e9f0f1ebad15..d93e56412b7b 100644
--- a/svx/source/xoutdev/_xpoly.cxx
+++ b/svx/source/xoutdev/_xpoly.cxx
@@ -407,9 +407,10 @@ tools::Rectangle XPolygon::GetBoundRect() const
// correct and never was.
const basegfx::B2DRange aPolygonRange(basegfx::utils::getRange(getB2DPolygon()));
- aRetval = tools::Rectangle(
- FRound(aPolygonRange.getMinX()), FRound(aPolygonRange.getMinY()),
- FRound(aPolygonRange.getMaxX()), FRound(aPolygonRange.getMaxY()));
+ aRetval = tools::Rectangle(basegfx::fround<tools::Long>(aPolygonRange.getMinX()),
+ basegfx::fround<tools::Long>(aPolygonRange.getMinY()),
+ basegfx::fround<tools::Long>(aPolygonRange.getMaxX()),
+ basegfx::fround<tools::Long>(aPolygonRange.getMaxY()));
}
return aRetval;
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 8db55a3887e7..9d447df9ba6d 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -788,8 +788,7 @@ GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA,
rGA.SetInvert( rSet.GetInvertGrf().GetValue() );
const sal_uInt16 nTrans = rSet.GetTransparencyGrf().GetValue();
- rGA.SetAlpha( 255 - static_cast<sal_uInt8>(FRound(
- std::min( nTrans, sal_uInt16(100) ) * 2.55 )) );
+ rGA.SetAlpha(255 - basegfx::fround<sal_uInt8>(nTrans * 2.55));
return rGA;
}
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index db50a42de053..f91283fccb87 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -3016,7 +3016,7 @@ bool SwFlyFrame::GetContour( tools::PolyPolygon& rContour,
else
aNewPoint = OutputDevice::LogicToLogic( rPoly[ i ], aGrfMap, aDispMap );
- rPoly[ i ] = Point( FRound( aNewPoint.getX() * fScaleX ), FRound( aNewPoint.getY() * fScaleY ) );
+ rPoly[ i ] = Point( basegfx::fround<tools::Long>( aNewPoint.getX() * fScaleX ), basegfx::fround<tools::Long>( aNewPoint.getY() * fScaleY ) );
}
}
}
diff --git a/tools/CppunitTest_tools_test.mk b/tools/CppunitTest_tools_test.mk
index 1063b778ab0a..c2087bcde594 100644
--- a/tools/CppunitTest_tools_test.mk
+++ b/tools/CppunitTest_tools_test.mk
@@ -29,7 +29,6 @@ $(eval $(call gb_CppunitTest_add_exception_objects,tools_test, \
tools/qa/cppunit/test_color \
tools/qa/cppunit/test_rectangle \
tools/qa/cppunit/test_100mm2twips \
- tools/qa/cppunit/test_fround \
tools/qa/cppunit/test_xmlwalker \
tools/qa/cppunit/test_xmlwriter \
tools/qa/cppunit/test_GenericTypeSerializer \
diff --git a/tools/qa/cppunit/test_fround.cxx b/tools/qa/cppunit/test_fround.cxx
deleted file mode 100644
index 4014ff3cb46b..000000000000
--- a/tools/qa/cppunit/test_fround.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sal/types.h>
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <tools/helpers.hxx>
-
-namespace tools
-{
-class FRoundTest : public CppUnit::TestFixture
-{
-public:
- void testPositiveFRound()
- {
- sal_Int64 nExpected = 2;
- sal_Int64 nActual = FRound(1.6);
- CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
-
- nExpected = 1;
- nActual = FRound(1.4);
- CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
- }
-
- void testNegativeFRound()
- {
- sal_Int64 nExpected = -2;
- sal_Int64 nActual = FRound(-1.6);
- CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
-
- nExpected = -1;
- nActual = FRound(-1.4);
- CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
- }
-
- CPPUNIT_TEST_SUITE(FRoundTest);
- CPPUNIT_TEST(testPositiveFRound);
- CPPUNIT_TEST(testNegativeFRound);
- CPPUNIT_TEST_SUITE_END();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(FRoundTest);
-} // namespace tools
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx
index 421045b588a9..208a6caee883 100644
--- a/tools/source/generic/color.cxx
+++ b/tools/source/generic/color.cxx
@@ -29,6 +29,7 @@
#include <tools/long.hxx>
#include <o3tl/string_view.hxx>
#include <basegfx/color/bcolortools.hxx>
+#include <basegfx/numeric/ftools.hxx>
void Color::IncreaseLuminance(sal_uInt8 cLumInc)
{
@@ -51,9 +52,9 @@ void Color::DecreaseContrast(sal_uInt8 nContDec)
const double fM = (128.0 - 0.4985 * nContDec) / 128.0;
const double fOff = 128.0 - fM * 128.0;
- R = sal_uInt8(std::clamp(FRound(R * fM + fOff), tools::Long(0), tools::Long(255)));
- G = sal_uInt8(std::clamp(FRound(G * fM + fOff), tools::Long(0), tools::Long(255)));
- B = sal_uInt8(std::clamp(FRound(B * fM + fOff), tools::Long(0), tools::Long(255)));
+ R = basegfx::fround<sal_uInt8>(R * fM + fOff);
+ G = basegfx::fround<sal_uInt8>(G * fM + fOff);
+ B = basegfx::fround<sal_uInt8>(B * fM + fOff);
}
}
diff --git a/tools/source/generic/line.cxx b/tools/source/generic/line.cxx
index ee9ad979793c..328ae3e35e66 100644
--- a/tools/source/generic/line.cxx
+++ b/tools/source/generic/line.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <basegfx/numeric/ftools.hxx>
#include <tools/line.hxx>
#include <tools/helpers.hxx>
@@ -37,8 +40,8 @@ bool Line::Intersection( const Line& rLine, Point& rIntersection ) const
if( Intersection( rLine, fX, fY ) )
{
- rIntersection.setX( FRound( fX ) );
- rIntersection.setY( FRound( fY ) );
+ rIntersection.setX(basegfx::fround<tools::Long>(fX));
+ rIntersection.setY(basegfx::fround<tools::Long>(fY));
bRet = true;
}
else
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 89405eea410a..81419f7e70c3 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -203,8 +203,8 @@ ImplPolygon::ImplPolygon( const Point& rCenter, tools::Long nRadX, tools::Long n
for( i=0, nAngle = 0.0; i < nPoints4; i++, nAngle += nAngleStep )
{
- tools::Long nX = FRound( nRadX * cos( nAngle ) );
- tools::Long nY = FRound( -nRadY * sin( nAngle ) );
+ tools::Long nX = basegfx::fround<tools::Long>(nRadX * cos(nAngle));
+ tools::Long nY = basegfx::fround<tools::Long>(nRadY * -sin(nAngle));
Point* pPt = &(mxPointAry[i]);
pPt->setX( nX + rCenter.X() );
@@ -291,7 +291,8 @@ ImplPolygon::ImplPolygon(const tools::Rectangle& rBound, const Point& rStart, co
if (PolyStyle::Pie == eStyle)
{
- const Point aCenter2(FRound(fCenterX), FRound(fCenterY));
+ const Point aCenter2(basegfx::fround<tools::Long>(fCenterX),
+ basegfx::fround<tools::Long>(fCenterY));
nStart = 1;
nEnd = nPoints + 1;
@@ -310,8 +311,8 @@ ImplPolygon::ImplPolygon(const tools::Rectangle& rBound, const Point& rStart, co
{
Point& rPt = mxPointAry[nStart];
- rPt.setX( FRound( fCenterX + fRadX * cos( fStart ) ) );
- rPt.setY( FRound( fCenterY - fRadY * sin( fStart ) ) );
+ rPt.setX(basegfx::fround<tools::Long>(fCenterX + fRadX * cos(fStart)));
+ rPt.setY(basegfx::fround<tools::Long>(fCenterY - fRadY * sin(fStart)));
}
if( PolyStyle::Chord == eStyle )
@@ -355,8 +356,8 @@ ImplPolygon::ImplPolygon( const Point& rBezPt1, const Point& rCtrlPt1,
double fK12 = fK_1 * fK1_2;
double fK21 = fK_2 * fK1_1;
- rPt.setX( FRound( fK1_3 * fX0 + fK12 * fX1 + fK21 * fX2 + fK_3 * fX3 ) );
- rPt.setY( FRound( fK1_3 * fY0 + fK12 * fY1 + fK21 * fY2 + fK_3 * fY3 ) );
+ rPt.setX(basegfx::fround<tools::Long>(fK1_3 * fX0 + fK12 * fX1 + fK21 * fX2 + fK_3 * fX3));
+ rPt.setY(basegfx::fround<tools::Long>(fK1_3 * fY0 + fK12 * fY1 + fK21 * fY2 + fK_3 * fY3));
}
}
@@ -399,7 +400,9 @@ ImplPolygon::ImplPolygon(const basegfx::B2DPolygon& rPolygon)
for(sal_uInt32 a(0); a < nLoopCount; a++)
{
// add current point (always) and remember StartPointIndex for evtl. later corrections
- const Point aStartPoint(FRound(aBezier.getStartPoint().getX()), FRound(aBezier.getStartPoint().getY()));
+ const Point aStartPoint(
+ basegfx::fround<tools::Long>(aBezier.getStartPoint().getX()),
+ basegfx::fround<tools::Long>(aBezier.getStartPoint().getY()));
const sal_uInt32 nStartPointIndex(nArrayInsert);
mxPointAry[nStartPointIndex] = aStartPoint;
mxFlagAry[nStartPointIndex] = PolyFlags::Normal;
@@ -414,11 +417,13 @@ ImplPolygon::ImplPolygon(const basegfx::B2DPolygon& rPolygon)
if(aBezier.isBezier())
{
// if one is used, add always two control points due to the old schema
- mxPointAry[nArrayInsert] = Point(FRound(aBezier.getControlPointA().getX()), FRound(aBezier.getControlPointA().getY()));
+ mxPointAry[nArrayInsert] = Point(basegfx::fround<tools::Long>(aBezier.getControlPointA().getX()),
+ basegfx::fround<tools::Long>(aBezier.getControlPointA().getY()));
mxFlagAry[nArrayInsert] = PolyFlags::Control;
nArrayInsert++;
- mxPointAry[nArrayInsert] = Point(FRound(aBezier.getControlPointB().getX()), FRound(aBezier.getControlPointB().getY()));
+ mxPointAry[nArrayInsert] = Point(basegfx::fround<tools::Long>(aBezier.getControlPointB().getX()),
+ basegfx::fround<tools::Long>(aBezier.getControlPointB().getY()));
mxFlagAry[nArrayInsert] = PolyFlags::Control;
nArrayInsert++;
}
@@ -453,7 +458,8 @@ ImplPolygon::ImplPolygon(const basegfx::B2DPolygon& rPolygon)
{
// add last point as closing point
const basegfx::B2DPoint aClosingPoint(rPolygon.getB2DPoint(nB2DLocalCount - 1));
- const Point aEnd(FRound(aClosingPoint.getX()), FRound(aClosingPoint.getY()));
+ const Point aEnd(basegfx::fround<tools::Long>(aClosingPoint.getX()),
+ basegfx::fround<tools::Long>(aClosingPoint.getY()));
mxPointAry[nArrayInsert] = aEnd;
mxFlagAry[nArrayInsert] = PolyFlags::Normal;
nArrayInsert++;
@@ -486,7 +492,8 @@ ImplPolygon::ImplPolygon(const basegfx::B2DPolygon& rPolygon)
for(sal_uInt32 a(0); a < nB2DLocalCount; a++)
{
basegfx::B2DPoint aB2DPoint(rPolygon.getB2DPoint(a));
- Point aPoint(FRound(aB2DPoint.getX()), FRound(aB2DPoint.getY()));
+ Point aPoint(basegfx::fround<tools::Long>(aB2DPoint.getX()),
+ basegfx::fround<tools::Long>(aB2DPoint.getY()));
mxPointAry[nIndex++] = aPoint;
}
@@ -1180,7 +1187,7 @@ static void ImplAdaptiveSubdivide( std::vector<Point>& rPoints,
// requested resolution reached.
// Add end points to output iterator.
// order is preserved, since this is so to say depth first traversal.
- rPoints.push_back(Point(FRound(P1x), FRound(P1y)));
+ rPoints.push_back(Point(basegfx::fround<tools::Long>(P1x), basegfx::fround<tools::Long>(P1y)));
}
}
@@ -1432,8 +1439,8 @@ void Polygon::Rotate( const Point& rCenter, double fSin, double fCos )
const tools::Long nX = rPt.X() - nCenterX;
const tools::Long nY = rPt.Y() - nCenterY;
- rPt.setX( FRound(fCos * nX + fSin * nY + nCenterX) );
- rPt.setY( FRound(-(fSin * nX - fCos * nY - nCenterY)) );
+ rPt.setX(basegfx::fround<tools::Long>(fCos * nX + fSin * nY + nCenterX));
+ rPt.setY(basegfx::fround<tools::Long>(-(fSin * nX - fCos * nY - nCenterY)));
}
}
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index dba377899838..eb8ed68add34 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -21,6 +21,7 @@
#include <memory>
+#include <basegfx/numeric/ftools.hxx>
#include <sal/macros.h>
#include <tools/helpers.hxx>
#include <tools/long.hxx>
@@ -1012,7 +1013,7 @@ static void updateWinDataInLiveResize(bool bInLiveResize)
// adapt NSEvent-sensitivity to application expectations
// TODO: rather make CommandWheelMode::ZOOM handlers smarter
const float fDeltaZ = mfMagnifyDeltaSum * fMagnifyFactor;
- int nDeltaZ = FRound( fDeltaZ );
+ int nDeltaZ = basegfx::fround<int>( fDeltaZ );
if( !nDeltaZ )
{
// handle new series immediately
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 0b8bec9dbbef..15a29b89e522 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -424,7 +424,8 @@ bool SkiaSalBitmap::Scale(const double& rScaleX, const double& rScaleY, BmpScale
#ifdef DBG_UTIL
assert(mWriteAccessCount == 0);
#endif
- Size newSize(FRound(mSize.Width() * rScaleX), FRound(mSize.Height() * rScaleY));
+ Size newSize(basegfx::fround<tools::Long>(mSize.Width() * rScaleX),
+ basegfx::fround<tools::Long>(mSize.Height() * rScaleY));
if (mSize == newSize)
return true;
diff --git a/vcl/source/animate/AnimationRenderer.cxx b/vcl/source/animate/AnimationRenderer.cxx
index 29f386e0d388..5755c549d3e5 100644
--- a/vcl/source/animate/AnimationRenderer.cxx
+++ b/vcl/source/animate/AnimationRenderer.cxx
@@ -121,11 +121,11 @@ void AnimationRenderer::getPosSize( const AnimationFrame& rAnimationFrame, Point
else
fFactY = 1.0;
- rPosPix.setX( FRound( rAnimationFrame.maPositionPixel.X() * fFactX ) );
- rPosPix.setY( FRound( rAnimationFrame.maPositionPixel.Y() * fFactY ) );
+ rPosPix.setX(basegfx::fround<tools::Long>(rAnimationFrame.maPositionPixel.X() * fFactX));
+ rPosPix.setY(basegfx::fround<tools::Long>(rAnimationFrame.maPositionPixel.Y() * fFactY));
- aPt2.setX( FRound( aPt2.X() * fFactX ) );
- aPt2.setY( FRound( aPt2.Y() * fFactY ) );
+ aPt2.setX(basegfx::fround<tools::Long>(aPt2.X() * fFactX));
+ aPt2.setY(basegfx::fround<tools::Long>(aPt2.Y() * fFactY));
rSizePix.setWidth( aPt2.X() - rPosPix.X() + 1 );
rSizePix.setHeight( aPt2.Y() - rPosPix.Y() + 1 );
diff --git a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
index 6fa5dd5c12b3..37c60e1b341a 100644
--- a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
+++ b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
@@ -47,7 +47,7 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& rBitmapEx) const
const double nLz = sin(fElev) * 255.0;
const double nNz = 6 * 255.0 / 4;
const double nNzLz = nNz * nLz;
- const sal_uInt8 cLz = FRound(std::clamp(nLz, 0.0, 255.0));
+ const sal_uInt8 cLz = basegfx::fround<sal_uInt8>(nLz);
// fill mapping tables
pHMap[0] = 0;
@@ -97,7 +97,7 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& rBitmapEx) const
else
{
const double fGrey = nDotL / std::hypot(nNx, nNy, nNz);
- aGrey.SetIndex(FRound(std::clamp(fGrey, 0.0, 255.0)));
+ aGrey.SetIndex(basegfx::fround<sal_uInt8>(fGrey));
}
pWriteAcc->SetPixelOnData(pScanline, nX, aGrey);
diff --git a/vcl/source/bitmap/BitmapFastScaleFilter.cxx b/vcl/source/bitmap/BitmapFastScaleFilter.cxx
index 431211369f98..584942457f74 100644
--- a/vcl/source/bitmap/BitmapFastScaleFilter.cxx
+++ b/vcl/source/bitmap/BitmapFastScaleFilter.cxx
@@ -32,8 +32,8 @@ BitmapEx BitmapFastScaleFilter::execute(BitmapEx const& rBitmapEx) const
Bitmap aBitmap(rBitmapEx.GetBitmap());
const Size aSizePix(aBitmap.GetSizePixel());
- const sal_Int32 nNewWidth = FRound(aSizePix.Width() * mfScaleX);
- const sal_Int32 nNewHeight = FRound(aSizePix.Height() * mfScaleY);
+ const sal_Int32 nNewWidth = basegfx::fround(aSizePix.Width() * mfScaleX);
+ const sal_Int32 nNewHeight = basegfx::fround(aSizePix.Height() * mfScaleY);
bool bRet = false;
SAL_INFO("vcl.gdi", "New width: " << nNewWidth << "\nNew height: " << nNewHeight);
diff --git a/vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx b/vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx
index c0c866b53d67..f4547677f23e 100644
--- a/vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx
+++ b/vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx
@@ -31,8 +31,8 @@ BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const
Bitmap aBitmap(rBitmapEx.GetBitmap());
const Size aSizePix(aBitmap.GetSizePixel());
- const sal_Int32 nNewWidth = FRound(aSizePix.Width() * mfScaleX);
- const sal_Int32 nNewHeight = FRound(aSizePix.Height() * mfScaleY);
+ const sal_Int32 nNewWidth = basegfx::fround(aSizePix.Width() * mfScaleX);
+ const sal_Int32 nNewHeight = basegfx::fround(aSizePix.Height() * mfScaleY);
bool bRet = false;
if ((nNewWidth > 1) && (nNewHeight > 1))
diff --git a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx
index 27df45f7bab1..56b2f3969a9e 100644
--- a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx
+++ b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx
@@ -90,7 +90,7 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc
// Do horizontal filtering
OSL_ENSURE(rScaleX > 0.0, "Error in scaling: Mirror given in non-mirror-capable method (!)");
const sal_Int32 nWidth(rSource.GetSizePixel().Width());
- const sal_Int32 nNewWidth(FRound(nWidth * rScaleX));
+ const sal_Int32 nNewWidth(basegfx::fround(nWidth * rScaleX));
if(nWidth == nNewWidth)
{
@@ -180,7 +180,7 @@ bool ImplScaleConvolutionVer(Bitmap& rSource, Bitmap& rTarget, const double& rSc
// Do vertical filtering
OSL_ENSURE(rScaleY > 0.0, "Error in scaling: Mirror given in non-mirror-capable method (!)");
const sal_Int32 nHeight(rSource.GetSizePixel().Height());
- const sal_Int32 nNewHeight(FRound(nHeight * rScaleY));
+ const sal_Int32 nNewHeight(basegfx::fround(nHeight * rScaleY));
if(nHeight == nNewHeight)
{
@@ -263,8 +263,8 @@ bool ImplScaleConvolution(Bitmap& rBitmap, const double& rScaleX, const double&
const double fScaleY(bMirrorVer ? -rScaleY : rScaleY);
const sal_Int32 nWidth(rBitmap.GetSizePixel().Width());
const sal_Int32 nHeight(rBitmap.GetSizePixel().Height());
- const sal_Int32 nNewWidth(FRound(nWidth * fScaleX));
- const sal_Int32 nNewHeight(FRound(nHeight * fScaleY));
+ const sal_Int32 nNewWidth(basegfx::fround(nWidth * fScaleX));
+ const sal_Int32 nNewHeight(basegfx::fround(nHeight * fScaleY));
const bool bScaleHor(nWidth != nNewWidth);
const bool bScaleVer(nHeight != nNewHeight);
const bool bMirror(bMirrorHor || bMirrorVer);
diff --git a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx
index 3c844c690e7e..1b13fb817d1b 100644
--- a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx
+++ b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx
@@ -870,8 +870,8 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const
double fScaleX = std::fabs(mrScaleX);
double fScaleY = std::fabs(mrScaleY);
- const sal_Int32 nDstW = FRound(aSizePix.Width() * fScaleX);
- const sal_Int32 nDstH = FRound(aSizePix.Height() * fScaleY);
+ const sal_Int32 nDstW = basegfx::fround(aSizePix.Width() * fScaleX);
+ const sal_Int32 nDstH = basegfx::fround(aSizePix.Height() * fScaleY);
constexpr double fScaleThresh = 0.6;
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx
index 4045a107c814..204e61b57073 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -1396,13 +1396,13 @@ Bitmap GetDownsampledBitmap(Size const& rDstSizeTwip, Point const& rSrcPt, Size
if (fBmpWH < fMaxWH)
{
- aNewBmpSize.setWidth(FRound(fMaxPixelY * fBmpWH));
- aNewBmpSize.setHeight(FRound(fMaxPixelY));
+ aNewBmpSize.setWidth(basegfx::fround<tools::Long>(fMaxPixelY * fBmpWH));
+ aNewBmpSize.setHeight(basegfx::fround<tools::Long>(fMaxPixelY));
}
else if (fBmpWH > 0.0)
{
- aNewBmpSize.setWidth(FRound(fMaxPixelX));
- aNewBmpSize.setHeight(FRound(fMaxPixelX / fBmpWH));
+ aNewBmpSize.setWidth(basegfx::fround<tools::Long>(fMaxPixelX));
+ aNewBmpSize.setHeight(basegfx::fround<tools::Long>(fMaxPixelX / fBmpWH));
}
if( aNewBmpSize.Width() && aNewBmpSize.Height() )
diff --git a/vcl/source/bitmap/Vectorizer.cxx b/vcl/source/bitmap/Vectorizer.cxx
index f385fa36cacb..d54046215122 100644
--- a/vcl/source/bitmap/Vectorizer.cxx
+++ b/vcl/source/bitmap/Vectorizer.cxx
@@ -687,7 +687,7 @@ bool Vectorizer::vectorize(BitmapEx const& rBitmap, GDIMetaFile& rMetafile)
fPercentStep_2 = 45.0 / n;
fPercent += 10.0;
- updateProgress(FRound(fPercent));
+ updateProgress(basegfx::fround<tools::Long>(fPercent));
for( sal_uInt16 i = 0; i < n; i++ )
{
@@ -697,7 +697,7 @@ bool Vectorizer::vectorize(BitmapEx const& rBitmap, GDIMetaFile& rMetafile)
ImplExpand( oMap, pRAcc.get(), aFindColor );
fPercent += fPercentStep_2;
- updateProgress(FRound(fPercent));
+ updateProgress(basegfx::fround<tools::Long>(fPercent));
if( oMap )
{
@@ -721,7 +721,7 @@ bool Vectorizer::vectorize(BitmapEx const& rBitmap, GDIMetaFile& rMetafile)
}
fPercent += fPercentStep_2;
- updateProgress(FRound(fPercent));
+ updateProgress(basegfx::fround<tools::Long>(fPercent));
}
if (rMetafile.GetActionSize())
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 )
{
diff --git a/vcl/source/filter/eps/eps.cxx b/vcl/source/filter/eps/eps.cxx
index cc29c7f429a0..046907a80927 100644
--- a/vcl/source/filter/eps/eps.cxx
+++ b/vcl/source/filter/eps/eps.cxx
@@ -1176,8 +1176,8 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
if( fScaleX != 1.0 || fScaleY != 1.0 )
{
aTmpMtf.Scale( fScaleX, fScaleY );
- aSrcPt.setX( FRound( aSrcPt.X() * fScaleX ) );
- aSrcPt.setY( FRound( aSrcPt.Y() * fScaleY ) );
+ aSrcPt.setX(basegfx::fround<tools::Long>(aSrcPt.X() * fScaleX));
+ aSrcPt.setY(basegfx::fround<tools::Long>(aSrcPt.Y() * fScaleY));
}
nMoveX = aDestPt.X() - aSrcPt.X();
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index 0277affb829f..cecdb98d8407 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -900,7 +900,7 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, K
const double fFactor = static_cast<double>(nWidth) / nNormWidth;
for( i = 0; i < ( nLen - 1 ); i++ )
- aOwnArray.set(i, FRound(aOwnArray[i] * fFactor));
+ aOwnArray.set(i, basegfx::fround(aOwnArray[i] * fFactor));
}
}
@@ -1219,8 +1219,8 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
if( fScaleX != 1.0 || fScaleY != 1.0 )
{
aTmpMtf.Scale( fScaleX, fScaleY );
- aSrcPt.setX( FRound( aSrcPt.X() * fScaleX ) );
- aSrcPt.setY( FRound( aSrcPt.Y() * fScaleY ) );
+ aSrcPt.setX(basegfx::fround<tools::Long>(aSrcPt.X() * fScaleX));
+ aSrcPt.setY(basegfx::fround<tools::Long>(aSrcPt.Y() * fScaleY));
}
nMoveX = aDestPt.X() - aSrcPt.X();
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 3e3267c8e647..ecd4ce5f7fb2 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -1571,8 +1571,8 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
if( fScaleX != 1.0 || fScaleY != 1.0 )
{
aTmpMtf.Scale( fScaleX, fScaleY );
- aSrcPt.setX( FRound( aSrcPt.X() * fScaleX ) );
- aSrcPt.setY( FRound( aSrcPt.Y() * fScaleY ) );
+ aSrcPt.setX(basegfx::fround<tools::Long>(aSrcPt.X() * fScaleX));
+ aSrcPt.setY(basegfx::fround<tools::Long>(aSrcPt.Y() * fScaleY));
}
nMoveX = aDestPt.X() - aSrcPt.X();
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index fb4ff37dfa9d..3979d3882b7c 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -749,8 +749,8 @@ void GDIMetaFile::Scale( double fScaleX, double fScaleY )
{
ScaleActions(fScaleX, fScaleY);
- m_aPrefSize.setWidth( FRound( m_aPrefSize.Width() * fScaleX ) );
- m_aPrefSize.setHeight( FRound( m_aPrefSize.Height() * fScaleY ) );
+ m_aPrefSize.setWidth(basegfx::fround<tools::Long>(m_aPrefSize.Width() * fScaleX));
+ m_aPrefSize.setHeight(basegfx::fround<tools::Long>(m_aPrefSize.Height() * fScaleY));
}
void GDIMetaFile::Scale( const Fraction& rScaleX, const Fraction& rScaleY )
@@ -795,8 +795,8 @@ Point GDIMetaFile::ImplGetRotatedPoint( const Point& rPt, const Point& rRotatePt
const tools::Long nX = rPt.X() - rRotatePt.X();
const tools::Long nY = rPt.Y() - rRotatePt.Y();
- return Point( FRound( fCos * nX + fSin * nY ) + rRotatePt.X() + rOffset.Width(),
- -FRound( fSin * nX - fCos * nY ) + rRotatePt.Y() + rOffset.Height() );
+ return { basegfx::fround<tools::Long>(fCos * nX + fSin * nY) + rRotatePt.X() + rOffset.Width(),
+ basegfx::fround<tools::Long>(fCos * nY - fSin * nX) + rRotatePt.Y() + rOffset.Height() };
}
tools::Polygon GDIMetaFile::ImplGetRotatedPolygon( const tools::Polygon& rPoly, const Point& rRotatePt,
@@ -2108,15 +2108,15 @@ void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent,
{
if(!msoBrightness)
{
- aColParam.pMapR[ nX ] = FRound(std::clamp( nX * fM + fROff, 0.0, 255.0 ));
- aColParam.pMapG[ nX ] = FRound(std::clamp( nX * fM + fGOff, 0.0, 255.0 ));
- aColParam.pMapB[ nX ] = FRound(std::clamp( nX * fM + fBOff, 0.0, 255.0 ));
+ aColParam.pMapR[nX] = basegfx::fround<sal_uInt8>(nX * fM + fROff);
+ aColParam.pMapG[nX] = basegfx::fround<sal_uInt8>(nX * fM + fGOff);
+ aColParam.pMapB[nX] = basegfx::fround<sal_uInt8>(nX * fM + fBOff);
}
else
{
- aColParam.pMapR[ nX ] = FRound(std::clamp( (nX+fROff/2-128) * fM + 128 + fROff/2, 0.0, 255.0 ));
- aColParam.pMapG[ nX ] = FRound(std::clamp( (nX+fGOff/2-128) * fM + 128 + fGOff/2, 0.0, 255.0 ));
- aColParam.pMapB[ nX ] = FRound(std::clamp( (nX+fBOff/2-128) * fM + 128 + fBOff/2, 0.0, 255.0 ));
+ aColParam.pMapR[nX] = basegfx::fround<sal_uInt8>((nX+fROff/2-128) * fM + 128 + fROff/2);
+ aColParam.pMapG[nX] = basegfx::fround<sal_uInt8>((nX+fGOff/2-128) * fM + 128 + fGOff/2);
+ aColParam.pMapB[nX] = basegfx::fround<sal_uInt8>((nX+fBOff/2-128) * fM + 128 + fBOff/2);
}
if( bGamma )
{
@@ -2298,17 +2298,17 @@ bool GDIMetaFile::CreateThumbnail(BitmapEx& rBitmapEx, BmpConversion eColorConve
if ( fWH <= 1.0 )
{
- aSizePix.setWidth( FRound( nMaximumExtent * fWH ) );
+ aSizePix.setWidth(basegfx::fround<tools::Long>(nMaximumExtent * fWH));
aSizePix.setHeight( nMaximumExtent );
}
else
{
aSizePix.setWidth( nMaximumExtent );
- aSizePix.setHeight( FRound( nMaximumExtent / fWH ) );
+ aSizePix.setHeight(basegfx::fround<tools::Long>(nMaximumExtent / fWH));
}
- aDrawSize.setWidth( FRound( ( static_cast< double >( aDrawSize.Width() ) * aSizePix.Width() ) / aOldSizePix.Width() ) );
- aDrawSize.setHeight( FRound( ( static_cast< double >( aDrawSize.Height() ) * aSizePix.Height() ) / aOldSizePix.Height() ) );
+ aDrawSize.setWidth( basegfx::fround<tools::Long>( ( static_cast< double >( aDrawSize.Width() ) * aSizePix.Width() ) / aOldSizePix.Width() ) );
+ aDrawSize.setHeight( basegfx::fround<tools::Long>( ( static_cast< double >( aDrawSize.Height() ) * aSizePix.Height() ) / aOldSizePix.Height() ) );
}
// draw image(s) into VDev and get resulting image
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index a7e7c01f2936..b6971d7c8bda 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -40,8 +40,8 @@ namespace
void ImplScalePoint( Point& rPt, double fScaleX, double fScaleY )
{
- rPt.setX( FRound( fScaleX * rPt.X() ) );
- rPt.setY( FRound( fScaleY * rPt.Y() ) );
+ rPt.setX(basegfx::fround<tools::Long>(fScaleX * rPt.X()));
+ rPt.setY(basegfx::fround<tools::Long>(fScaleY * rPt.Y()));
}
void ImplScaleRect( tools::Rectangle& rRect, double fScaleX, double fScaleY )
@@ -68,10 +68,10 @@ void ImplScaleLineInfo( LineInfo& rLineInfo, double fScaleX, double fScaleY )
{
const double fScale = ( fabs(fScaleX) + fabs(fScaleY) ) * 0.5;
- rLineInfo.SetWidth( FRound( fScale * rLineInfo.GetWidth() ) );
- rLineInfo.SetDashLen( FRound( fScale * rLineInfo.GetDashLen() ) );
- rLineInfo.SetDotLen( FRound( fScale * rLineInfo.GetDotLen() ) );
- rLineInfo.SetDistance( FRound( fScale * rLineInfo.GetDistance() ) );
+ rLineInfo.SetWidth(fScale * rLineInfo.GetWidth());
+ rLineInfo.SetDashLen(fScale * rLineInfo.GetDashLen());
+ rLineInfo.SetDotLen(fScale * rLineInfo.GetDotLen());
+ rLineInfo.SetDistance(fScale * rLineInfo.GetDistance());
}
}
@@ -319,8 +319,8 @@ void MetaRoundRectAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
void MetaRoundRectAction::Scale( double fScaleX, double fScaleY )
{
ImplScaleRect( maRect, fScaleX, fScaleY );
- mnHorzRound = FRound( mnHorzRound * fabs(fScaleX) );
- mnVertRound = FRound( mnVertRound * fabs(fScaleY) );
+ mnHorzRound = basegfx::fround<sal_uInt32>(mnHorzRound * fabs(fScaleX));
+ mnVertRound = basegfx::fround<sal_uInt32>(mnVertRound * fabs(fScaleY));
}
MetaEllipseAction::MetaEllipseAction() :
@@ -701,7 +701,7 @@ void MetaTextArrayAction::Scale( double fScaleX, double fScaleY )
if ( !maDXAry.empty() && mnLen )
{
for ( sal_uInt16 i = 0, nCount = mnLen; i < nCount; i++ )
- maDXAry.set(i, FRound(maDXAry[i] * fabs(fScaleX)));
+ maDXAry.set(i, basegfx::fround(maDXAry[i] * fabs(fScaleX)));
}
}
@@ -774,7 +774,7 @@ void MetaStretchTextAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
void MetaStretchTextAction::Scale( double fScaleX, double fScaleY )
{
ImplScalePoint( maPt, fScaleX, fScaleY );
- mnWidth = static_cast<sal_uLong>(FRound( mnWidth * fabs(fScaleX) ));
+ mnWidth = basegfx::fround<sal_uInt32>(mnWidth * fabs(fScaleX));
}
MetaTextRectAction::MetaTextRectAction() :
MetaAction ( MetaActionType::TEXTRECT ),
@@ -864,7 +864,7 @@ void MetaTextLineAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
void MetaTextLineAction::Scale( double fScaleX, double fScaleY )
{
ImplScalePoint( maPos, fScaleX, fScaleY );
- mnWidth = FRound( mnWidth * fabs(fScaleX) );
+ mnWidth = basegfx::fround<tools::Long>(mnWidth * fabs(fScaleX));
}
MetaBmpAction::MetaBmpAction() :
@@ -1549,8 +1549,8 @@ rtl::Reference<MetaAction> MetaMoveClipRegionAction::Clone() const
void MetaMoveClipRegionAction::Scale( double fScaleX, double fScaleY )
{
- mnHorzMove = FRound( mnHorzMove * fScaleX );
- mnVertMove = FRound( mnVertMove * fScaleY );
+ mnHorzMove = basegfx::fround<tools::Long>(mnHorzMove * fScaleX);
+ mnVertMove = basegfx::fround<tools::Long>(mnVertMove * fScaleY);
}
MetaLineColorAction::MetaLineColorAction() :
@@ -1799,8 +1799,8 @@ rtl::Reference<MetaAction> MetaFontAction::Clone() const
void MetaFontAction::Scale( double fScaleX, double fScaleY )
{
const Size aSize(
- FRound(maFont.GetFontSize().Width() * fabs(fScaleX)),
- FRound(maFont.GetFontSize().Height() * fabs(fScaleY)));
+ basegfx::fround<tools::Long>(maFont.GetFontSize().Width() * fabs(fScaleX)),
+ basegfx::fround<tools::Long>(maFont.GetFontSize().Height() * fabs(fScaleY)));
maFont.SetFontSize( aSize );
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 4d33471177d2..d780b0c4f88e 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -8630,12 +8630,12 @@ void PDFWriterImpl::drawPolyLine( const tools::Polygon& rPoly, const PDFWriter::
const sal_uInt32 nNextIndex((a + 1) % nPointCount);
const basegfx::B2DPoint aNext(aPoly.getB2DPoint(nNextIndex));
- m_aPages.back().appendPoint( Point( FRound(aCurrent.getX()),
- FRound(aCurrent.getY()) ),
+ m_aPages.back().appendPoint( Point( basegfx::fround<tools::Long>(aCurrent.getX()),
+ basegfx::fround<tools::Long>(aCurrent.getY()) ),
aLine );
aLine.append( " m " );
- m_aPages.back().appendPoint( Point( FRound(aNext.getX()),
- FRound(aNext.getY()) ),
+ m_aPages.back().appendPoint( Point( basegfx::fround<tools::Long>(aNext.getX()),
+ basegfx::fround<tools::Long>(aNext.getY()) ),
aLine );
aLine.append( " l" );
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index 58fc31aafdf8..b83a41b2c556 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -139,13 +139,13 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
if( fBmpWH < fMaxWH )
{
- aNewBmpSize.setWidth( FRound( fMaxPixelY * fBmpWH ) );
- aNewBmpSize.setHeight( FRound( fMaxPixelY ) );
+ aNewBmpSize.setWidth(basegfx::fround<tools::Long>(fMaxPixelY * fBmpWH));
+ aNewBmpSize.setHeight(basegfx::fround<tools::Long>(fMaxPixelY));
}
else if( fBmpWH > 0.0 )
{
- aNewBmpSize.setWidth( FRound( fMaxPixelX ) );
- aNewBmpSize.setHeight( FRound( fMaxPixelX / fBmpWH) );
+ aNewBmpSize.setWidth(basegfx::fround<tools::Long>(fMaxPixelX));
+ aNewBmpSize.setHeight(basegfx::fround<tools::Long>(fMaxPixelX / fBmpWH));
}
if( aNewBmpSize.Width() && aNewBmpSize.Height() )
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 42013175e131..06625a4227bd 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -153,10 +153,10 @@ void Printer::ImplPrintTransparent( const Bitmap& rBmp,
// create forward mapping tables
for( nX = 0; nX <= nSrcWidth; nX++ )
- pMapX[ nX ] = aDestPt.X() + FRound( static_cast<double>(aDestSz.Width()) * nX / nSrcWidth );
+ pMapX[ nX ] = aDestPt.X() + basegfx::fround<tools::Long>( static_cast<double>(aDestSz.Width()) * nX / nSrcWidth );
for( nY = 0; nY <= nSrcHeight; nY++ )
- pMapY[ nY ] = aDestPt.Y() + FRound( static_cast<double>(aDestSz.Height()) * nY / nSrcHeight );
+ pMapY[ nY ] = aDestPt.Y() + basegfx::fround<tools::Long>( static_cast<double>(aDestSz.Height()) * nY / nSrcHeight );
tools::Rectangle rectangle { Point(0,0), aSrcRect.GetSize() };
const Point aMapPt(pMapX[rectangle.Left()], pMapY[rectangle.Top()]);
@@ -228,7 +228,7 @@ void Printer::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,
tools::Rectangle aPolyRect( LogicToPixel( rPolyPoly ).GetBoundRect() );
const Size aDPISize( LogicToPixel(Size(1, 1), MapMode(MapUnit::MapInch)) );
- const tools::Long nBaseExtent = std::max<tools::Long>( FRound( aDPISize.Width() / 300. ), 1 );
+ const tools::Long nBaseExtent = std::max<tools::Long>( basegfx::fround<tools::Long>( aDPISize.Width() / 300. ), 1 );
tools::Long nMove;
const sal_uInt16 nTrans = ( nTransparencePercent < 13 ) ? 0 :
( nTransparencePercent < 38 ) ? 25 :
@@ -731,10 +731,10 @@ void Printer::DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor,
// create forward mapping tables
for( nX = 0; nX <= nSrcWidth; nX++ )
- pMapX[ nX ] = aDestPt.X() + FRound( static_cast<double>(aDestSz.Width()) * nX / nSrcWidth );
+ pMapX[ nX ] = aDestPt.X() + basegfx::fround<tools::Long>( static_cast<double>(aDestSz.Width()) * nX / nSrcWidth );
for( nY = 0; nY <= nSrcHeight; nY++ )
- pMapY[ nY ] = aDestPt.Y() + FRound( static_cast<double>(aDestSz.Height()) * nY / nSrcHeight );
+ pMapY[ nY ] = aDestPt.Y() + basegfx::fround<tools::Long>( static_cast<double>(aDestSz.Height()) * nY / nSrcHeight );
// walk through all rectangles of mask
const vcl::Region aWorkRgn(aMask.CreateRegion(COL_BLACK, tools::Rectangle(Point(), aMask.GetSizePixel())));
diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx
index 91d292519faf..68c90a9e0ed4 100644
--- a/vcl/source/gdi/regband.cxx
+++ b/vcl/source/gdi/regband.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <basegfx/numeric/ftools.hxx>
#include <tools/helpers.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
@@ -314,8 +317,8 @@ void ImplRegionBand::ScaleX( double fHorzScale )
ImplRegionBandSep* pSep = mpFirstSep;
while ( pSep )
{
- pSep->mnXLeft = FRound( pSep->mnXLeft * fHorzScale );
- pSep->mnXRight = FRound( pSep->mnXRight * fHorzScale );
+ pSep->mnXLeft = basegfx::fround<tools::Long>(pSep->mnXLeft * fHorzScale);
+ pSep->mnXRight = basegfx::fround<tools::Long>(pSep->mnXRight * fHorzScale);
pSep = pSep->mpNextSep;
}
}
diff --git a/vcl/source/graphic/GraphicObject.cxx b/vcl/source/graphic/GraphicObject.cxx
index 3ba9ef64ce94..109f55af2403 100644
--- a/vcl/source/graphic/GraphicObject.cxx
+++ b/vcl/source/graphic/GraphicObject.cxx
@@ -385,20 +385,20 @@ bool GraphicObject::ImplGetCropParams(const OutputDevice& rOut, Point& rPt, Size
if( !aSize100.IsEmpty() && nTotalWidth > 0 && nTotalHeight > 0 )
{
double fScale = static_cast<double>(aSize100.Width()) / nTotalWidth;
- const tools::Long nNewLeft = -FRound( ( ( pAttr->GetMirrorFlags() & BmpMirrorFlags::Horizontal ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale );
- const tools::Long nNewRight = nNewLeft + FRound( aSize100.Width() * fScale ) - 1;
+ const tools::Long nNewLeft = basegfx::fround<tools::Long>( ( ( pAttr->GetMirrorFlags() & BmpMirrorFlags::Horizontal ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * -fScale );
+ const tools::Long nNewRight = nNewLeft + basegfx::fround<tools::Long>( aSize100.Width() * fScale ) - 1;
fScale = static_cast<double>(rSz.Width()) / aSize100.Width();
- rPt.AdjustX(FRound( nNewLeft * fScale ) );
- rSz.setWidth( FRound( ( nNewRight - nNewLeft + 1 ) * fScale ) );
+ rPt.AdjustX(basegfx::fround<tools::Long>(nNewLeft * fScale));
+ rSz.setWidth(basegfx::fround<tools::Long>((nNewRight - nNewLeft + 1) * fScale));
fScale = static_cast<double>(aSize100.Height()) / nTotalHeight;
- const tools::Long nNewTop = -FRound( ( ( pAttr->GetMirrorFlags() & BmpMirrorFlags::Vertical ) ? pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale );
- const tools::Long nNewBottom = nNewTop + FRound( aSize100.Height() * fScale ) - 1;
+ const tools::Long nNewTop = basegfx::fround<tools::Long>( ( ( pAttr->GetMirrorFlags() & BmpMirrorFlags::Vertical ) ? pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * -fScale );
+ const tools::Long nNewBottom = nNewTop + basegfx::fround<tools::Long>( aSize100.Height() * fScale ) - 1;
fScale = static_cast<double>(rSz.Height()) / aSize100.Height();
- rPt.AdjustY(FRound( nNewTop * fScale ) );
- rSz.setHeight( FRound( ( nNewBottom - nNewTop + 1 ) * fScale ) );
+ rPt.AdjustY(basegfx::fround<tools::Long>(nNewTop * fScale));
+ rSz.setHeight(basegfx::fround<tools::Long>((nNewBottom - nNewTop + 1) * fScale));
if( nRot10 )
{
diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx
index 1e1b2bdd2ddf..49dfd0e95892 100644
--- a/vcl/source/helper/canvastools.cxx
+++ b/vcl/source/helper/canvastools.cxx
@@ -323,8 +323,8 @@ namespace vcl::unotools
::Size sizeFromB2DSize( const basegfx::B2DVector& rVec )
{
- return ::Size( FRound( rVec.getX() ),
- FRound( rVec.getY() ) );
+ return ::Size(basegfx::fround<tools::Long>(rVec.getX()),
+ basegfx::fround<tools::Long>(rVec.getY()));
}
::Point pointFromB2DPoint( const basegfx::B2DPoint& rPoint )
diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx
index d154420b6b4d..09629d7eedcc 100644
--- a/vcl/source/outdev/hatch.cxx
+++ b/vcl/source/outdev/hatch.cxx
@@ -280,10 +280,10 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
{
const double fAngle = std::abs( toRadians(nAngle) );
const double fTan = tan( fAngle );
- const tools::Long nYOff = FRound( ( rRect.Right() - rRect.Left() ) * fTan );
+ const tools::Long nYOff = basegfx::fround<tools::Long>( ( rRect.Right() - rRect.Left() ) * fTan );
tools::Long nPY;
- nDist = FRound( nDist / cos( fAngle ) );
+ nDist = basegfx::fround<tools::Long>(nDist / cos(fAngle));
rInc = Size( 0, nDist );
if( nAngle > 0_deg10 )
@@ -291,14 +291,14 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
rPt1 = rRect.TopLeft();
rPt2 = Point( rRect.Right(), rRect.Top() - nYOff );
rEndPt1 = Point( rRect.Left(), rRect.Bottom() + nYOff );
- nPY = FRound( aRef.Y() - ( ( rPt1.X() - aRef.X() ) * fTan ) );
+ nPY = basegfx::fround<tools::Long>(aRef.Y() - ((rPt1.X() - aRef.X()) * fTan));
}
else
{
rPt1 = rRect.TopRight();
rPt2 = Point( rRect.Left(), rRect.Top() - nYOff );
rEndPt1 = Point( rRect.Right(), rRect.Bottom() + nYOff );
- nPY = FRound( aRef.Y() + ( ( rPt1.X() - aRef.X() ) * fTan ) );
+ nPY = basegfx::fround<tools::Long>(aRef.Y() + ((rPt1.X() - aRef.X()) * fTan));
}
if( nPY <= rPt1.Y() )
@@ -313,10 +313,10 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
{
const double fAngle = std::abs( toRadians(nAngle) );
const double fTan = tan( fAngle );
- const tools::Long nXOff = FRound( (static_cast<double>(rRect.Bottom()) - rRect.Top()) / fTan );
+ const tools::Long nXOff = basegfx::fround<tools::Long>( (static_cast<double>(rRect.Bottom()) - rRect.Top()) / fTan );
tools::Long nPX;
- nDist = FRound( nDist / sin( fAngle ) );
+ nDist = basegfx::fround<tools::Long>(nDist / sin(fAngle));
rInc = Size( nDist, 0 );
if( nAngle > 0_deg10 )
@@ -324,14 +324,14 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
rPt1 = rRect.TopLeft();
rPt2 = Point( rRect.Left() - nXOff, rRect.Bottom() );
rEndPt1 = Point( rRect.Right() + nXOff, rRect.Top() );
- nPX = FRound( aRef.X() - ( (static_cast<double>(rPt1.Y()) - aRef.Y()) / fTan ) );
+ nPX = basegfx::fround<tools::Long>( aRef.X() - ( (static_cast<double>(rPt1.Y()) - aRef.Y()) / fTan ) );
}
else
{
rPt1 = rRect.BottomLeft();
rPt2 = Point( rRect.Left() - nXOff, rRect.Top() );
rEndPt1 = Point( rRect.Right() + nXOff, rRect.Bottom() );
- nPX = FRound( aRef.X() + ( (static_cast<double>(rPt1.Y()) - aRef.Y()) / fTan ) );
+ nPX = basegfx::fround<tools::Long>( aRef.X() + ( (static_cast<double>(rPt1.Y()) - aRef.Y()) / fTan ) );
}
if( nPX <= rPt1.X() )
@@ -401,7 +401,8 @@ void OutputDevice::DrawHatchLine( const tools::Line& rLine, const tools::PolyPol
SAL_WARN("vcl.gdi", "too many hatch points");
return;
}
- pPtBuffer[ nPCounter++ ] = Point( FRound( fX ), FRound( fY ) );
+ pPtBuffer[nPCounter++] = Point(basegfx::fround<tools::Long>(fX),
+ basegfx::fround<tools::Long>(fY));
}
}
diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx
index 63ec16c62c61..227263f23fdf 100644
--- a/vcl/source/outdev/rect.cxx
+++ b/vcl/source/outdev/rect.cxx
@@ -377,10 +377,10 @@ BmpMirrorFlags AdjustTwoRect( SalTwoRect& rTwoRect, const Size& rSizePix )
const double fFactorX = ( rTwoRect.mnSrcWidth > 1 ) ? static_cast<double>( rTwoRect.mnDestWidth - 1 ) / ( rTwoRect.mnSrcWidth - 1 ) : 0.0;
const double fFactorY = ( rTwoRect.mnSrcHeight > 1 ) ? static_cast<double>( rTwoRect.mnDestHeight - 1 ) / ( rTwoRect.mnSrcHeight - 1 ) : 0.0;
- const tools::Long nDstX1 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Left() - rTwoRect.mnSrcX ) );
- const tools::Long nDstY1 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Top() - rTwoRect.mnSrcY ) );
- const tools::Long nDstX2 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Right() - rTwoRect.mnSrcX ) );
- const tools::Long nDstY2 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Bottom() - rTwoRect.mnSrcY ) );
+ const tools::Long nDstX1 = rTwoRect.mnDestX + basegfx::fround<tools::Long>( fFactorX * ( aCropRect.Left() - rTwoRect.mnSrcX ) );
+ const tools::Long nDstY1 = rTwoRect.mnDestY + basegfx::fround<tools::Long>( fFactorY * ( aCropRect.Top() - rTwoRect.mnSrcY ) );
+ const tools::Long nDstX2 = rTwoRect.mnDestX + basegfx::fround<tools::Long>( fFactorX * ( aCropRect.Right() - rTwoRect.mnSrcX ) );
+ const tools::Long nDstY2 = rTwoRect.mnDestY + basegfx::fround<tools::Long>( fFactorY * ( aCropRect.Bottom() - rTwoRect.mnSrcY ) );
rTwoRect.mnSrcX = aCropRect.Left();
rTwoRect.mnSrcY = aCropRect.Top();
@@ -419,10 +419,10 @@ void AdjustTwoRect( SalTwoRect& rTwoRect, const tools::Rectangle& rValidSrcRect
const double fFactorX = ( rTwoRect.mnSrcWidth > 1 ) ? static_cast<double>( rTwoRect.mnDestWidth - 1 ) / ( rTwoRect.mnSrcWidth - 1 ) : 0.0;
const double fFactorY = ( rTwoRect.mnSrcHeight > 1 ) ? static_cast<double>( rTwoRect.mnDestHeight - 1 ) / ( rTwoRect.mnSrcHeight - 1 ) : 0.0;
- const tools::Long nDstX1 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Left() - rTwoRect.mnSrcX ) );
- const tools::Long nDstY1 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Top() - rTwoRect.mnSrcY ) );
- const tools::Long nDstX2 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Right() - rTwoRect.mnSrcX ) );
- const tools::Long nDstY2 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Bottom() - rTwoRect.mnSrcY ) );
+ const tools::Long nDstX1 = rTwoRect.mnDestX + basegfx::fround<tools::Long>( fFactorX * ( aCropRect.Left() - rTwoRect.mnSrcX ) );
+ const tools::Long nDstY1 = rTwoRect.mnDestY + basegfx::fround<tools::Long>( fFactorY * ( aCropRect.Top() - rTwoRect.mnSrcY ) );
+ const tools::Long nDstX2 = rTwoRect.mnDestX + basegfx::fround<tools::Long>( fFactorX * ( aCropRect.Right() - rTwoRect.mnSrcX ) );
+ const tools::Long nDstY2 = rTwoRect.mnDestY + basegfx::fround<tools::Long>( fFactorY * ( aCropRect.Bottom() - rTwoRect.mnSrcY ) );
rTwoRect.mnSrcX = aCropRect.Left();
rTwoRect.mnSrcY = aCropRect.Top();
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index 51937edc48ff..3155cb1a1681 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -774,7 +774,7 @@ void OutputDevice::ImplDrawTextLine( tools::Long nX, tools::Long nY,
{
tools::Long nXAdd = nWidth - nDistX;
if( mpFontInstance->mnOrientation )
- nXAdd = FRound( nXAdd * cos( toRadians(mpFontInstance->mnOrientation) ) );
+ nXAdd = basegfx::fround<tools::Long>( nXAdd * cos( toRadians(mpFontInstance->mnOrientation) ) );
nX += nXAdd - 1;
}
@@ -847,7 +847,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, FontStrikeout eStri
{
const double nDY = aPos.getY() - aStartPt.getY();
const double fRad = toRadians(mpFontInstance->mnOrientation);
- nDist = FRound( nDist*cos(fRad) - nDY*sin(fRad) );
+ nDist = basegfx::fround<tools::Long>(nDist * cos(fRad) - nDY * sin(fRad));
}
}
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index 7588dec55647..cba0d16e3537 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -336,7 +336,7 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,
{
ScopedVclPtrInstance< VirtualDevice > aVDev(*this);
const Size aDstSz( aDstRect.GetSize() );
- const sal_uInt8 cTrans = FRound( std::clamp( nTransparencePercent * 2.55, 0.0, 255.0 ) );
+ const sal_uInt8 cTrans = basegfx::fround<sal_uInt8>(nTransparencePercent * 2.55);
if( aDstRect.Left() || aDstRect.Top() )
aPolyPoly.Move( -aDstRect.Left(), -aDstRect.Top() );
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index ceaebf52bea8..48f4b56dde97 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -420,8 +420,8 @@ void Window::SetZoomedPointFont(vcl::RenderContext& rRenderContext, const vcl::F
{
vcl::Font aFont(rFont);
Size aSize = aFont.GetFontSize();
- aSize.setWidth( FRound(double(aSize.Width() * rZoom)) );
- aSize.setHeight( FRound(double(aSize.Height() * rZoom)) );
+ aSize.setWidth(basegfx::fround<tools::Long>(double(aSize.Width() * rZoom)));
+ aSize.setHeight(basegfx::fround<tools::Long>(double(aSize.Height() * rZoom)));
aFont.SetFontSize(aSize);
SetPointFont(rRenderContext, aFont);
}
@@ -438,7 +438,7 @@ tools::Long Window::CalcZoom( tools::Long nCalc ) const
if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
{
double n = double(nCalc * rZoom);
- nCalc = FRound( n );
+ nCalc = basegfx::fround<tools::Long>(n);
}
return nCalc;
}
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index ea58dd62b659..c673fdc740e9 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -41,6 +41,7 @@
#include <sal/log.hxx>
#include <rtl/uri.hxx>
+#include <basegfx/numeric/ftools.hxx>
#include <vcl/settings.hxx>
#include <dlfcn.h>
@@ -17507,7 +17508,7 @@ private:
sal_Int64 fromGtk(double fValue) const
{
- return FRound(fValue * Power10(get_digits()));
+ return basegfx::fround64(fValue * Power10(get_digits()));
}
#if !GTK_CHECK_VERSION(4, 0, 0)
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 01a97c5be666..a701fff5dd12 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -1552,7 +1552,7 @@ void XMLShapeExport::ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple cons
}
mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
- FRound(aTRScale.getX()));
+ basegfx::fround(aTRScale.getX()));
aStr = sStringBuffer.makeStringAndClear();
mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr);
@@ -1570,7 +1570,7 @@ void XMLShapeExport::ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple cons
}
mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
- FRound(aTRScale.getY()));
+ basegfx::fround(aTRScale.getY()));
aStr = sStringBuffer.makeStringAndClear();
mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr);
@@ -1605,7 +1605,7 @@ void XMLShapeExport::ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple cons
{
// svg: x
mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
- FRound(rTRTranslate.getX()));
+ basegfx::fround(rTRTranslate.getX()));
aStr = sStringBuffer.makeStringAndClear();
mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr);
}
@@ -1614,7 +1614,7 @@ void XMLShapeExport::ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple cons
{
// svg: y
mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
- FRound(rTRTranslate.getY()));
+ basegfx::fround(rTRTranslate.getY()));
aStr = sStringBuffer.makeStringAndClear();
mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr);
}
@@ -2163,7 +2163,8 @@ void XMLShapeExport::ImpExportLineShape(
ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
// create base position
- awt::Point aBasePosition(FRound(aTRTranslate.getX()), FRound(aTRTranslate.getY()));
+ awt::Point aBasePosition(basegfx::fround(aTRTranslate.getX()),
+ basegfx::fround(aTRTranslate.getY()));
if (xPropSet->getPropertySetInfo()->hasPropertyByName("Geometry"))
{
@@ -2321,7 +2322,8 @@ void XMLShapeExport::ImpExportPolygonShape(
ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
// create and export ViewBox
- awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY()));
+ awt::Size aSize(basegfx::fround<tools::Long>(aTRScale.getX()),
+ basegfx::fround<tools::Long>(aTRScale.getY()));
SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
@@ -2814,7 +2816,8 @@ void XMLShapeExport::ImpExportConnectorShape(
fTRRotate, aTRTranslate, pRefPoint);
// fdo#49678: create and export ViewBox
- awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY()));
+ awt::Size aSize(basegfx::fround<tools::Long>(aTRScale.getX()),
+ basegfx::fround<tools::Long>(aTRScale.getY()));
SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());