X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fanimated-image%2Frolling-animated-image-cache.h;h=8281c323f45a52fc9e3f85c152377b0babb91c1b;hp=503f65e8b9afd2caeb2572b2a9bb2097e88b8022;hb=43ca048f4200d2f1d6e59c2163af59cd99a45b2e;hpb=da6b7205afe6a54fb1caf7a765008948a57f45eb diff --git a/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.h b/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.h index 503f65e..8281c32 100644 --- a/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.h +++ b/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.h @@ -37,7 +37,7 @@ namespace Internal * Frames are always ready, so the observer.FrameReady callback is never triggered; * the FirstFrame and NextFrame APIs will always return a texture. */ -class RollingAnimatedImageCache : public ImageCache +class RollingAnimatedImageCache : public ImageCache, public TextureUploadObserver { public: /** @@ -48,16 +48,18 @@ public: * @param[in] observer FrameReady observer * @param[in] cacheSize The size of the cache * @param[in] batchSize The size of a batch to load + * @param[in] isSynchronousLoading The flag to define whether to load first frame synchronously * * This will start loading textures immediately, according to the * batch and cache sizes. */ RollingAnimatedImageCache( TextureManager& textureManager, - AnimatedImageLoading& animatedImageLoader, - uint32_t frameCount, - ImageCache::FrameReadyObserver& observer, - uint16_t cacheSize, - uint16_t batchSize ); + AnimatedImageLoading& animatedImageLoader, + uint32_t frameCount, + ImageCache::FrameReadyObserver& observer, + uint16_t cacheSize, + uint16_t batchSize, + bool isSynchronousLoading ); /** * Destructor @@ -88,11 +90,21 @@ private: bool IsFrontReady() const; /** + * Request to Load a frame + */ + void RequestFrameLoading( uint32_t frameIndex ); + + /** * Load the next batch of images */ void LoadBatch(); /** + * Find the matching image frame, and set it to ready + */ + void SetImageFrameReady( TextureManager::TextureId textureId ); + + /** * Get the texture set of the front frame. * @return the texture set */ @@ -103,6 +115,27 @@ private: */ TextureManager::TextureId GetCachedTextureId( int index ) const; + /** + * Check if the front frame has become ready - if so, inform observer + * @param[in] wasReady Readiness before call. + */ + void CheckFrontFrame( bool wasReady ); + +protected: + void UploadComplete( + bool loadSuccess, + int32_t textureId, + TextureSet textureSet, + bool useAtlasing, + const Vector4& atlasRect, + bool preMultiplied ) override; + + void LoadComplete( + bool loadSuccess, + Devel::PixelBuffer pixelBuffer, + const VisualUrl& url, + bool preMultiplied ) override; + private: /** * Secondary class to hold readiness and index into url @@ -110,14 +143,18 @@ private: struct ImageFrame { unsigned int mFrameNumber = 0u; + bool mReady = false; }; - Dali::AnimatedImageLoading& mAnimatedImageLoading; - uint32_t mFrameCount; - int mFrameIndex; - std::vector mImageUrls; - uint16_t mCacheSize; - CircularQueue mQueue; + Dali::AnimatedImageLoading mAnimatedImageLoading; + uint32_t mFrameCount; + int mFrameIndex; + std::vector mImageUrls; + std::vector mIntervals; + std::vector mLoadWaitingQueue; + CircularQueue mQueue; + bool mIsSynchronousLoading; + bool mOnLoading; }; } // namespace Internal