1 #ifndef DALI_TOOLKIT_INTERNAL_FIXED_IMAGE_CACHE_H
2 #define DALI_TOOLKIT_INTERNAL_FIXED_IMAGE_CACHE_H
5 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 #include <dali-toolkit/internal/texture-manager/texture-manager-impl.h>
22 #include <dali-toolkit/internal/visuals/animated-image/image-cache.h>
30 class FixedImageCache : public ImageCache, public TextureUploadObserver
35 * @param[in] textureManager The texture manager
36 * @param[in] size The width and height to fit the loaded image to.
37 * @param[in] fittingMode The FittingMode of the resource to load
38 * @param[in] samplingMode The SamplingMode of the resource to load
39 * @param[in] urlList List of urls to cache
40 * @param[in] maskingData Masking data to be applied.
41 * @param[in] observer FrameReady observer
42 * @param[in] batchSize The size of a batch to load
43 * @param[in] interval Time interval between each frame
45 * This will start loading textures immediately, according to the
46 * batch and cache sizes. The cache is as large as the number of urls.
48 FixedImageCache(TextureManager& textureManager,
50 Dali::FittingMode::Type fittingMode,
51 Dali::SamplingMode::Type samplingMode,
53 TextureManager::MaskingDataPointer& maskingData,
54 ImageCache::FrameReadyObserver& observer,
58 ~FixedImageCache() override;
61 * @copydoc Internal::ImageCache::Frame()
63 TextureSet Frame(uint32_t frameIndex) override;
66 * @copydoc Internal::ImageCache::FirstFrame()
68 TextureSet FirstFrame() override;
71 * @copydoc Internal::ImageCache::GetFrameInterval()
73 uint32_t GetFrameInterval(uint32_t frameIndex) const override;
76 * @copydoc Internal::ImageCache::GetCurrentFrameIndex()
78 int32_t GetCurrentFrameIndex() const override;
81 * @copydoc Internal::ImageCache::GetTotalFrameCount()
83 int32_t GetTotalFrameCount() const override;
86 * @copydoc Internal::ImageCache::ClearCache()
88 void ClearCache() override;
92 * @brief Check whether the front frame is ready or not.
94 * @return true if the front frame is ready
96 bool IsFrontReady() const;
99 * @brief Load the next batch of images
104 * @brief Get the texture set of the front frame.
106 * @return the texture set of the front of Cache.
108 TextureSet GetFrontTextureSet() const;
111 * @brief Check if the front frame has become ready - if so, inform observer
113 * @param[in] wasReady Readiness before call.
115 void CheckFrontFrame(bool wasReady);
119 * @copydoc Toolkit::TextureUploadObserver::LoadComplete()
121 void LoadComplete(bool loadSuccess, TextureInformation textureInformation) override;
124 std::vector<UrlStore>& mImageUrls;
125 std::vector<bool> mReadyFlags;
126 std::vector<TextureManager::LoadState> mLoadStates;
130 } //namespace Internal
131 } //namespace Toolkit
134 #endif // DALI_TOOLKIT_INTERNAL_FIXED_IMAGE_CACHE_H