Fix image-visual natural size issue using atlas
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / animated-image / rolling-gif-image-cache.cpp
index ed61adb..4854076 100644 (file)
@@ -74,13 +74,17 @@ RollingGifImageCache::RollingGifImageCache(
 
 RollingGifImageCache::~RollingGifImageCache()
 {
-  while( !mQueue.IsEmpty() )
+  if( mTextureManagerAlive )
   {
-    ImageFrame imageFrame = mQueue.PopFront();
-    Dali::Toolkit::TextureManager::RemoveTexture( mImageUrls[ imageFrame.mFrameNumber ].mUrl );
+    while( !mQueue.IsEmpty() )
+    {
+      ImageFrame imageFrame = mQueue.PopFront();
+      Dali::Toolkit::TextureManager::RemoveTexture( mImageUrls[ imageFrame.mFrameNumber ].mUrl );
+    }
   }
 }
 
+
 TextureSet RollingGifImageCache::FirstFrame()
 {
   return GetFrontTextureSet();
@@ -147,12 +151,13 @@ void RollingGifImageCache::LoadBatch()
       AtlasUploadObserver* atlasObserver = nullptr;
       ImageAtlasManagerPtr imageAtlasManager = nullptr;
       Vector4 textureRect;
+      Dali::ImageDimensions textureRectSize;
       auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
 
       mTextureManager.LoadTexture(
         mImageUrls[ imageFrame.mFrameNumber ].mUrl, ImageDimensions(), FittingMode::SCALE_TO_FILL,
         SamplingMode::BOX_THEN_LINEAR, maskInfo,
-        synchronousLoading, mImageUrls[ imageFrame.mFrameNumber ].mTextureId, textureRect,
+        synchronousLoading, mImageUrls[ imageFrame.mFrameNumber ].mTextureId, textureRect, textureRectSize,
         atlasingStatus, loadingStatus, Dali::WrapMode::Type::DEFAULT,
         Dali::WrapMode::Type::DEFAULT, NULL,
         atlasObserver, imageAtlasManager, ENABLE_ORIENTATION_CORRECTION, TextureManager::ReloadPolicy::CACHED, preMultiply );