From 06b7f930a51d396bf9e3b6b8d0b3fcbd034730b4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 22 Feb 2022 09:53:35 +0200 Subject: tdf#64914 small improvements (1) do not read the config inside a hot loop (2) do not create a SvxShapeGroup only to remove it Change-Id: I8ff3840d0972d2f617a326a67d18260e44220f56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130331 Tested-by: Jenkins Reviewed-by: Noel Grandin --- chart2/source/view/charttypes/AreaChart.cxx | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'chart2/source/view/charttypes') diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 9160ad8d93ee..dc5ee63b001d 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -636,6 +636,8 @@ void AreaChart::createShapes() } } + const bool bUseErrorRectangle = ConfigAccess::getUseErrorRectangle(); + sal_Int32 nZ=1; for( auto const& rZSlot : m_aZSlots ) { @@ -794,12 +796,6 @@ void AreaChart::createShapes() !bCreateXErrorBar && !pSeries->getDataPointLabelIfLabel(nIndex) ) continue; - //create a group shape for this point and add to the series shape: - OUString aPointCID = ObjectIdentifier::createPointCID( - pSeries->getPointCID_Stub(), nIndex ); - rtl::Reference xPointGroupShape_Shapes( - createGroupShape(xSeriesGroupShape_Shapes,aPointCID) ); - { nCreatedPoints++; @@ -809,6 +805,13 @@ void AreaChart::createShapes() { if(m_nDimension!=3) { + //create a group shape for this point and add to the series shape: + OUString aPointCID = ObjectIdentifier::createPointCID( + pSeries->getPointCID_Stub(), nIndex ); + rtl::Reference xPointGroupShape_Shapes; + if (pSymbolProperties->Style == SymbolStyle_STANDARD || pSymbolProperties->Style == SymbolStyle_GRAPHIC) + xPointGroupShape_Shapes = createGroupShape(xSeriesGroupShape_Shapes,aPointCID); + if (pSymbolProperties->Style != SymbolStyle_NONE) { aSymbolSize.DirectionX = pSymbolProperties->Size.Width; @@ -833,7 +836,7 @@ void AreaChart::createShapes() } } //create error bars or rectangles, depending on configuration - if ( ConfigAccess::getUseErrorRectangle() ) + if ( bUseErrorRectangle ) { if ( bCreateXErrorBar || bCreateYErrorBar ) { @@ -917,10 +920,6 @@ void AreaChart::createShapes() , rLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment, nOffset ); } } - - //remove PointGroupShape if empty - if(!xPointGroupShape_Shapes->getCount()) - xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shapes); } }//next series in x slot (next y slot) -- cgit