diff options
Diffstat (limited to 'canvas/source/opengl/ogl_texturecache.cxx')
-rw-r--r-- | canvas/source/opengl/ogl_texturecache.cxx | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/canvas/source/opengl/ogl_texturecache.cxx b/canvas/source/opengl/ogl_texturecache.cxx index 6283bd883993..9335ff965808 100644 --- a/canvas/source/opengl/ogl_texturecache.cxx +++ b/canvas/source/opengl/ogl_texturecache.cxx @@ -37,12 +37,9 @@ namespace oglcanvas glBindTexture(GL_TEXTURE_2D, 0); // delete all cached textures - TextureCacheMapT::const_iterator aCurr=maCache.begin(); - const TextureCacheMapT::const_iterator aEnd=maCache.end(); - while( aCurr != aEnd ) + for( const auto& rCache : maCache ) { - glDeleteTextures(1, &aCurr->second.nTexture); - ++aCurr; + glDeleteTextures( 1, &rCache.second.nTexture ); } maCache.clear(); @@ -56,22 +53,21 @@ namespace oglcanvas glBindTexture(GL_TEXTURE_2D, 0); // delete already "old" textures, mark "new" entries "old" - TextureCacheMapT::iterator aNext; - TextureCacheMapT::iterator aCurr=maCache.begin(); - const TextureCacheMapT::iterator aEnd=maCache.end(); - while( aCurr != aEnd ) + const TextureCacheMapT::const_iterator aEnd = maCache.end(); + TextureCacheMapT::iterator aNext = maCache.begin(); + ++aNext; + for( auto aCurr = maCache.begin(); aCurr != aEnd; ++aNext ) { - aNext=aCurr; ++aNext; if( aCurr->second.bOld ) { - glDeleteTextures(1, &aCurr->second.nTexture); - maCache.erase(aCurr); + glDeleteTextures( 1, &aCurr->second.nTexture ); + maCache.erase( aCurr ); } else { aCurr->second.bOld = true; } - aCurr=aNext; + aCurr = aNext; } mnMissCount = 0; |