1 #ifndef DALI_TOOLKIT_INTERNAL_FIXED_IMAGE_CACHE_H
2 #define DALI_TOOLKIT_INTERNAL_FIXED_IMAGE_CACHE_H
5 * Copyright (c) 2020 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/visuals/animated-image/image-cache.h>
22 #include <dali-toolkit/internal/visuals/texture-manager-impl.h>
31 class FixedImageCache : public ImageCache, public TextureUploadObserver
36 * @param[in] textureManager The texture manager
37 * @param[in] urlList List of urls to cache
38 * @param[in] observer FrameReady observer
39 * @param[in] batchSize The size of a batch to load
41 * This will start loading textures immediately, according to the
42 * batch and cache sizes. The cache is as large as the number of urls.
44 FixedImageCache( TextureManager& textureManager,
46 ImageCache::FrameReadyObserver& observer,
47 unsigned int batchSize );
49 virtual ~FixedImageCache();
52 * Get the Nth frame. If it's not ready, this will trigger the
53 * sending of FrameReady() when the image becomes ready.
55 TextureSet Frame( uint32_t frameIndex ) override;
58 * Get the first frame. If it's not ready, this will trigger the
59 * sending of FrameReady() when the image becomes ready.
61 TextureSet FirstFrame() override;
64 * Get the next frame. If it's not ready, this will trigger the
65 * sending of FrameReady() when the image becomes ready.
66 * This will trigger the loading of the next batch.
68 TextureSet NextFrame() override;
72 * @return true if the front frame is ready
74 bool IsFrontReady() const;
77 * Load the next batch of images
82 * Find the matching image frame, and set it to ready
84 void SetImageFrameReady( TextureManager::TextureId textureId );
87 * Get the texture set of the front frame.
88 * @return the texture set
90 TextureSet GetFrontTextureSet() const;
93 * Check if the front frame has become ready - if so, inform observer
94 * @param[in] wasReady Readiness before call.
96 void CheckFrontFrame( bool wasReady );
102 TextureSet textureSet,
104 const Vector4& atlasRect,
105 bool premultiplied ) override;
109 Devel::PixelBuffer pixelBuffer,
110 const VisualUrl& url,
111 bool preMultiplied ) override;
114 std::vector<UrlStore>& mImageUrls;
115 std::vector<bool> mReadyFlags;
119 } //namespace Internal
120 } //namespace Toolkit
123 #endif // DALI_TOOLKIT_INTERNAL_FIXED_IMAGE_CACHE_H