Added app callback to Drawable.
This commit is contained in:
@@ -206,3 +206,22 @@ void Drawable::flushDeletedDisplayLists(uint contextID)
|
||||
s_deletedDisplayListCache.erase(citr);
|
||||
}
|
||||
}
|
||||
|
||||
void Drawable::setAppCallback(AppCallback* ac)
|
||||
{
|
||||
if (_appCallback==ac) return;
|
||||
|
||||
int delta = 0;
|
||||
if (_appCallback.valid()) --delta;
|
||||
if (ac) ++delta;
|
||||
|
||||
if (delta!=0)
|
||||
{
|
||||
for(ParentList::iterator itr=_parents.begin();
|
||||
itr!=_parents.end();
|
||||
++itr)
|
||||
{
|
||||
(*itr)->setNumChildrenRequiringAppTraversal((*itr)->getNumChildrenRequiringAppTraversal()+delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,11 @@ const bool Geode::addDrawable( Drawable *drawable )
|
||||
// register as parent of drawable.
|
||||
drawable->addParent(this);
|
||||
|
||||
if (drawable->getAppCallback())
|
||||
{
|
||||
setNumChildrenRequiringAppTraversal(getNumChildrenRequiringAppTraversal()+1);
|
||||
}
|
||||
|
||||
dirtyBound();
|
||||
|
||||
return true;
|
||||
@@ -59,6 +64,11 @@ const bool Geode::removeDrawable( Drawable *drawable )
|
||||
// remove this Geode from the child parent list.
|
||||
drawable->removeParent(this);
|
||||
|
||||
if (drawable->getAppCallback())
|
||||
{
|
||||
setNumChildrenRequiringAppTraversal(getNumChildrenRequiringAppTraversal()-1);
|
||||
}
|
||||
|
||||
// note ref_ptr<> automatically handles decrementing drawable's reference count.
|
||||
_drawables.erase(itr);
|
||||
|
||||
@@ -77,7 +87,14 @@ const bool Geode::replaceDrawable( Drawable *origDrawable, Drawable *newDrawable
|
||||
DrawableList::iterator itr = findDrawable(origDrawable);
|
||||
if (itr!=_drawables.end())
|
||||
{
|
||||
|
||||
int delta = 0;
|
||||
if (origDrawable->getAppCallback()) --delta;
|
||||
if (newDrawable->getAppCallback()) ++delta;
|
||||
if (delta!=0)
|
||||
{
|
||||
setNumChildrenRequiringAppTraversal(getNumChildrenRequiringAppTraversal()+delta);
|
||||
}
|
||||
|
||||
// remove from origDrawable's parent list.
|
||||
origDrawable->removeParent(this);
|
||||
|
||||
@@ -88,6 +105,7 @@ const bool Geode::replaceDrawable( Drawable *origDrawable, Drawable *newDrawable
|
||||
// register as parent of child.
|
||||
newDrawable->addParent(this);
|
||||
|
||||
|
||||
dirtyBound();
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user