some more cleanup

This commit is contained in:
AJ Kelly
2010-06-26 20:30:27 -05:00
parent b539c24260
commit 5bc8755090
3 changed files with 21 additions and 23 deletions
+9 -11
View File
@@ -11,8 +11,7 @@
/* Tricky: We need ActorFrames created in Lua to auto delete their children. /* Tricky: We need ActorFrames created in Lua to auto delete their children.
* We don't want classes that derive from ActorFrame to auto delete their * We don't want classes that derive from ActorFrame to auto delete their
* children. The name "ActorFrame" is widely used in Lua, so we'll have * children. The name "ActorFrame" is widely used in Lua, so we'll have
* that string instead create an ActorFrameAutoDeleteChildren object. * that string instead create an ActorFrameAutoDeleteChildren object. */
*/
//REGISTER_ACTOR_CLASS( ActorScroller ) //REGISTER_ACTOR_CLASS( ActorScroller )
REGISTER_ACTOR_CLASS_WITH_NAME( ActorScrollerAutoDeleteChildren, ActorScroller ) REGISTER_ACTOR_CLASS_WITH_NAME( ActorScrollerAutoDeleteChildren, ActorScroller )
ActorScroller *ActorScroller::Copy() const { return new ActorScroller(*this); } ActorScroller *ActorScroller::Copy() const { return new ActorScroller(*this); }
@@ -165,7 +164,7 @@ void ActorScroller::UpdateInternal( float fDeltaTime )
{ {
ActorFrame::UpdateInternal( fDeltaTime ); ActorFrame::UpdateInternal( fDeltaTime );
/* If we have no children, the code below will busy loop. */ // If we have no children, the code below will busy loop.
if( !m_SubActors.size() ) if( !m_SubActors.size() )
return; return;
@@ -219,10 +218,8 @@ void ActorScroller::PositionItems()
PositionItemsAndDrawPrimitives( false ); PositionItemsAndDrawPrimitives( false );
} }
/* /* Shift m_SubActors forward by iDist. This will place item m_iFirstSubActorIndex
* Shift m_SubActors forward by iDist. This will place item m_iFirstSubActorIndex * in m_SubActors[0]. */
* in m_SubActors[0].
*/
void ActorScroller::ShiftSubActors( int iDist ) void ActorScroller::ShiftSubActors( int iDist )
{ {
if( iDist != INT_MAX ) if( iDist != INT_MAX )
@@ -264,7 +261,7 @@ void ActorScroller::PositionItemsAndDrawPrimitives( bool bDrawPrimitives )
vector<Actor*> subs; vector<Actor*> subs;
{ {
/* Shift m_SubActors so iFirstItemToDraw is at the beginning. */ // Shift m_SubActors so iFirstItemToDraw is at the beginning.
int iNewFirstIndex = iFirstItemToDraw; int iNewFirstIndex = iFirstItemToDraw;
int iDist = iNewFirstIndex - m_iFirstSubActorIndex; int iDist = iNewFirstIndex - m_iFirstSubActorIndex;
m_iFirstSubActorIndex = iNewFirstIndex; m_iFirstSubActorIndex = iNewFirstIndex;
@@ -282,9 +279,10 @@ void ActorScroller::PositionItemsAndDrawPrimitives( bool bDrawPrimitives )
else if( iIndex < 0 || iIndex >= (int)m_SubActors.size() ) else if( iIndex < 0 || iIndex >= (int)m_SubActors.size() )
continue; continue;
// Optimization: Zero out unused parameters so that they don't create new, unnecessary // Optimization: Zero out unused parameters so that they don't create new,
// entries in the position cache. On scrollers with lots of items, // unnecessary entries in the position cache. On scrollers with lots of
// especially with Subdivisions > 1, m_exprTransformFunction uses too much memory. // items, especially with Subdivisions > 1, m_exprTransformFunction uses
// too much memory.
if( !m_bFunctionDependsOnPositionOffset ) if( !m_bFunctionDependsOnPositionOffset )
fPosition = 0; fPosition = 0;
if( !m_bFunctionDependsOnItemIndex ) if( !m_bFunctionDependsOnItemIndex )