[Marble-commits] KDE/kdeedu/marble/src/lib
Jens-Michael Hoffmann
jensmh at gmx.de
Mon Mar 22 14:03:29 CET 2010
SVN commit 1106284 by jmhoffmann:
Optimize StackedTileLoader::flush()
- use STL-style instead of Java-style iterators,
- don't remove one item at a time from m_tilesOnDisplay, clearing m_tilesOnDisplay is sufficient.
M +4 -6 StackedTileLoader.cpp
--- trunk/KDE/kdeedu/marble/src/lib/StackedTileLoader.cpp #1106283:1106284
@@ -133,17 +133,15 @@
void StackedTileLoader::flush()
{
- // Remove all tiles from m_tilesOnDisplay
- QHashIterator<TileId, StackedTile*> it( d->m_tilesOnDisplay );
- while ( it.hasNext() ) {
- it.next();
+ // move all tiles from m_tilesOnDisplay into tile cache
+ QHash<TileId, StackedTile*>::const_iterator it = d->m_tilesOnDisplay.constBegin();
+ QHash<TileId, StackedTile*>::const_iterator const end = d->m_tilesOnDisplay.constEnd();
+ for (; it != end; ++it ) {
// If insert call result is false then the cache is too small to store the tile
// but the item will get deleted nevertheless and the pointer we have
// doesn't get set to zero (so don't delete it in this case or it will crash!)
d->m_tileCache.insert( it.key(), it.value(), it.value()->numBytes() );
- d->m_tilesOnDisplay.remove( it.key() );
}
-
d->m_tilesOnDisplay.clear();
}
More information about the Marble-commits
mailing list