mirror of https://github.com/axmolengine/axmol.git
Use range-based for loops to avoid shadowing (#17281)
This commit is contained in:
parent
df24911a23
commit
c06612251c
|
@ -1733,13 +1733,12 @@ void RichText::formarRenderers()
|
||||||
Vector<Node*>* row = element;
|
Vector<Node*>* row = element;
|
||||||
float nextPosX = 0.0f;
|
float nextPosX = 0.0f;
|
||||||
float maxY = 0.0f;
|
float maxY = 0.0f;
|
||||||
for (ssize_t j=0, size = row->size(); j<size; j++)
|
for (auto& iter : *row)
|
||||||
{
|
{
|
||||||
Node* l = row->at(j);
|
iter->setAnchorPoint(Vec2::ZERO);
|
||||||
l->setAnchorPoint(Vec2::ZERO);
|
iter->setPosition(nextPosX, nextPosY);
|
||||||
l->setPosition(nextPosX, nextPosY);
|
this->addProtectedChild(iter, 1);
|
||||||
this->addProtectedChild(l, 1);
|
Size iSize = iter->getContentSize();
|
||||||
Size iSize = l->getContentSize();
|
|
||||||
newContentSizeWidth += iSize.width;
|
newContentSizeWidth += iSize.width;
|
||||||
nextPosX += iSize.width;
|
nextPosX += iSize.width;
|
||||||
maxY = MAX(maxY, iSize.height);
|
maxY = MAX(maxY, iSize.height);
|
||||||
|
@ -1757,10 +1756,9 @@ void RichText::formarRenderers()
|
||||||
{
|
{
|
||||||
Vector<Node*>* row = (_elementRenders[i]);
|
Vector<Node*>* row = (_elementRenders[i]);
|
||||||
float maxHeight = 0.0f;
|
float maxHeight = 0.0f;
|
||||||
for (ssize_t j=0, size = row->size(); j<size; j++)
|
for (auto& iter : *row)
|
||||||
{
|
{
|
||||||
Node* l = row->at(j);
|
maxHeight = MAX(iter->getContentSize().height, maxHeight);
|
||||||
maxHeight = MAX(l->getContentSize().height, maxHeight);
|
|
||||||
}
|
}
|
||||||
maxHeights[i] = maxHeight;
|
maxHeights[i] = maxHeight;
|
||||||
newContentSizeHeight += maxHeights[i];
|
newContentSizeHeight += maxHeights[i];
|
||||||
|
@ -1773,25 +1771,22 @@ void RichText::formarRenderers()
|
||||||
float nextPosX = 0.0f;
|
float nextPosX = 0.0f;
|
||||||
nextPosY -= (maxHeights[i] + _defaults.at(KEY_VERTICAL_SPACE).asFloat());
|
nextPosY -= (maxHeights[i] + _defaults.at(KEY_VERTICAL_SPACE).asFloat());
|
||||||
|
|
||||||
for (ssize_t j=0, size = row->size(); j<size; j++)
|
for (auto& iter : *row)
|
||||||
{
|
{
|
||||||
Node* l = row->at(j);
|
iter->setAnchorPoint(Vec2::ZERO);
|
||||||
l->setAnchorPoint(Vec2::ZERO);
|
iter->setPosition(nextPosX, nextPosY);
|
||||||
l->setPosition(nextPosX, nextPosY);
|
this->addProtectedChild(iter, 1);
|
||||||
this->addProtectedChild(l, 1);
|
nextPosX += iter->getContentSize().width;
|
||||||
nextPosX += l->getContentSize().width;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete [] maxHeights;
|
delete [] maxHeights;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t length = _elementRenders.size();
|
for (auto& iter : _elementRenders)
|
||||||
for (size_t i = 0; i<length; i++)
|
{
|
||||||
{
|
iter->clear();
|
||||||
Vector<Node*>* l = _elementRenders[i];
|
delete iter;
|
||||||
l->clear();
|
}
|
||||||
delete l;
|
|
||||||
}
|
|
||||||
_elementRenders.clear();
|
_elementRenders.clear();
|
||||||
|
|
||||||
if (_ignoreSize)
|
if (_ignoreSize)
|
||||||
|
|
Loading…
Reference in New Issue