summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-04-21 11:03:55 +0200
committerNoel Grandin <noel@peralex.com>2016-04-21 11:03:55 +0200
commite1af7f0c438bc242e4562aa0286c99787b5ad544 (patch)
tree29c7faa3556f33baa7eae5cd0aca3946afb8a560 /chart2
parent8762aa986dbca42e61cc8fb1b2c1d2ca66bcfcbe (diff)
clang-tidy modernize-loop-convert in c*
Change-Id: I77d2548f8be97792660761e6156cd24734a95aaf
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.cxx3
-rw-r--r--chart2/source/controller/sidebar/ChartAxisPanel.cxx12
-rw-r--r--chart2/source/controller/sidebar/ChartErrorBarPanel.cxx12
-rw-r--r--chart2/source/controller/sidebar/ChartSeriesPanel.cxx12
-rw-r--r--chart2/source/model/main/BaseCoordinateSystem.cxx4
-rw-r--r--chart2/source/tools/InternalDataProvider.cxx8
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx18
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx14
-rw-r--r--chart2/source/view/main/ChartView.cxx45
-rw-r--r--chart2/source/view/main/GL3DRenderer.cxx84
-rw-r--r--chart2/source/view/main/OpenGLRender.cxx4
11 files changed, 97 insertions, 119 deletions
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
index 8e1539382ed5..b8c6a7a90d6f 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
@@ -199,9 +199,8 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
m_pRB_AssumeZero->Enable(false);
m_pRB_ContinueLine->Enable(false);
- for( size_t nN =0; nN<aMissingValueTreatments.size(); nN++ )
+ for(int nVal : aMissingValueTreatments)
{
- sal_Int32 nVal = aMissingValueTreatments[nN];
if(nVal==css::chart::MissingValueTreatment::LEAVE_GAP)
m_pRB_DontPaint->Enable();
else if(nVal==css::chart::MissingValueTreatment::USE_ZERO)
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index 22cda88ece04..be80a4c88fef 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -100,10 +100,10 @@ sal_Int32 getLabelPosition(const css::uno::Reference<css::frame::XModel>& xModel
css::chart::ChartAxisLabelPosition ePos;
aAny >>= ePos;
- for (size_t i = 0; i < SAL_N_ELEMENTS(aLabelPosMap); ++i)
+ for (AxisLabelPosMap & i : aLabelPosMap)
{
- if (aLabelPosMap[i].ePos == ePos)
- return aLabelPosMap[i].nPos;
+ if (i.ePos == ePos)
+ return i.nPos;
}
return 0;
@@ -119,10 +119,10 @@ void setLabelPosition(const css::uno::Reference<css::frame::XModel>& xModel,
return;
css::chart::ChartAxisLabelPosition ePos;
- for (size_t i = 0; i < SAL_N_ELEMENTS(aLabelPosMap); ++i)
+ for (AxisLabelPosMap & i : aLabelPosMap)
{
- if (aLabelPosMap[i].nPos == nPos)
- ePos = aLabelPosMap[i].ePos;
+ if (i.nPos == nPos)
+ ePos = i.ePos;
}
xAxis->setPropertyValue("LabelPosition", css::uno::makeAny(ePos));
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index f845dfafaa40..401e7cfab122 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -150,10 +150,10 @@ sal_Int32 getTypePos(const css::uno::Reference<css::frame::XModel>& xModel,
sal_Int32 nApi = 0;
aAny >>= nApi;
- for (size_t i = 0; i < SAL_N_ELEMENTS(aErrorBarType); ++i)
+ for (ErrorBarTypeMap & i : aErrorBarType)
{
- if (aErrorBarType[i].nApi == nApi)
- return aErrorBarType[i].nPos;
+ if (i.nApi == nApi)
+ return i.nPos;
}
return 0;
@@ -169,10 +169,10 @@ void setTypePos(const css::uno::Reference<css::frame::XModel>& xModel,
return;
sal_Int32 nApi = 0;
- for (size_t i = 0; i < SAL_N_ELEMENTS(aErrorBarType); ++i)
+ for (ErrorBarTypeMap & i : aErrorBarType)
{
- if (aErrorBarType[i].nPos == nPos)
- nApi = aErrorBarType[i].nApi;
+ if (i.nPos == nPos)
+ nApi = i.nApi;
}
xPropSet->setPropertyValue("ErrorBarStyle", css::uno::makeAny(nApi));
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index c255fb1cadb1..b2a71cc08f66 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -110,10 +110,10 @@ sal_Int32 getDataLabelPlacement(const css::uno::Reference<css::frame::XModel>& x
sal_Int32 nPlacement = 0;
aAny >>= nPlacement;
- for (size_t i = 0; i < SAL_N_ELEMENTS(aLabelPlacementMap); ++i)
+ for (LabelPlacementMap & i : aLabelPlacementMap)
{
- if (aLabelPlacementMap[i].nApi == nPlacement)
- return aLabelPlacementMap[i].nPos;
+ if (i.nApi == nPlacement)
+ return i.nPos;
}
return 0;
@@ -129,11 +129,11 @@ void setDataLabelPlacement(const css::uno::Reference<css::frame::XModel>& xModel
return;
sal_Int32 nApi = 0;
- for (size_t i = 0; i < SAL_N_ELEMENTS(aLabelPlacementMap); ++i)
+ for (LabelPlacementMap & i : aLabelPlacementMap)
{
- if (aLabelPlacementMap[i].nPos == nPos)
+ if (i.nPos == nPos)
{
- nApi = aLabelPlacementMap[i].nApi;
+ nApi = i.nApi;
break;
}
}
diff --git a/chart2/source/model/main/BaseCoordinateSystem.cxx b/chart2/source/model/main/BaseCoordinateSystem.cxx
index 6eb5caea9390..593000023201 100644
--- a/chart2/source/model/main/BaseCoordinateSystem.cxx
+++ b/chart2/source/model/main/BaseCoordinateSystem.cxx
@@ -184,8 +184,8 @@ BaseCoordinateSystem::~BaseCoordinateSystem()
{
try
{
- for( tAxisVecVecType::size_type nN=0; nN<m_aAllAxis.size(); nN++ )
- ModifyListenerHelper::removeListenerFromAllElements( m_aAllAxis[nN], m_xModifyEventForwarder );
+ for(tAxisVecVecType::value_type & m_aAllAxi : m_aAllAxis)
+ ModifyListenerHelper::removeListenerFromAllElements( m_aAllAxi, m_xModifyEventForwarder );
ModifyListenerHelper::removeListenerFromAllElements( m_aChartTypes, m_xModifyEventForwarder );
}
catch( const uno::Exception & ex )
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index 44de6cb43e85..fb8004f0d369 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -582,8 +582,8 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, co
std::vector<double> aValues;
aValues.reserve(aRawElems.size());
- for (size_t i = 0; i < aRawElems.size(); ++i)
- aValues.push_back(aRawElems[i].toDouble());
+ for (OUString & aRawElem : aRawElems)
+ aValues.push_back(aRawElem.toDouble());
sal_Int32 n = m_aInternalData.appendColumn();
m_aInternalData.setColumnValues(n, aValues);
@@ -598,8 +598,8 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, co
aValues.reserve(aRawElems.size());
if (bAllNumeric)
{
- for (size_t i = 0; i < aRawElems.size(); ++i)
- aValues.push_back(aRawElems[i].toDouble());
+ for (OUString & aRawElem : aRawElems)
+ aValues.push_back(aRawElem.toDouble());
}
else
{
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 424b502e276a..497609f66a63 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -1302,9 +1302,9 @@ void GL3DBarChart::updateClickEvent()
}
nIdex++;
}
- for (sal_uInt32 i = 0; i < DISPLAY_BARS_NUM; i++)
+ for (unsigned int i : nBarIdArray)
{
- addMovementScreenText(nBarIdArray[i]);
+ addMovementScreenText(i);
}
//add translucent back ground
aTitle = " ";
@@ -1417,10 +1417,10 @@ void GL3DBarChart::updateScroll()
{
float fMinDistance = 0.0f;
std::vector<BarInformation> aBarInfoList;
- for(size_t i= 0;i < maVectorNearest.size(); i++)
+ for(sal_uInt32 i : maVectorNearest)
{
//get bar height position
- std::map<sal_uInt32, const BarInformation>::const_iterator itr = maBarMap.find(maVectorNearest[i]);
+ std::map<sal_uInt32, const BarInformation>::const_iterator itr = maBarMap.find(i);
const BarInformation& rBarInfo = itr->second;
aBarInfoList.push_back(rBarInfo);
glm::vec3 aPos = rBarInfo.maPos;
@@ -1431,15 +1431,15 @@ void GL3DBarChart::updateScroll()
if (fMinDistance <= SHOW_SCROLL_TEXT_DISTANCE)
{
//update scroll value
- for(size_t i = 0; i < aBarInfoList.size(); i++)
+ for(BarInformation & i : aBarInfoList)
{
- OUString aBarValue = "Value: " + OUString::number(aBarInfoList[i].mnVal);
+ OUString aBarValue = "Value: " + OUString::number(i.mnVal);
maScreenTextShapes.push_back(o3tl::make_unique<opengl3D::ScreenText>(mpRenderer.get(), *mpTextCache, aBarValue, glm::vec4(0.0f, 0.0f, 1.0f, 0.0f), CALC_POS_EVENT_ID, true));
const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(aBarValue);
float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * 0.024;
- glm::vec3 aTextPos = glm::vec3(aBarInfoList[i].maPos.x + BAR_SIZE_X / 2.0f,
- aBarInfoList[i].maPos.y + BAR_SIZE_Y / 2.0f,
- aBarInfoList[i].maPos.z);
+ glm::vec3 aTextPos = glm::vec3(i.maPos.x + BAR_SIZE_X / 2.0f,
+ i.maPos.y + BAR_SIZE_Y / 2.0f,
+ i.maPos.z);
opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(maScreenTextShapes.back().get());
pScreenText->setPosition(glm::vec2(-nRectWidth / 2, 0.03f), glm::vec2(nRectWidth / 2, -0.03f), aTextPos);
}
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index d50ace033647..fff2eeb18114 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -1406,13 +1406,12 @@ double VSeriesPlotter::getMinimumYInRange( double fMinimumX, double fMaximumX, s
double fMinimum, fMaximum;
::rtl::math::setInf(&fMinimum, false);
::rtl::math::setInf(&fMaximum, true);
- for(size_t nZ =0; nZ<m_aZSlots.size();nZ++ )
+ for(std::vector<VDataSeriesGroup> & rXSlots : m_aZSlots)
{
- ::std::vector< VDataSeriesGroup >& rXSlots = m_aZSlots[nZ];
- for(size_t nN =0; nN<rXSlots.size();nN++ )
+ for(VDataSeriesGroup & rXSlot : rXSlots)
{
double fLocalMinimum, fLocalMaximum;
- rXSlots[nN].calculateYMinAndMaxForCategoryRange(
+ rXSlot.calculateYMinAndMaxForCategoryRange(
static_cast<sal_Int32>(fMinimumX-1.0) //first category (index 0) matches with real number 1.0
, static_cast<sal_Int32>(fMaximumX-1.0) //first category (index 0) matches with real number 1.0
, isSeparateStackingForDifferentSigns( 1 )
@@ -1440,13 +1439,12 @@ double VSeriesPlotter::getMaximumYInRange( double fMinimumX, double fMaximumX, s
double fMinimum, fMaximum;
::rtl::math::setInf(&fMinimum, false);
::rtl::math::setInf(&fMaximum, true);
- for(size_t nZ =0; nZ<m_aZSlots.size();nZ++ )
+ for( std::vector< VDataSeriesGroup > & rXSlots : m_aZSlots)
{
- ::std::vector< VDataSeriesGroup >& rXSlots = m_aZSlots[nZ];
- for(size_t nN =0; nN<rXSlots.size();nN++ )
+ for(VDataSeriesGroup & rXSlot : rXSlots)
{
double fLocalMinimum, fLocalMaximum;
- rXSlots[nN].calculateYMinAndMaxForCategoryRange(
+ rXSlot.calculateYMinAndMaxForCategoryRange(
static_cast<sal_Int32>(fMinimumX-1.0) //first category (index 0) matches with real number 1.0
, static_cast<sal_Int32>(fMaximumX-1.0) //first category (index 0) matches with real number 1.0
, isSeparateStackingForDifferentSigns( 1 )
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 82cf455b06c7..bd8b50a8f112 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -238,16 +238,16 @@ sal_Int32 AxisUsage::getMaxAxisIndexForDimension( sal_Int32 nDimensionIndex )
void AxisUsage::prepareAutomaticAxisScaling( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex )
{
std::vector<VCoordinateSystem*> aVCooSysList = getCoordinateSystems(nDimIndex, nAxisIndex);
- for (size_t i = 0, n = aVCooSysList.size(); i < n; ++i)
- aVCooSysList[i]->prepareAutomaticAxisScaling(rScaleAutomatism, nDimIndex, nAxisIndex);
+ for (VCoordinateSystem * i : aVCooSysList)
+ i->prepareAutomaticAxisScaling(rScaleAutomatism, nDimIndex, nAxisIndex);
}
void AxisUsage::setExplicitScaleAndIncrement(
sal_Int32 nDimIndex, sal_Int32 nAxisIndex, const ExplicitScaleData& rScale, const ExplicitIncrementData& rInc )
{
std::vector<VCoordinateSystem*> aVCooSysList = getCoordinateSystems(nDimIndex, nAxisIndex);
- for (size_t i = 0, n = aVCooSysList.size(); i < n; ++i)
- aVCooSysList[i]->setExplicitScaleAndIncrement(nDimIndex, nAxisIndex, rScale, rInc);
+ for (VCoordinateSystem* i : aVCooSysList)
+ i->setExplicitScaleAndIncrement(nDimIndex, nAxisIndex, rScale, rInc);
}
typedef std::vector<std::unique_ptr<VSeriesPlotter> > SeriesPlottersType;
@@ -380,8 +380,8 @@ SeriesPlotterContainer::SeriesPlotterContainer( std::vector< VCoordinateSystem*
SeriesPlotterContainer::~SeriesPlotterContainer()
{
// - remove plotter from coordinatesystems
- for( size_t nC=0; nC < m_rVCooSysList.size(); nC++)
- m_rVCooSysList[nC]->clearMinimumAndMaximumSupplierList();
+ for(VCoordinateSystem* nC : m_rVCooSysList)
+ nC->clearMinimumAndMaximumSupplierList();
}
std::vector< LegendEntryProvider* > SeriesPlotterContainer::getLegendEntryProviderList()
@@ -396,9 +396,8 @@ std::vector< LegendEntryProvider* > SeriesPlotterContainer::getLegendEntryProvid
VCoordinateSystem* findInCooSysList( const std::vector< VCoordinateSystem* >& rVCooSysList
, const uno::Reference< XCoordinateSystem >& xCooSys )
{
- for( size_t nC=0; nC < rVCooSysList.size(); nC++)
+ for(VCoordinateSystem* pVCooSys : rVCooSysList)
{
- VCoordinateSystem* pVCooSys = rVCooSysList[nC];
if(pVCooSys->getModel()==xCooSys)
return pVCooSys;
}
@@ -409,9 +408,8 @@ VCoordinateSystem* lcl_getCooSysForPlotter( const std::vector< VCoordinateSystem
{
if(!pMinimumAndMaximumSupplier)
return nullptr;
- for( size_t nC=0; nC < rVCooSysList.size(); nC++)
+ for(VCoordinateSystem* pVCooSys : rVCooSysList)
{
- VCoordinateSystem* pVCooSys = rVCooSysList[nC];
if(pVCooSys->hasMinimumAndMaximumSupplier( pMinimumAndMaximumSupplier ))
return pVCooSys;
}
@@ -621,9 +619,8 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
{
uno::Sequence< OUString > aSeriesNames;
bool bSeriesNamesInitialized = false;
- for( size_t nC=0; nC < m_rVCooSysList.size(); nC++)
+ for(VCoordinateSystem* pVCooSys : m_rVCooSysList)
{
- VCoordinateSystem* pVCooSys = m_rVCooSysList[nC];
if(!pVCooSys)
continue;
if( pVCooSys->needSeriesNamesForAxis() )
@@ -663,9 +660,8 @@ void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate)
// Loop through coordinate systems in the diagram (though for now
// there should only be one coordinate system per diagram).
- for (size_t i = 0, n = m_rVCooSysList.size(); i < n; ++i)
+ for (VCoordinateSystem* pVCooSys : m_rVCooSysList)
{
- VCoordinateSystem* pVCooSys = m_rVCooSysList[i];
uno::Reference<XCoordinateSystem> xCooSys = pVCooSys->getModel();
sal_Int32 nDimCount = xCooSys->getDimension();
@@ -708,9 +704,8 @@ void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate)
::std::map< uno::Reference< XAxis >, AxisUsage >::iterator aAxisIter = m_aAxisUsageList.begin();
const ::std::map< uno::Reference< XAxis >, AxisUsage >::const_iterator aAxisEndIter = m_aAxisUsageList.end();
m_nMaxAxisIndex = 0;
- for (size_t i = 0, n = m_rVCooSysList.size(); i < n; ++i)
+ for (VCoordinateSystem* pVCooSys : m_rVCooSysList)
{
- VCoordinateSystem* pVCooSys = m_rVCooSysList[i];
uno::Reference<XCoordinateSystem> xCooSys = pVCooSys->getModel();
sal_Int32 nDimCount = xCooSys->getDimension();
@@ -790,8 +785,8 @@ void SeriesPlotterContainer::setNumberFormatsFromAxes()
void SeriesPlotterContainer::updateScalesAndIncrementsOnAxes()
{
- for( size_t nC=0; nC < m_rVCooSysList.size(); nC++)
- m_rVCooSysList[nC]->updateScalesAndIncrementsOnAxes();
+ for(VCoordinateSystem* nC : m_rVCooSysList)
+ nC->updateScalesAndIncrementsOnAxes();
}
void SeriesPlotterContainer::doAutoScaling( ChartModel& rChartModel )
@@ -882,15 +877,15 @@ void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel&
if (bSeriesAttachedToThisAxis || nAttachedAxisIndex < 0)
continue;
- for( size_t nC = 0; nC < aVCooSysList_Y.size(); ++nC )
+ for(VCoordinateSystem* nC : aVCooSysList_Y)
{
- aVCooSysList_Y[nC]->prepareAutomaticAxisScaling( rAxisUsage.aAutoScaling, 1, nAttachedAxisIndex );
+ nC->prepareAutomaticAxisScaling( rAxisUsage.aAutoScaling, 1, nAttachedAxisIndex );
- ExplicitScaleData aExplicitScaleSource = aVCooSysList_Y[nC]->getExplicitScale( 1,nAttachedAxisIndex );
- ExplicitIncrementData aExplicitIncrementSource = aVCooSysList_Y[nC]->getExplicitIncrement( 1,nAttachedAxisIndex );
+ ExplicitScaleData aExplicitScaleSource = nC->getExplicitScale( 1,nAttachedAxisIndex );
+ ExplicitIncrementData aExplicitIncrementSource = nC->getExplicitIncrement( 1,nAttachedAxisIndex );
- ExplicitScaleData aExplicitScaleDest = aVCooSysList_Y[nC]->getExplicitScale( 1,nAxisIndex );
- ExplicitIncrementData aExplicitIncrementDest = aVCooSysList_Y[nC]->getExplicitIncrement( 1,nAxisIndex );
+ ExplicitScaleData aExplicitScaleDest = nC->getExplicitScale( 1,nAxisIndex );
+ ExplicitIncrementData aExplicitIncrementDest = nC->getExplicitIncrement( 1,nAxisIndex );
aExplicitScaleDest.Orientation = aExplicitScaleSource.Orientation;
aExplicitScaleDest.Scaling = aExplicitScaleSource.Scaling;
@@ -936,7 +931,7 @@ void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel&
aExplicitIncrementSource.SubIncrements[0].IntervalCount;
}
- aVCooSysList_Y[nC]->setExplicitScaleAndIncrement( 1, nAxisIndex, aExplicitScaleDest, aExplicitIncrementDest );
+ nC->setExplicitScaleAndIncrement( 1, nAxisIndex, aExplicitScaleDest, aExplicitIncrementDest );
}
}
}
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 1f6895977756..61916f912612 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -134,9 +134,9 @@ OpenGL3DRenderer::~OpenGL3DRenderer()
glDeleteRenderbuffers(1, &mnPickingRboDepth);
glDeleteRenderbuffers(1, &mnPickingRboColor);
- for (size_t i = 0; i < m_TextInfoBatch.texture.size(); i++)
+ for (TextureArrayInfo & i : m_TextInfoBatch.texture)
{
- glDeleteTextures(1, &m_TextInfoBatch.texture[i].textureID);
+ glDeleteTextures(1, &i.textureID);
}
m_TextInfoBatch.texture.clear();
@@ -568,9 +568,9 @@ void OpenGL3DRenderer::CreateActualRoundedCube(float fRadius, int iSubDivY, int
{
m_RoundBarMesh.iElementSizes[k] = indices[k].size() - m_RoundBarMesh.iElementStartIndices[k];
m_RoundBarMesh.iElementStartIndices[k] = m_Indices.size() * sizeof(unsigned short);
- for (size_t IdxCnt = 0; IdxCnt < indices[k].size(); IdxCnt++)
+ for (unsigned short & IdxCnt : indices[k])
{
- m_Indices.push_back(indices[k][IdxCnt]);
+ m_Indices.push_back(IdxCnt);
}
indices[k].clear();
}
@@ -680,9 +680,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
glm::normalize(vQuadPoints[2]),
glm::normalize(vQuadPoints[3])
};
- for (int i = 0; i < 6; i++)
+ for (int index : iIndices)
{
- int index = iIndices[i];
vertices.push_back(vActualQuadPoints[index]);
normals.push_back(vNormals[index]);
}
@@ -706,9 +705,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
glm::normalize(vQuadPoints[2]),
glm::normalize(vQuadPoints[3])
};
- for (int i = 0; i < 6; i++)
+ for (int index : iIndices)
{
- int index = iIndices[i];
vertices.push_back(vXZQuadNextPoints[index]);
normals.push_back(vXZNextNormals[index]);
}
@@ -730,9 +728,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
glm::normalize(vQuadPoints[2]),
glm::normalize(vQuadPoints[2])
};
- for (int i = 0; i < 6; i++)
+ for (int index : iIndices)
{
- int index = iIndices[i];
vertices.push_back(vYQuadNextPoints[index]);
normals.push_back(vYNextNormals[index]);
}
@@ -762,9 +759,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
glm::vec3(xOffset[3], height / 2, zOffset[3])
};
glm::vec3 vTopNormal = glm::vec3(0.0f, 1.0f, 0.0f);
- for (int i = 0; i < 6; i++)
+ for (int index : iIndices)
{
- int index = iIndices[i];
vertices.push_back(vTopPoints[index]);
normals.push_back(vTopNormal);
}
@@ -778,9 +774,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
glm::vec3(xOffset[0], -height / 2, zOffset[0])
};
glm::vec3 vBottomNormal = glm::vec3(0.0f, -1.0f, 0.0f);
- for (int i = 0; i < 6; i++)
+ for (int index : iIndices)
{
- int index = iIndices[i];
vertices.push_back(vBottomPoints[index]);
normals.push_back(vBottomNormal);
}
@@ -794,9 +789,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
glm::vec3(-width / 2, yOffset[0], zOffset[3])
};
glm::vec3 vLeftNormal = glm::vec3(-1.0f, 0.0f, 0.0f);
- for (int i = 0; i < 6; i++)
+ for (int index : iIndices)
{
- int index = iIndices[i];
vertices.push_back(vLeftPoints[index]);
normals.push_back(vLeftNormal);
}
@@ -809,9 +803,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
glm::vec3(width / 2, yOffset[0], zOffset[0])
};
glm::vec3 vRightNormal = glm::vec3(1.0f, 0.0f, 0.0f);
- for (int i = 0; i < 6; i++)
+ for (int index : iIndices)
{
- int index = iIndices[i];
vertices.push_back(vRightPoints[index]);
normals.push_back(vRightNormal);
}
@@ -825,9 +818,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
glm::vec3(xOffset[3], yOffset[1], depth / 2)
};
glm::vec3 vFrontNormal = glm::vec3(0.0f, 0.0f, 1.0f);
- for (int i = 0; i < 6; i++)
+ for (int index : iIndices)
{
- int index = iIndices[i];
vertices.push_back(vFrontPoints[index]);
normals.push_back(vFrontNormal);
}
@@ -840,9 +832,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
glm::vec3(xOffset[3], yOffset[0], -depth / 2)
};
glm::vec3 vBackNormal = glm::vec3(0.0f, 0.0f, -1.0f);
- for (int i = 0; i < 6; i++)
+ for (int index : iIndices)
{
- int index = iIndices[i];
vertices.push_back(vBackPoints[index]);
normals.push_back(vBackNormal);
}
@@ -1066,9 +1057,8 @@ struct DeletePointer
void OpenGL3DRenderer::ReleasePolygonShapes()
{
- for (size_t i = 0; i < m_Polygon3DInfoList.size(); i++)
+ for (Polygon3DInfo & polygon : m_Polygon3DInfoList)
{
- Polygon3DInfo &polygon = m_Polygon3DInfoList[i];
std::for_each(polygon.verticesList.begin(),
polygon.verticesList.end(), DeletePointer<Vertices3D>());
std::for_each(polygon.normalsList.begin(),
@@ -1083,9 +1073,8 @@ void OpenGL3DRenderer::RenderPolygon3DObject()
{
glDepthMask(GL_FALSE);
CHECK_GL_ERROR();
- for (size_t i = 0; i < m_Polygon3DInfoList.size(); i++)
+ for (Polygon3DInfo & polygon : m_Polygon3DInfoList)
{
- Polygon3DInfo &polygon = m_Polygon3DInfoList[i];
if (polygon.lineOnly || (!polygon.fillStyle))
{
//just use the common shader is ok for lines
@@ -1908,9 +1897,9 @@ void OpenGL3DRenderer::ReleaseTextShapes()
void OpenGL3DRenderer::ReleaseTextTexture()
{
- for (size_t i = 0; i < m_Texturelist.size(); i++)
+ for (unsigned int & i : m_Texturelist)
{
- glDeleteTextures(1, &m_Texturelist[i]);
+ glDeleteTextures(1, &i);
}
m_Texturelist.clear();
}
@@ -1922,9 +1911,9 @@ void OpenGL3DRenderer::ReleaseScreenTextShapes()
void OpenGL3DRenderer::ReleaseScreenTextTexture()
{
- for (size_t i = 0; i < m_ScreenTexturelist.size(); i++)
+ for (unsigned int & i : m_ScreenTexturelist)
{
- glDeleteTextures(1, &m_ScreenTexturelist[i]);
+ glDeleteTextures(1, &i);
}
m_ScreenTexturelist.clear();
}
@@ -1936,9 +1925,8 @@ void OpenGL3DRenderer::RenderScreenTextShape()
return;
glUseProgram(maResources.m_ScreenTextProID);
CHECK_GL_ERROR();
- for (size_t i = 0; i < m_ScreenTextInfoList.size(); i++)
+ for (TextInfo & textInfo : m_ScreenTextInfoList)
{
- TextInfo textInfo = m_ScreenTextInfoList[i];
//calc the position and check whether it can be displayed
if (textInfo.uniqueId)
{
@@ -2009,9 +1997,9 @@ void OpenGL3DRenderer::RenderScreenTextShape()
}
void OpenGL3DRenderer::ReleaseTextShapesBatch()
{
- for (size_t i = 0; i < m_TextInfoBatch.texture.size(); i++)
+ for (TextureArrayInfo & i : m_TextInfoBatch.texture)
{
- m_TextInfoBatch.texture[i].subTextureNum = 0;
+ i.subTextureNum = 0;
}
m_TextInfoBatch.vertexList.clear();
m_TextInfoBatch.textureCoordList.clear();
@@ -2075,9 +2063,8 @@ void OpenGL3DRenderer::RenderTextShapeBatch()
void OpenGL3DRenderer::RenderTextShape()
{
CHECK_GL_ERROR();
- for (size_t i = 0; i < m_TextInfoList.size(); i++)
+ for (TextInfo & textInfo : m_TextInfoList)
{
- TextInfo &textInfo = m_TextInfoList[i];
PosVecf3 trans = {0, 0, 0};
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
PosVecf3 scale = {1.0, 1.0, 1.0f};
@@ -2265,12 +2252,12 @@ sal_uInt32 OpenGL3DRenderer::GetPixelColorFromPoint(long nX, long nY)
void OpenGL3DRenderer::ReleaseBatchBarInfo()
{
- for (int i = 0; i < 3; i++)
+ for (BatchBarInfo & i : m_BarSurface)
{
- m_BarSurface[i].modelMatrixList.clear();
- m_BarSurface[i].normalMatrixList.clear();
- m_BarSurface[i].colorList.clear();
- m_BarSurface[i].mapId2Color.clear();
+ i.modelMatrixList.clear();
+ i.normalMatrixList.clear();
+ i.colorList.clear();
+ i.mapId2Color.clear();
}
}
@@ -2363,9 +2350,8 @@ void OpenGL3DRenderer::GetBatchTopAndFlatInfo(const Extrude3DInfo &extrude3D)
void OpenGL3DRenderer::GetBatchBarsInfo()
{
- for (size_t i = 0; i < m_Extrude3DList.size(); i++)
+ for (Extrude3DInfo & extrude3DInfo : m_Extrude3DList)
{
- Extrude3DInfo &extrude3DInfo = m_Extrude3DList[i];
if (m_Extrude3DInfo.rounded)
{
GetBatchTopAndFlatInfo(extrude3DInfo);
@@ -2412,18 +2398,18 @@ void OpenGL3DRenderer::StartClick(sal_uInt32 &selectID)
{
m_bHighLighting = true;
m_uiSelectID = selectID;
- for (unsigned int i = 0; i < 3; i++)
+ for (BatchBarInfo & i : m_BarSurface)
{
- SetHighLightBar(m_BarSurface[i]);
+ SetHighLightBar(i);
}
}
void OpenGL3DRenderer::EndClick()
{
m_bHighLighting = false;
- for (unsigned int i = 0; i < 3; i++)
+ for (BatchBarInfo & i : m_BarSurface)
{
- DisableHighLightBar(m_BarSurface[i]);
+ DisableHighLightBar(i);
}
}
@@ -2501,9 +2487,9 @@ void OpenGL3DRenderer::RenderBatchBars(bool bNewScene)
GetBatchBarsInfo();
if (m_bHighLighting)
{
- for (unsigned int i = 0; i < 3; i++)
+ for (BatchBarInfo & i : m_BarSurface)
{
- SetHighLightBar(m_BarSurface[i]);
+ SetHighLightBar(i);
}
}
}
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 03eb7f05d96d..83c6f51c7fac 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -329,9 +329,9 @@ OpenGLRender::OpenGLRender()
, m_SymbolShapeID(0)
{
//TODO: moggi: use STL
- for (size_t i = 0; i < SAL_N_ELEMENTS(m_BackgroundColor); i++)
+ for (float & i : m_BackgroundColor)
{
- m_BackgroundColor[i] = 1.0;
+ i = 1.0;
}
}