+ DALI_LOG_INFO(gAnimImgLogFilter,Debug::Concise,"AnimatedImageVisual::LoadFirstBatch()\n");
+
+ // Ensure the batch size and cache size are no bigger than the number of URLs,
+ // and that the cache is at least as big as the batch size.
+ uint16_t numUrls = mImageUrls->size();
+ uint16_t batchSize = std::min( mBatchSize, numUrls );
+ uint16_t cacheSize = std::min( std::max( batchSize, mCacheSize ), numUrls );
+
+ mUrlIndex = 0;
+ TextureManager& textureManager = mFactoryCache.GetTextureManager();
+
+ if( batchSize > 0 && cacheSize > 0 )
+ {
+ if( cacheSize < numUrls )
+ {
+ mImageCache = new RollingImageCache( textureManager, *mImageUrls, *this, cacheSize, batchSize );
+ }
+ else
+ {
+ mImageCache = new FixedImageCache( textureManager, *mImageUrls, *this, batchSize );
+ }
+ }
+ else
+ {
+ mImageCache = new RollingImageCache( textureManager, *mImageUrls, *this, 1, 1 );
+ }
+}
+
+void AnimatedImageVisual::StartFirstFrame( TextureSet& textureSet )
+{
+ DALI_LOG_INFO(gAnimImgLogFilter,Debug::Concise,"AnimatedImageVisual::StartFirstFrame()\n");
+
+ mStartFirstFrame = false;
+ mImpl->mRenderer.SetTextures( textureSet );
+ Actor actor = mPlacementActor.GetHandle();
+ if( actor )
+ {
+ actor.AddRenderer( mImpl->mRenderer );
+ mPlacementActor.Reset();
+ }
+
+ int frameDelay = mFrameDelay;
+ if( mFrameDelayContainer.Count() > 1 )
+ {
+ frameDelay = mFrameDelayContainer[0];
+ }
+ mFrameDelayTimer = Timer::New( frameDelay );
+ mFrameDelayTimer.TickSignal().Connect( this, &AnimatedImageVisual::DisplayNextFrame );
+ mFrameDelayTimer.Start();
+
+ DALI_LOG_INFO(gAnimImgLogFilter,Debug::Concise,"ResourceReady()\n");
+ ResourceReady();
+}
+
+TextureSet AnimatedImageVisual::PrepareTextureSet()
+{
+ TextureSet textureSet;
+ if( mImageUrl.IsValid() )
+ {
+ textureSet = PrepareAnimatedGifImage();
+ }
+ else
+ {
+ textureSet = mImageCache->FirstFrame();
+ if( textureSet )
+ {
+ SetImageSize( textureSet );
+ }
+ }
+ return textureSet;
+}
+
+TextureSet AnimatedImageVisual::PrepareAnimatedGifImage()
+{
+ TextureSet textureSet;
+