- void RemoveText( const Vector<GlyphInfo>& glyphs )
- {
- Vector< CheckEntry > checked;
- CheckEntry checkEntry;
-
- for ( Vector< TextCacheEntry >::Iterator tCit = mTextCache.Begin(); tCit != mTextCache.End(); ++tCit )
- {
- uint32_t index = tCit->mIndex;
- uint32_t fontId = tCit->mFontId;
-
- // Check that this character has not already been checked...
- bool wasChecked = false;
- for ( Vector< CheckEntry >::Iterator cEit = checked.Begin(); cEit != checked.End(); ++cEit )
- {
- if ( fontId == cEit->mFontId && index == cEit->mIndex )
- {
- wasChecked = true;
- }
- }
-
- if ( !wasChecked )
- {
-
- int32_t newCount = 0;
- int32_t oldCount = 0;
-
- // How many times does this character occur in the old text ?
- for ( Vector< TextCacheEntry >::Iterator oTcit = mTextCache.Begin(); oTcit != mTextCache.End(); ++oTcit )
- {
- if ( fontId == oTcit->mFontId && index == oTcit->mIndex )
- {
- oldCount++;
- }
- }
-
- // And how many times in the new ?
- for ( Vector< GlyphInfo >::Iterator cGit = glyphs.Begin(); cGit != glyphs.End(); ++cGit )
- {
- if ( fontId == cGit->fontId && index == cGit->index )
- {
- newCount++;
- }
- }
- mGlyphManager.AdjustReferenceCount( fontId, tCit->mImageId, newCount - oldCount );
- checkEntry.mIndex = index;
- checkEntry.mFontId = fontId;
- checked.PushBack( checkEntry );
- }
- }
- mTextCache.Resize( 0 );
- }
-