diff options
author | Daniel Robertson <danlrobertson89@gmail.com> | 2015-08-25 12:24:33 -0400 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2015-08-30 13:03:22 +0000 |
commit | b7f4940c150b3bdd639afa988573a29774fff1f6 (patch) | |
tree | 7c4c6bc9af26b8fa282781ebffbc1a95f6a6037a /canvas/source/opengl/ogl_texturecache.cxx | |
parent | 49cb81b411e1c68cada5d3f4375de713118fce64 (diff) |
canvas: replace while loops with range-based for
Change-Id: Ide16bee666cf4df41646f9336a585e22a7fe53bd
Reviewed-on: https://gerrit.libreoffice.org/18131
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
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; |