Kaydet (Commit) a82b177f authored tarafından Stephan Bergmann's avatar Stephan Bergmann

More loplugin:cstylecast: basegfx

auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: Ifa4a6643b41525c962cd6af5776e1bf10bddb71c
üst 6070aaa4
......@@ -52,7 +52,7 @@ namespace basegfx
for(sal_uInt32 a(1);;)
{
const B2DPoint aNext(rBase.interpolatePoint((double)a / (double)mnEdgeCount));
const B2DPoint aNext(rBase.interpolatePoint(static_cast<double>(a) / static_cast<double>(mnEdgeCount)));
const B2DVector aEdge(aNext - aCurrent);
fLength += aEdge.getLength();
......
......@@ -691,8 +691,8 @@ namespace basegfx
}
// look right and left for even smaller distances
double fStepValue(1.0 / (double)((nPointCount - 1) * 2)); // half the edge step width
double fPosition((double)nSmallestIndex / (double)(nPointCount - 1));
double fStepValue(1.0 / static_cast<double>((nPointCount - 1) * 2)); // half the edge step width
double fPosition(static_cast<double>(nSmallestIndex) / static_cast<double>(nPointCount - 1));
while(true)
{
......
......@@ -423,7 +423,7 @@ namespace basegfx
if(aWork.ludcmp(nIndex, nParity))
{
fRetval = (double)nParity;
fRetval = static_cast<double>(nParity);
// last line needs no multiply if not existing; default value would be 1.
const sal_uInt16 nMaxLine(
......
......@@ -187,8 +187,8 @@ namespace basegfx
for(sal_uInt32 a(0); a < nTempPointCount; a++)
{
const temporaryPoint& rTempPoint = rPointVector[a];
const double fCutPosInPolygon((double)rTempPoint.getIndex() + rTempPoint.getCut());
const double fRelativeCutPos(fCutPosInPolygon / (double)nEdgeCount);
const double fCutPosInPolygon(static_cast<double>(rTempPoint.getIndex()) + rTempPoint.getCut());
const double fRelativeCutPos(fCutPosInPolygon / static_cast<double>(nEdgeCount));
rTempPoints.emplace_back(rTempPoint.getPoint(), nInd, fRelativeCutPos);
}
}
......
......@@ -573,7 +573,7 @@ namespace basegfx
{
// if fDistance >= fLength decrement with multiple of fLength
sal_uInt32 nCount(sal_uInt32(fDistance / fLength));
fDistance -= (double)nCount * fLength;
fDistance -= static_cast<double>(nCount) * fLength;
}
else
{
......@@ -884,7 +884,7 @@ namespace basegfx
CutFlagValue aRetval(CutFlagValue::NONE);
double fCut1(0.0);
double fCut2(0.0);
bool bFinished(!((bool)(aCutFlags & CutFlagValue::ALL)));
bool bFinished(!static_cast<bool>(aCutFlags & CutFlagValue::ALL));
// test for same points?
if(!bFinished
......@@ -2765,7 +2765,7 @@ namespace basegfx
for(sal_uInt32 a(0); a < nLoopCount; a++)
{
const double fRelativePos((double)a / (double)nSegments); // 0.0 .. 1.0
const double fRelativePos(static_cast<double>(a) / static_cast<double>(nSegments)); // 0.0 .. 1.0
const B2DPoint aNewPoint(getPositionRelative(rCandidate, fRelativePos, fLength));
aRetval.append(aNewPoint);
}
......@@ -3285,8 +3285,8 @@ namespace basegfx
const css::drawing::FlagSequence& rFlagSequenceSource,
bool bCheckClosed)
{
const sal_uInt32 nCount((sal_uInt32)rPointSequenceSource.getLength());
OSL_ENSURE(nCount == (sal_uInt32)rFlagSequenceSource.getLength(),
const sal_uInt32 nCount(static_cast<sal_uInt32>(rPointSequenceSource.getLength()));
OSL_ENSURE(nCount == static_cast<sal_uInt32>(rFlagSequenceSource.getLength()),
"UnoPolygonBezierCoordsToB2DPolygon: Unequal count of Points and Flags (!)");
// prepare new polygon
......@@ -3483,8 +3483,8 @@ namespace basegfx
const sal_uInt32 nTargetCount(aCollectPoints.size());
OSL_ENSURE(nTargetCount == aCollectFlags.size(), "Unequal Point and Flag count (!)");
rPointSequenceRetval.realloc((sal_Int32)nTargetCount);
rFlagSequenceRetval.realloc((sal_Int32)nTargetCount);
rPointSequenceRetval.realloc(static_cast<sal_Int32>(nTargetCount));
rFlagSequenceRetval.realloc(static_cast<sal_Int32>(nTargetCount));
css::awt::Point* pPointSequence = rPointSequenceRetval.getArray();
css::drawing::PolygonFlags* pFlagSequence = rFlagSequenceRetval.getArray();
......@@ -3502,8 +3502,8 @@ namespace basegfx
// straightforward point list creation
const sal_uInt32 nTargetCount(nPointCount + (bClosed ? 1 : 0));
rPointSequenceRetval.realloc((sal_Int32)nTargetCount);
rFlagSequenceRetval.realloc((sal_Int32)nTargetCount);
rPointSequenceRetval.realloc(static_cast<sal_Int32>(nTargetCount));
rFlagSequenceRetval.realloc(static_cast<sal_Int32>(nTargetCount));
css::awt::Point* pPointSequence = rPointSequenceRetval.getArray();
css::drawing::PolygonFlags* pFlagSequence = rFlagSequenceRetval.getArray();
......
......@@ -861,8 +861,8 @@ namespace basegfx
else
{
// poly and hole. They neutralize, so get rid of both. Move securely below zero.
rHelperA.mnDepth = -((sal_Int32)nCount);
rHelperB.mnDepth = -((sal_Int32)nCount);
rHelperA.mnDepth = - static_cast<sal_Int32>(nCount);
rHelperB.mnDepth = - static_cast<sal_Int32>(nCount);
}
}
else
......
......@@ -637,11 +637,11 @@ namespace basegfx
const css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsSource)
{
B2DPolyPolygon aRetval;
const sal_uInt32 nSequenceCount((sal_uInt32)rPolyPolygonBezierCoordsSource.Coordinates.getLength());
const sal_uInt32 nSequenceCount(static_cast<sal_uInt32>(rPolyPolygonBezierCoordsSource.Coordinates.getLength()));
if(nSequenceCount)
{
OSL_ENSURE(nSequenceCount == (sal_uInt32)rPolyPolygonBezierCoordsSource.Flags.getLength(),
OSL_ENSURE(nSequenceCount == static_cast<sal_uInt32>(rPolyPolygonBezierCoordsSource.Flags.getLength()),
"UnoPolyPolygonBezierCoordsToB2DPolyPolygon: unequal number of Points and Flags (!)");
const css::drawing::PointSequence* pPointSequence = rPolyPolygonBezierCoordsSource.Coordinates.getConstArray();
const css::drawing::FlagSequence* pFlagSequence = rPolyPolygonBezierCoordsSource.Flags.getConstArray();
......@@ -671,8 +671,8 @@ namespace basegfx
if(nCount)
{
// prepare return value memory
rPolyPolygonBezierCoordsRetval.Coordinates.realloc((sal_Int32)nCount);
rPolyPolygonBezierCoordsRetval.Flags.realloc((sal_Int32)nCount);
rPolyPolygonBezierCoordsRetval.Coordinates.realloc(static_cast<sal_Int32>(nCount));
rPolyPolygonBezierCoordsRetval.Flags.realloc(static_cast<sal_Int32>(nCount));
// get pointers to arrays
css::drawing::PointSequence* pPointSequence = rPolyPolygonBezierCoordsRetval.Coordinates.getArray();
......
......@@ -254,8 +254,8 @@ namespace basegfx
nVerSeg = std::min(nMaxSegments, std::max(nMinSegments, nVerSeg));
// create constants
const double fVerDiffPerStep((fVerStop - fVerStart) / (double)nVerSeg);
const double fHorDiffPerStep((fHorStop - fHorStart) / (double)nHorSeg);
const double fVerDiffPerStep((fVerStop - fVerStart) / static_cast<double>(nVerSeg));
const double fHorDiffPerStep((fHorStop - fHorStart) / static_cast<double>(nHorSeg));
bool bHorClosed(fTools::equal(fHorStop - fHorStart, F_2PI));
bool bVerFromTop(fTools::equal(fVerStart, F_PI2));
bool bVerToBottom(fTools::equal(fVerStop, -F_PI2));
......@@ -267,12 +267,12 @@ namespace basegfx
for(a = nLoopVerInit; a < nLoopVerLimit; a++)
{
const double fVer(fVerStart + ((double)a * fVerDiffPerStep));
const double fVer(fVerStart + (static_cast<double>(a) * fVerDiffPerStep));
B3DPolygon aNew;
for(b = 0; b < nLoopHorLimit; b++)
{
const double fHor(fHorStart + ((double)b * fHorDiffPerStep));
const double fHor(fHorStart + (static_cast<double>(b) * fHorDiffPerStep));
aNew.append(getPointFromCartesian(fHor, fVer));
}
......@@ -283,7 +283,7 @@ namespace basegfx
// create vertical half-rings
for(a = 0; a < nLoopHorLimit; a++)
{
const double fHor(fHorStart + ((double)a * fHorDiffPerStep));
const double fHor(fHorStart + (static_cast<double>(a) * fHorDiffPerStep));
B3DPolygon aNew;
if(bVerFromTop)
......@@ -293,7 +293,7 @@ namespace basegfx
for(b = nLoopVerInit; b < nLoopVerLimit; b++)
{
const double fVer(fVerStart + ((double)b * fVerDiffPerStep));
const double fVer(fVerStart + (static_cast<double>(b) * fVerDiffPerStep));
aNew.append(getPointFromCartesian(fHor, fVer));
}
......
......@@ -366,7 +366,7 @@ namespace basegfx
void incrementRasterConversionLineEntry3D(sal_uInt32 nStep, InterpolatorProvider3D& rProvider)
{
const double fStep((double)nStep);
const double fStep(static_cast<double>(nStep));
maX.increment(fStep);
maZ.increment(fStep);
mnY += nStep;
......
......@@ -30,10 +30,10 @@ namespace basegfx
{
namespace RectClipFlags
{
static const sal_uInt32 LEFT = (sal_Int32)0x01;
static const sal_uInt32 RIGHT = (sal_Int32)0x02;
static const sal_uInt32 TOP = (sal_Int32)0x04;
static const sal_uInt32 BOTTOM = (sal_Int32)0x08;
static const sal_uInt32 LEFT = sal_Int32(0x01);
static const sal_uInt32 RIGHT = sal_Int32(0x02);
static const sal_uInt32 TOP = sal_Int32(0x04);
static const sal_uInt32 BOTTOM = sal_Int32(0x08);
}
/** Calc clip mask for Cohen-Sutherland rectangle clip
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment