summaryrefslogtreecommitdiff
path: root/chart2/source/view/charttypes
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-02-16 15:38:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-02-16 17:58:03 +0100
commit9625db65446711044e364443b5afbdbb09283055 (patch)
treea2afce517978b76cb53a60c91414a07506c5865b /chart2/source/view/charttypes
parent8fc4e188586cf3c04592e0c1027a0c384bd3c54d (diff)
simplify some vector construction
Change-Id: I0bd131066f5d70fb1dc1c4f851d4d6059994a6f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130002 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/view/charttypes')
-rw-r--r--chart2/source/view/charttypes/BarChart.cxx20
-rw-r--r--chart2/source/view/charttypes/CandleStickChart.cxx8
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx5
3 files changed, 15 insertions, 18 deletions
diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx
index c09548e5f17e..817a29fd06ec 100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -900,18 +900,18 @@ void BarChart::doXSlot(
}
else //m_nDimension!=3
{
- // performance improvement: alloc the sequence before the rendering
- // otherwise we have 2 realloc calls
- std::vector<std::vector<css::drawing::Position3D>> aPoly;
- aPoly.resize(1);
drawing::Position3D aLeftUpperPoint( fLogicX-fLogicBarWidth/2.0,fUpperYValue,fLogicZ );
drawing::Position3D aRightUpperPoint( fLogicX+fLogicBarWidth/2.0,fUpperYValue,fLogicZ );
-
- AddPointToPoly( aPoly, drawing::Position3D( fLogicX-fLogicBarWidth/2.0,fLowerYValue,fLogicZ) );
- AddPointToPoly( aPoly, drawing::Position3D( fLogicX+fLogicBarWidth/2.0,fLowerYValue,fLogicZ) );
- AddPointToPoly( aPoly, aRightUpperPoint );
- AddPointToPoly( aPoly, aLeftUpperPoint );
- AddPointToPoly( aPoly, drawing::Position3D( fLogicX-fLogicBarWidth/2.0,fLowerYValue,fLogicZ) );
+ std::vector<std::vector<css::drawing::Position3D>> aPoly
+ {
+ { // inner vector
+ drawing::Position3D( fLogicX-fLogicBarWidth/2.0,fLowerYValue,fLogicZ),
+ drawing::Position3D( fLogicX+fLogicBarWidth/2.0,fLowerYValue,fLogicZ),
+ aRightUpperPoint,
+ aLeftUpperPoint,
+ drawing::Position3D( fLogicX-fLogicBarWidth/2.0,fLowerYValue,fLogicZ)
+ }
+ };
pPosHelper->transformScaledLogicToScene( aPoly );
xShape = ShapeFactory::createArea2D( xSeriesGroupShape_Shapes, aPoly );
PropertyMapper::setMappedProperties( *xShape, xDataPointProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
diff --git a/chart2/source/view/charttypes/CandleStickChart.cxx b/chart2/source/view/charttypes/CandleStickChart.cxx
index f1b11492ee60..5c8497a5d4b2 100644
--- a/chart2/source/view/charttypes/CandleStickChart.cxx
+++ b/chart2/source/view/charttypes/CandleStickChart.cxx
@@ -216,10 +216,10 @@ void CandleStickChart::createShapes()
//create min-max line
if( isValidPosition(aPosMiddleMinimum) && isValidPosition(aPosMiddleMaximum) )
{
- std::vector<std::vector<css::drawing::Position3D>> aPoly;
- sal_Int32 nLineIndex =0;
- AddPointToPoly( aPoly, aPosMiddleMinimum, nLineIndex);
- AddPointToPoly( aPoly, aPosMiddleMaximum, nLineIndex);
+ std::vector<std::vector<css::drawing::Position3D>> aPoly
+ {
+ { aPosMiddleMinimum, aPosMiddleMaximum }
+ };
rtl::Reference<SvxShapePolyPolygon> xShape =
ShapeFactory::createLine2D( xPointGroupShape_Shapes, aPoly);
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index e2a4d07cd3c7..50bff922f861 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -1091,10 +1091,7 @@ void VSeriesPlotter::addErrorBorder(
,const rtl::Reference<SvxShapeGroupAnyD>& rTarget
,const uno::Reference< beans::XPropertySet >& rErrorBorderProp )
{
- std::vector<std::vector<css::drawing::Position3D>> aPoly;
- sal_Int32 nSequenceIndex = 0;
- AddPointToPoly( aPoly, rPos0, nSequenceIndex );
- AddPointToPoly( aPoly, rPos1, nSequenceIndex );
+ std::vector<std::vector<css::drawing::Position3D>> aPoly { { rPos0, rPos1} };
rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D(
rTarget, aPoly );
PropertyMapper::setMappedProperties( *xShape, rErrorBorderProp,