#define DALI_TOOLKIT_INTERNAL_ROLLING_ANIMATED_IMAGE_CACHE_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
public:
/**
* @brief Constructor.
- * @param[in] textureManager The texture manager
- * @param[in] animatedImageLoader The loaded animated image
- * @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] textureManager The texture manager
+ * @param[in] size The width and height to fit the loaded image to.
+ * @param[in] fittingMode The FittingMode of the resource to load
+ * @param[in] samplingMode The SamplingMode of the resource to load
+ * @param[in] animatedImageLoading The loaded animated image
+ * @param[in] maskingData Masking data to be applied.
+ * @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] wrapModeU Horizontal Wrap mode
+ * @param[in] wrapModeV Vertical Wrap mode
* @param[in] isSynchronousLoading The flag to define whether to load first frame synchronously
+ * @param[in] preMultiplyOnLoad The flag if image's color should be multiplied by it's alpha
*
* This will start loading textures immediately, according to the
* batch and cache sizes.
*/
- RollingAnimatedImageCache(TextureManager& textureManager,
- AnimatedImageLoading& animatedImageLoader,
- ImageCache::FrameReadyObserver& observer,
- uint16_t cacheSize,
- uint16_t batchSize,
- bool isSynchronousLoading);
+ RollingAnimatedImageCache(TextureManager& textureManager,
+ ImageDimensions size,
+ Dali::FittingMode::Type fittingMode,
+ Dali::SamplingMode::Type samplingMode,
+ AnimatedImageLoading& animatedImageLoading,
+ TextureManager::MaskingDataPointer& maskingData,
+ ImageCache::FrameReadyObserver& observer,
+ uint16_t cacheSize,
+ uint16_t batchSize,
+ const Dali::WrapMode::Type& wrapModeU,
+ const Dali::WrapMode::Type& wrapModeV,
+ bool isSynchronousLoading,
+ bool preMultiplyOnLoad);
/**
* @brief Destructor
bool IsFrontReady() const;
/**
+ * @brief Request to Load a frame asynchronously
+ *
+ * @param[in] frameIndex index of frame to be loaded.
+ *
+ * @return the texture set currently loaded.
+ */
+ TextureSet RequestFrameLoading(uint32_t frameIndex);
+
+ /**
* @brief Request to Load a frame
*
- * @param[in] frameIndex index of frame to be loaded.
- * @param[in] useCache true if this frame loading uses cache.
- * @param[in] synchronousLoading true if the frame should be loaded synchronously
+ * @param[in] frameIndex Index of frame to be loaded.
+ * @param[in] synchronousLoading True if the frame should be loaded synchronously
+ * @param[in,out] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if the
+ * image has no alpha channel
*
* @return the texture set currently loaded.
*/
- TextureSet RequestFrameLoading(uint32_t frameIndex, bool useCache, bool synchronousLoading);
+ TextureSet RequestFrameLoading(uint32_t frameIndex, bool synchronousLoading, TextureManager::MultiplyOnLoad& preMultiplyOnLoading);
/**
* @brief Load the next batch of images
*
* @param[in] loadSuccess whether the loading is succeded or not.
* @param[in] textureSet textureSet for this frame.
+ * @param[in] frameCount Total frame count for this image.
* @param[in] interval interval between this frame and next frame.
+ * @param[in] preMultiplied whether the texture is premultied alpha or not.
*/
- void MakeFrameReady(bool loadSuccess, TextureSet textureSet, uint32_t interval);
+ void MakeFrameReady(bool loadSuccess, TextureSet textureSet, uint32_t frameCount, uint32_t interval, bool preMultiplied);
+
+ /**
+ * @brief Pop front entity of Cache.
+ */
+ void PopFrontCache();
protected:
/**
void LoadComplete(bool loadSuccess, TextureInformation textureInformation) override;
private:
-
/**
* Secondary class to hold readiness and index into url
*/
uint32_t mFrameNumber = 0u;
bool mReady = false;
};
+ std::vector<TextureManager::TextureId> mTextureIds;
+ VisualUrl mImageUrl;
Dali::AnimatedImageLoading mAnimatedImageLoading;
uint32_t mFrameCount;
uint32_t mFrameIndex;
uint32_t mCacheSize;
- std::vector<UrlStore> mImageUrls;
std::vector<int32_t> mIntervals;
std::vector<uint32_t> mLoadWaitingQueue;
CircularQueue<ImageFrame> mQueue;
+ Dali::WrapMode::Type mWrapModeU : 3;
+ Dali::WrapMode::Type mWrapModeV : 3;
bool mIsSynchronousLoading;
};