summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-08 16:55:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-08 20:17:31 +0200
commit84cbd6a5434e119613d677370e7657ea77cd7767 (patch)
tree9dd079b3e9eeea70a89718ad918c488583c96d6c /basegfx
parent44786fad67cf48f6091e868cf0476e754650d385 (diff)
clang-tidy modernize-use-emplace in b*
Change-Id: I51e0369ba2e1fe0b7c934531f71d3bda95ba09ec Reviewed-on: https://gerrit.libreoffice.org/42109 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/polygon/b2dpolygoncutandtouch.cxx18
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx20
-rw-r--r--basegfx/source/polygon/b2dpolygontriangulator.cxx2
-rw-r--r--basegfx/source/polygon/b2dpolypolygoncutter.cxx4
-rw-r--r--basegfx/source/polygon/b2dtrapezoid.cxx67
-rw-r--r--basegfx/source/range/b2drangeclipper.cxx20
-rw-r--r--basegfx/source/raster/rasterconvert3d.cxx20
-rw-r--r--basegfx/source/tools/unotools.cxx8
8 files changed, 70 insertions, 89 deletions
diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
index 74f60b17a59d..6f164d2965ec 100644
--- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
+++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
@@ -189,7 +189,7 @@ namespace basegfx
const temporaryPoint& rTempPoint = rPointVector[a];
const double fCutPosInPolygon((double)rTempPoint.getIndex() + rTempPoint.getCut());
const double fRelativeCutPos(fCutPosInPolygon / (double)nEdgeCount);
- rTempPoints.push_back(temporaryPoint(rTempPoint.getPoint(), nInd, fRelativeCutPos));
+ rTempPoints.emplace_back(rTempPoint.getPoint(), nInd, fRelativeCutPos);
}
}
}
@@ -251,8 +251,8 @@ namespace basegfx
// add a cut point to each list. The lists may be the same for
// self intersections.
const B2DPoint aCutPoint(interpolate(rCurrA, rNextA, fCut));
- rTempPointsA.push_back(temporaryPoint(aCutPoint, nIndA, fCut));
- rTempPointsB.push_back(temporaryPoint(aCutPoint, nIndB, fCut2));
+ rTempPointsA.emplace_back(aCutPoint, nIndA, fCut);
+ rTempPointsB.emplace_back(aCutPoint, nIndB, fCut2);
}
}
}
@@ -340,13 +340,13 @@ namespace basegfx
// by outer methods and would just produce a double point
if(a)
{
- rTempPointsA.push_back(temporaryPoint(aCurrA, a, 0.0));
+ rTempPointsA.emplace_back(aCurrA, a, 0.0);
}
}
else
{
const B2DPoint aCutPoint(interpolate(aCurrA, aNextA, fCutA));
- rTempPointsA.push_back(temporaryPoint(aCutPoint, a, fCutA));
+ rTempPointsA.emplace_back(aCutPoint, a, fCutA);
}
// #i111715# use fTools::equal instead of fTools::equalZero for better accuracy
@@ -356,13 +356,13 @@ namespace basegfx
// by outer methods and would just produce a double point
if(b)
{
- rTempPointsB.push_back(temporaryPoint(aCurrB, b, 0.0));
+ rTempPointsB.emplace_back(aCurrB, b, 0.0);
}
}
else
{
const B2DPoint aCutPoint(interpolate(aCurrB, aNextB, fCutB));
- rTempPointsB.push_back(temporaryPoint(aCutPoint, b, fCutB));
+ rTempPointsB.emplace_back(aCutPoint, b, fCutB);
}
}
}
@@ -414,7 +414,7 @@ namespace basegfx
// append remapped tempVector entries for edge to tempPoints for edge
for(temporaryPoint & rTempPoint : aTempPointVectorEdge)
{
- rTempPointsB.push_back(temporaryPoint(rTempPoint.getPoint(), nIndB, rTempPoint.getCut()));
+ rTempPointsB.emplace_back(rTempPoint.getPoint(), nIndB, rTempPoint.getCut());
}
}
@@ -641,7 +641,7 @@ namespace basegfx
if(fTools::more(fCut, fZero) && fTools::less(fCut, fOne))
{
- rTempPoints.push_back(temporaryPoint(aTestPoint, nInd, fCut));
+ rTempPoints.emplace_back(aTestPoint, nInd, fCut);
}
}
}
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index 80f3da07d50b..00ba32193db5 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -3419,10 +3419,9 @@ namespace basegfx
{
// add current point (always) and remember StartPointIndex for evtl. later corrections
const sal_uInt32 nStartPointIndex(aCollectPoints.size());
- aCollectPoints.push_back(
- css::awt::Point(
+ aCollectPoints.emplace_back(
fround(aBezierSegment.getStartPoint().getX()),
- fround(aBezierSegment.getStartPoint().getY())));
+ fround(aBezierSegment.getStartPoint().getY()));
aCollectFlags.push_back(css::drawing::PolygonFlags_NORMAL);
// prepare next segment
@@ -3434,16 +3433,14 @@ namespace basegfx
if(aBezierSegment.isBezier())
{
// if bezier is used, add always two control points due to the old schema
- aCollectPoints.push_back(
- css::awt::Point(
+ aCollectPoints.emplace_back(
fround(aBezierSegment.getControlPointA().getX()),
- fround(aBezierSegment.getControlPointA().getY())));
+ fround(aBezierSegment.getControlPointA().getY()));
aCollectFlags.push_back(css::drawing::PolygonFlags_CONTROL);
- aCollectPoints.push_back(
- css::awt::Point(
+ aCollectPoints.emplace_back(
fround(aBezierSegment.getControlPointB().getX()),
- fround(aBezierSegment.getControlPointB().getY())));
+ fround(aBezierSegment.getControlPointB().getY()));
aCollectFlags.push_back(css::drawing::PolygonFlags_CONTROL);
}
@@ -3476,10 +3473,9 @@ namespace basegfx
{
// add last point as closing point
const B2DPoint aClosingPoint(rPolygon.getB2DPoint(nPointCount - 1));
- aCollectPoints.push_back(
- css::awt::Point(
+ aCollectPoints.emplace_back(
fround(aClosingPoint.getX()),
- fround(aClosingPoint.getY())));
+ fround(aClosingPoint.getY()));
aCollectFlags.push_back(css::drawing::PolygonFlags_NORMAL);
}
diff --git a/basegfx/source/polygon/b2dpolygontriangulator.cxx b/basegfx/source/polygon/b2dpolygontriangulator.cxx
index c446bea22a6c..4a85547d7de3 100644
--- a/basegfx/source/polygon/b2dpolygontriangulator.cxx
+++ b/basegfx/source/polygon/b2dpolygontriangulator.cxx
@@ -233,7 +233,7 @@ namespace basegfx
if( !aPrevPnt.equal(aNextPnt) )
{
- maStartEntries.push_back(EdgeEntry(aPrevPnt, aNextPnt));
+ maStartEntries.emplace_back(aPrevPnt, aNextPnt);
}
aPrevPnt = aNextPnt;
diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
index cbd5a50112af..1c72680a325a 100644
--- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx
+++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
@@ -449,13 +449,13 @@ namespace basegfx
if(pLast->getX() != aMiddle.getX() || pLast->getY() != aMiddle.getY())
{
- maCorrectionTable.push_back(CorrectionPair(*pLast, aMiddle));
+ maCorrectionTable.emplace_back(*pLast, aMiddle);
*pLast = aMiddle;
}
if(pCurrent->getX() != aMiddle.getX() || pCurrent->getY() != aMiddle.getY())
{
- maCorrectionTable.push_back(CorrectionPair(*pCurrent, aMiddle));
+ maCorrectionTable.emplace_back(*pCurrent, aMiddle);
*pCurrent = aMiddle;
}
}
diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx
index c92a64a3a903..8572e8d18754 100644
--- a/basegfx/source/polygon/b2dtrapezoid.cxx
+++ b/basegfx/source/polygon/b2dtrapezoid.cxx
@@ -556,7 +556,7 @@ namespace basegfx
if(!fTools::equal(pPrev->getX(), pCurr->getX()))
{
// X-order not needed, just add
- aTrDeSimpleEdges.push_back(TrDeSimpleEdge(pPrev, pCurr));
+ aTrDeSimpleEdges.emplace_back(pPrev, pCurr);
const double fMiddle((pPrev->getY() + pCurr->getY()) * 0.5);
pPrev->setY(fMiddle);
@@ -567,7 +567,7 @@ namespace basegfx
{
// vertical edge. Positive Y-direction is guaranteed by the
// TrDeEdgeEntry constructor
- maTrDeEdgeEntries.push_back(TrDeEdgeEntry(pPrev, pCurr, 0));
+ maTrDeEdgeEntries.emplace_back(pPrev, pCurr, 0);
mnInitialEdgeEntryCount++;
}
@@ -874,14 +874,13 @@ namespace basegfx
// the two edges start at the same Y, they use the same DeltaY, they
// do not cut themselves and not any other edge in range. Create a
// B2DTrapezoid and consume both edges
- ro_Result.push_back(
- B2DTrapezoid(
+ ro_Result.emplace_back(
aLeft.getStart().getX(),
aRight.getStart().getX(),
aLeft.getStart().getY(),
aLeftEnd.getX(),
aRightEnd.getX(),
- aLeftEnd.getY()));
+ aLeftEnd.getY());
maTrDeEdgeEntries.pop_front();
maTrDeEdgeEntries.pop_front();
@@ -980,14 +979,13 @@ namespace basegfx
const double fLeftX(rPointA.getX() - fHalfLineWidth);
const double fRightX(rPointA.getX() + fHalfLineWidth);
- ro_Result.push_back(
- B2DTrapezoid(
+ ro_Result.emplace_back(
fLeftX,
fRightX,
std::min(rPointA.getY(), rPointB.getY()),
fLeftX,
fRightX,
- std::max(rPointA.getY(), rPointB.getY())));
+ std::max(rPointA.getY(), rPointB.getY()));
}
else if(fTools::equal(rPointA.getY(), rPointB.getY()))
{
@@ -995,14 +993,13 @@ namespace basegfx
const double fLeftX(std::min(rPointA.getX(), rPointB.getX()));
const double fRightX(std::max(rPointA.getX(), rPointB.getX()));
- ro_Result.push_back(
- B2DTrapezoid(
+ ro_Result.emplace_back(
fLeftX,
fRightX,
rPointA.getY() - fHalfLineWidth,
fLeftX,
fRightX,
- rPointA.getY() + fHalfLineWidth));
+ rPointA.getY() + fHalfLineWidth);
}
else
{
@@ -1021,10 +1018,10 @@ namespace basegfx
// create EdgeEntries
basegfx::trapezoidhelper::TrDeEdgeEntries aTrDeEdgeEntries;
- aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aStartLow, &aStartHigh, 0));
- aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aStartHigh, &aEndHigh, 0));
- aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aEndHigh, &aEndLow, 0));
- aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aEndLow, &aStartLow, 0));
+ aTrDeEdgeEntries.emplace_back(&aStartLow, &aStartHigh, 0);
+ aTrDeEdgeEntries.emplace_back(&aStartHigh, &aEndHigh, 0);
+ aTrDeEdgeEntries.emplace_back(&aEndHigh, &aEndLow, 0);
+ aTrDeEdgeEntries.emplace_back(&aEndLow, &aStartLow, 0);
aTrDeEdgeEntries.sort();
// here we know we have exactly four edges, and they do not cut, touch or
@@ -1038,26 +1035,24 @@ namespace basegfx
if(bEndOnSameLine)
{
// create two triangle trapezoids
- ro_Result.push_back(
- B2DTrapezoid(
+ ro_Result.emplace_back(
aLeft.getStart().getX(),
aRight.getStart().getX(),
aLeft.getStart().getY(),
aLeft.getEnd().getX(),
aRight.getEnd().getX(),
- aLeft.getEnd().getY()));
+ aLeft.getEnd().getY());
basegfx::trapezoidhelper::TrDeEdgeEntries::reference aLeft2(*aCurrent++);
basegfx::trapezoidhelper::TrDeEdgeEntries::reference aRight2(*aCurrent++);
- ro_Result.push_back(
- B2DTrapezoid(
+ ro_Result.emplace_back(
aLeft2.getStart().getX(),
aRight2.getStart().getX(),
aLeft2.getStart().getY(),
aLeft2.getEnd().getX(),
aRight2.getEnd().getX(),
- aLeft2.getEnd().getY()));
+ aLeft2.getEnd().getY());
}
else
{
@@ -1072,32 +1067,29 @@ namespace basegfx
const B2DPoint aSplitLeft(aLeft.getCutPointForGivenY(aRight.getEnd().getY()));
const B2DPoint aSplitRight(aRight2.getCutPointForGivenY(aLeft.getEnd().getY()));
- ro_Result.push_back(
- B2DTrapezoid(
+ ro_Result.emplace_back(
aLeft.getStart().getX(),
aRight.getStart().getX(),
aLeft.getStart().getY(),
aSplitLeft.getX(),
aRight.getEnd().getX(),
- aRight.getEnd().getY()));
+ aRight.getEnd().getY());
- ro_Result.push_back(
- B2DTrapezoid(
+ ro_Result.emplace_back(
aSplitLeft.getX(),
aRight.getEnd().getX(),
aRight.getEnd().getY(),
aLeft2.getStart().getX(),
aSplitRight.getX(),
- aLeft2.getStart().getY()));
+ aLeft2.getStart().getY());
- ro_Result.push_back(
- B2DTrapezoid(
+ ro_Result.emplace_back(
aLeft2.getStart().getX(),
aSplitRight.getX(),
aLeft2.getStart().getY(),
aLeft2.getEnd().getX(),
aRight2.getEnd().getX(),
- aLeft2.getEnd().getY()));
+ aLeft2.getEnd().getY());
}
else
{
@@ -1106,32 +1098,29 @@ namespace basegfx
const B2DPoint aSplitRight(aRight.getCutPointForGivenY(aLeft.getEnd().getY()));
const B2DPoint aSplitLeft(aLeft2.getCutPointForGivenY(aRight.getEnd().getY()));
- ro_Result.push_back(
- B2DTrapezoid(
+ ro_Result.emplace_back(
aLeft.getStart().getX(),
aRight.getStart().getX(),
aLeft.getStart().getY(),
aLeft.getEnd().getX(),
aSplitRight.getX(),
- aLeft.getEnd().getY()));
+ aLeft.getEnd().getY());
- ro_Result.push_back(
- B2DTrapezoid(
+ ro_Result.emplace_back(
aLeft.getEnd().getX(),
aSplitRight.getX(),
aLeft.getEnd().getY(),
aSplitLeft.getX(),
aRight.getEnd().getX(),
- aRight2.getStart().getY()));
+ aRight2.getStart().getY());
- ro_Result.push_back(
- B2DTrapezoid(
+ ro_Result.emplace_back(
aSplitLeft.getX(),
aRight.getEnd().getX(),
aRight2.getStart().getY(),
aLeft2.getEnd().getX(),
aRight2.getEnd().getX(),
- aLeft2.getEnd().getY()));
+ aLeft2.getEnd().getY());
}
}
}
diff --git a/basegfx/source/range/b2drangeclipper.cxx b/basegfx/source/range/b2drangeclipper.cxx
index c4b8d83a1b71..2b68bae713ad 100644
--- a/basegfx/source/range/b2drangeclipper.cxx
+++ b/basegfx/source/range/b2drangeclipper.cxx
@@ -542,12 +542,11 @@ namespace basegfx
{
const B2DRectangle& rCurrRect( *aCurrRect++ );
- o_rEventVector.push_back(
- SweepLineEvent( rCurrRect.getMinX(),
+ o_rEventVector.emplace_back( rCurrRect.getMinX(),
rCurrRect,
SweepLineEvent::STARTING_EDGE,
(*aCurrOrientation++) == B2VectorOrientation::Positive ?
- SweepLineEvent::PROCEED_UP : SweepLineEvent::PROCEED_DOWN) );
+ SweepLineEvent::PROCEED_UP : SweepLineEvent::PROCEED_DOWN );
}
// second pass: add all right edges in reversed order
@@ -558,12 +557,11 @@ namespace basegfx
{
const B2DRectangle& rCurrRect( *aCurrRectR++ );
- o_rEventVector.push_back(
- SweepLineEvent( rCurrRect.getMaxX(),
+ o_rEventVector.emplace_back( rCurrRect.getMaxX(),
rCurrRect,
SweepLineEvent::FINISHING_EDGE,
(*aCurrOrientationR++) == B2VectorOrientation::Positive ?
- SweepLineEvent::PROCEED_DOWN : SweepLineEvent::PROCEED_UP ) );
+ SweepLineEvent::PROCEED_DOWN : SweepLineEvent::PROCEED_UP );
}
// sort events
@@ -618,19 +616,17 @@ namespace basegfx
io_rPolygonPool.get(nIdxPolygon).setPolygonPoolIndex(nIdxPolygon);
// upper edge
- aNewEdges.push_back(
- ActiveEdge(
+ aNewEdges.emplace_back(
rRect,
rRect.getMinY(),
bGoesDown ? nIdxPolygon : -1,
- bGoesDown ? ActiveEdge::PROCEED_LEFT : ActiveEdge::PROCEED_RIGHT) );
+ bGoesDown ? ActiveEdge::PROCEED_LEFT : ActiveEdge::PROCEED_RIGHT );
// lower edge
- aNewEdges.push_back(
- ActiveEdge(
+ aNewEdges.emplace_back(
rRect,
rRect.getMaxY(),
bGoesDown ? -1 : nIdxPolygon,
- bGoesDown ? ActiveEdge::PROCEED_RIGHT : ActiveEdge::PROCEED_LEFT ) );
+ bGoesDown ? ActiveEdge::PROCEED_RIGHT : ActiveEdge::PROCEED_LEFT );
// furthermore, have to respect a special tie-breaking
// rule here, for edges which share the same y value:
diff --git a/basegfx/source/raster/rasterconvert3d.cxx b/basegfx/source/raster/rasterconvert3d.cxx
index 951cdbd65ebd..8e1ab3b6d9d8 100644
--- a/basegfx/source/raster/rasterconvert3d.cxx
+++ b/basegfx/source/raster/rasterconvert3d.cxx
@@ -168,10 +168,10 @@ namespace basegfx
const sal_uInt32 nYDelta(nYEnd - nYStart);
const double fInvYDelta(1.0 / nYDelta);
- maLineEntries.push_back(RasterConversionLineEntry3D(
+ maLineEntries.emplace_back(
aStart.getX(), (aEnd.getX() - aStart.getX()) * fInvYDelta,
aStart.getZ(), (aEnd.getZ() - aStart.getZ()) * fInvYDelta,
- nYStart, nYDelta));
+ nYStart, nYDelta);
// if extra interpolation data is used, add it to the last created entry
RasterConversionLineEntry3D& rEntry = maLineEntries[maLineEntries.size() - 1];
@@ -261,14 +261,14 @@ namespace basegfx
// horizontal line, create vertical entries. These will be sorted by
// X anyways, so no need to distinguish the case here
- maLineEntries.push_back(RasterConversionLineEntry3D(
+ maLineEntries.emplace_back(
aStart.getX(), 0.0,
aStart.getZ() + fZBufferLineAdd, 0.0,
- nYStart, 1));
- maLineEntries.push_back(RasterConversionLineEntry3D(
+ nYStart, 1);
+ maLineEntries.emplace_back(
aEnd.getX(), 0.0,
aEnd.getZ() + fZBufferLineAdd, 0.0,
- nYStart, 1));
+ nYStart, 1);
}
}
else
@@ -287,10 +287,10 @@ namespace basegfx
// non-horizontal line, create two parallel entries. These will be sorted by
// X anyways, so no need to distinguish the case here
- maLineEntries.push_back(RasterConversionLineEntry3D(
+ maLineEntries.emplace_back(
aStart.getX(), (aEnd.getX() - aStart.getX()) * fInvYDelta,
aStart.getZ() + fZBufferLineAdd, (aEnd.getZ() - aStart.getZ()) * fInvYDelta,
- nYStart, nYDelta));
+ nYStart, nYDelta);
RasterConversionLineEntry3D& rEntry = maLineEntries[maLineEntries.size() - 1];
@@ -300,10 +300,10 @@ namespace basegfx
// guarantee one pixel per line, add a minimum of one for X.
const double fDistanceX(fabs(rEntry.getX().getInc()) >= 1.0 ? rEntry.getX().getInc() : 1.0);
- maLineEntries.push_back(RasterConversionLineEntry3D(
+ maLineEntries.emplace_back(
rEntry.getX().getVal() + fDistanceX, rEntry.getX().getInc(),
rEntry.getZ().getVal() + rEntry.getZ().getInc(), rEntry.getZ().getInc(),
- nYStart, nYDelta));
+ nYStart, nYDelta);
}
}
diff --git a/basegfx/source/tools/unotools.cxx b/basegfx/source/tools/unotools.cxx
index 6b5b47ca9459..7e3309e09c79 100644
--- a/basegfx/source/tools/unotools.cxx
+++ b/basegfx/source/tools/unotools.cxx
@@ -200,12 +200,12 @@ namespace unotools
if(aBezier.isBezier())
{
// if one is used, add always two control points due to the old schema
- aPoints.push_back( awt::Point(fround(aBezier.getControlPointA().getX()),
- fround(aBezier.getControlPointA().getY())) );
+ aPoints.emplace_back(fround(aBezier.getControlPointA().getX()),
+ fround(aBezier.getControlPointA().getY()) );
aFlags.push_back(drawing::PolygonFlags_CONTROL);
- aPoints.push_back( awt::Point(fround(aBezier.getControlPointB().getX()),
- fround(aBezier.getControlPointB().getY())) );
+ aPoints.emplace_back(fround(aBezier.getControlPointB().getX()),
+ fround(aBezier.getControlPointB().getY()) );
aFlags.push_back(drawing::PolygonFlags_CONTROL);
}