1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-24 17:26:41 +00:00

very minor perf thing: skip some RenderObject child checks when there are no children

This commit is contained in:
fgenesis 2024-07-13 06:48:30 +02:00
parent 1573eea051
commit a046038c33

View file

@ -749,40 +749,43 @@ void RenderObject::onUpdate(float dt)
internalOffset.update(dt);
rotationOffset.update(dt);
bool hasChildrenToDelete = false;
for (Children::iterator i = children.begin(); i != children.end(); i++)
if(!children.empty())
{
if (shareAlphaWithChildren)
(*i)->alpha.x = this->alpha.x;
if (shareColorWithChildren)
(*i)->color = this->color;
if ((*i)->pm != PM_NONE)
bool hasChildrenToDelete = false;
for (Children::iterator i = children.begin(); i != children.end(); i++)
{
(*i)->update(dt);
}
hasChildrenToDelete |= (*i)->_markedForDelete;
if (shareAlphaWithChildren)
(*i)->alpha.x = this->alpha.x;
if (shareColorWithChildren)
(*i)->color = this->color;
}
if ((*i)->pm != PM_NONE)
{
(*i)->update(dt);
}
hasChildrenToDelete |= (*i)->_markedForDelete;
if (hasChildrenToDelete)
{
size_t w = 0;
const size_t N = children.size();
for (size_t i = 0; i < N; ++i)
}
if (hasChildrenToDelete)
{
RenderObject *ro = children[i];
if(ro->_markedForDelete)
size_t w = 0;
const size_t N = children.size();
for (size_t i = 0; i < N; ++i)
{
ro->parent = NULL;
ro->destroy();
if(ro->pm == PM_POINTER)
delete ro;
RenderObject *ro = children[i];
if(ro->_markedForDelete)
{
ro->parent = NULL;
ro->destroy();
if(ro->pm == PM_POINTER)
delete ro;
}
else
children[w++] = ro;
}
else
children[w++] = ro;
children.resize(w);
}
children.resize(w);
}
if (MotionBlurData *mb = this->motionBlur)