From b4b3d6ef19e99e069375602af200512f2b9574a1 Mon Sep 17 00:00:00 2001 From: Richard Underhill Date: Tue, 24 Mar 2015 09:56:50 +0000 Subject: [PATCH] Fixed Atlas Manager bug with reusing blocks in freeblockslist Change-Id: I1aa2309b5aec26232d278f7f319a5d483867d824 Signed-off-by: Richard Underhill --- dali-toolkit/internal/atlas-manager/atlas-manager-impl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/internal/atlas-manager/atlas-manager-impl.cpp b/dali-toolkit/internal/atlas-manager/atlas-manager-impl.cpp index fbca017..826ea1e 100644 --- a/dali-toolkit/internal/atlas-manager/atlas-manager-impl.cpp +++ b/dali-toolkit/internal/atlas-manager/atlas-manager-impl.cpp @@ -237,7 +237,9 @@ AtlasManager::SizeType AtlasManager::CheckAtlas( SizeType atlas, SizeType blocksInX = mAtlasList[ atlas ].mWidth / mAtlasList[ atlas ].mBlockWidth; SizeType blocksInY = mAtlasList[ atlas ].mHeight / mAtlasList[ atlas ].mBlockHeight; totalBlocks = blocksInX * blocksInY; - SizeType blocksFree = mAtlasList[ atlas ].mNextFreeBlock ? totalBlocks - mAtlasList[ atlas ].mNextFreeBlock + 1u : 0; + SizeType blocksFree = mAtlasList[ atlas ].mNextFreeBlock ? + totalBlocks - mAtlasList[ atlas ].mNextFreeBlock + 1u : + mAtlasList[ atlas ].mFreeBlocksList.Size(); // Check to see if the image will fit in these blocks, if not we'll need to create a new atlas if ( blocksFree @@ -818,7 +820,8 @@ void AtlasManager::GetMetrics( Toolkit::AtlasManager::Metrics& metrics ) entry.mBlockWidth = blockWidth; entry.mBlockHeight = blockHeight; entry.mTotalBlocks = ( width / blockWidth ) * ( height / blockHeight ); - entry.mBlocksUsed = mAtlasList[ i ].mNextFreeBlock ? mAtlasList[ i ].mNextFreeBlock : entry.mTotalBlocks - mAtlasList[ i ].mFreeBlocksList.Size(); + uint32_t reuseBlocks = mAtlasList[ i ].mFreeBlocksList.Size(); + entry.mBlocksUsed = mAtlasList[ i ].mNextFreeBlock ? mAtlasList[ i ].mNextFreeBlock - reuseBlocks - 1u: entry.mTotalBlocks - reuseBlocks; entry.mPixelFormat = GetPixelFormat( i + 1 ); metrics.mAtlasMetrics.PushBack( entry ); -- 2.7.4