1 #ifndef DALI_TOOLKIT_TEXTURE_MANAGER_IMPL_H
2 #define DALI_TOOLKIT_TEXTURE_MANAGER_IMPL_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/devel-api/adaptor-framework/animated-image-loading.h>
22 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
23 #include <dali/public-api/adaptor-framework/encoded-image-buffer.h>
24 #include <dali/public-api/common/dali-vector.h>
25 #include <dali/public-api/rendering/geometry.h>
28 #include <dali-toolkit/devel-api/image-loader/image-atlas.h>
29 #include <dali-toolkit/internal/helpers/round-robin-container-view.h>
30 #include <dali-toolkit/internal/texture-manager/texture-cache-manager.h>
31 #include <dali-toolkit/internal/texture-manager/texture-manager-type.h>
32 #include <dali-toolkit/internal/texture-manager/texture-upload-observer.h>
33 #include <dali-toolkit/internal/visuals/visual-url.h>
41 class ImageAtlasManager;
42 typedef IntrusivePtr<ImageAtlasManager> ImageAtlasManagerPtr;
43 class TextureAsyncLoadingHelper;
46 * The TextureManager provides a common Image loading API for Visuals.
48 * The TextureManager is responsible for providing sync, async, atlased and non-atlased
49 * CPU time alpha masking, animated image loads.
51 * Texture caching is provided and performed by TextureCacheManager.
52 * TextureUploadObserver.LoadComplete called when async load completed.
54 class TextureManager : public ConnectionTracker
57 // Copy enum and types and const values that TextureManager will use.
58 using TextureId = TextureManagerType::TextureId;
59 using TextureCacheIndex = TextureManagerType::TextureCacheIndex;
60 using TextureHash = TextureManagerType::TextureHash;
62 static constexpr TextureId INVALID_TEXTURE_ID = TextureManagerType::INVALID_TEXTURE_ID;
63 static constexpr TextureCacheIndex INVALID_CACHE_INDEX = TextureManagerType::INVALID_CACHE_INDEX;
65 using UseAtlas = TextureManagerType::UseAtlas;
66 using StorageType = TextureManagerType::StorageType;
67 using LoadType = TextureManagerType::LoadType;
68 using LoadState = TextureManagerType::LoadState;
69 using ReloadPolicy = TextureManagerType::ReloadPolicy;
70 using MultiplyOnLoad = TextureManagerType::MultiplyOnLoad;
71 using TextureInfo = TextureManagerType::TextureInfo;
77 ~MaskingData() = default;
79 VisualUrl mAlphaMaskUrl;
80 TextureManager::TextureId mAlphaMaskId;
81 float mContentScaleFactor;
83 bool mPreappliedMasking;
84 bool mMaskImageLoadingFailed;
86 using MaskingDataPointer = std::unique_ptr<MaskingData>;
89 * Class to provide lifecycle event on destruction of texture manager.
91 struct LifecycleObserver
94 * Called shortly before the texture manager is destroyed.
96 virtual void TextureManagerDestroyed() = 0;
107 ~TextureManager() override;
109 // TextureManager Main API:
112 * @brief Requests an frame of animated image load.
114 * The parameters are used to specify how the animated image is loaded.
115 * The observer has the LoadComplete method called when the load is ready.
117 * @param[in] url The URL of the image to load
118 * @param[in] animatedImageLoading The AnimatedImageLoading that contain the animated image information
119 * @param[in] frameIndex The frame index to load.
120 * @param[out] textureId The textureId of the frame
121 * @param[in, out] maskInfo Mask info structure
122 * @param[in] samplingMode The SamplingMode to use
123 * @param[in] synchronousLoading true if the frame should be loaded synchronously
124 * @param[in] textureObserver The client object should inherit from this and provide the "LoadCompleted" virtual.
125 * This is called when an image load completes (or fails).
126 * @param[in,out] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if the
127 * image has no alpha channel
129 * @return The texture set containing the frame of animated image, or empty if still loading.
131 TextureSet LoadAnimatedImageTexture(const VisualUrl& url,
132 Dali::AnimatedImageLoading animatedImageLoading,
133 const uint32_t& frameIndex,
134 TextureManager::TextureId& textureId,
135 MaskingDataPointer& maskInfo,
136 const Dali::SamplingMode::Type& samplingMode,
137 const bool& synchronousLoading,
138 TextureUploadObserver* textureObserver,
139 TextureManager::MultiplyOnLoad& preMultiplyOnLoad);
142 * @brief Requests an image load of the given URL to get PixelBuffer.
144 * The parameters are used to specify how the image is loaded.
145 * The observer has the LoadComplete method called when the load is ready.
147 * @param[in] url The URL of the image to load
148 * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic
149 * @param[in] fittingMode The FittingMode to use
150 * @param[in] samplingMode The SamplingMode to use
151 * @param[in] synchronousLoading true if the URL should be loaded synchronously
152 * @param[in] textureObserver The client object should inherit from this and provide the "LoadCompleted" virtual.
153 * This is called when an image load completes (or fails).
154 * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data
155 * @param[in,out] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if the
156 * image has no alpha channel
158 * @return The pixel buffer containing the image, or empty if still loading.
160 Devel::PixelBuffer LoadPixelBuffer(
161 const VisualUrl& url,
162 const Dali::ImageDimensions& desiredSize,
163 const Dali::FittingMode::Type& fittingMode,
164 const Dali::SamplingMode::Type& samplingMode,
165 const bool& synchronousLoading,
166 TextureUploadObserver* textureObserver,
167 const bool& orientationCorrection,
168 TextureManager::MultiplyOnLoad& preMultiplyOnLoad);
171 * @brief Requests an image load of the given URL.
173 * The parameters are used to specify how the image is loaded.
174 * The observer has the LoadComplete method called when the load is ready.
176 * When the client has finished with the Texture, Remove() should be called.
178 * @param[in] url The URL of the image to load
179 * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic
180 * @param[in] fittingMode The FittingMode to use
181 * @param[in] samplingMode The SamplingMode to use
182 * @param[in, out] maskInfo Mask info structure
183 * @param[in] synchronousLoading true if the URL should be loaded synchronously
184 * @param[out] textureId, The textureId of the URL
185 * @param[out] textureRect The rectangle within the texture atlas that this URL occupies,
186 * this is the rectangle in normalized coordinates.
187 * @param[out] textureRectSize The rectangle within the texture atlas that this URL occupies,
188 * this is the same rectangle in pixels.
189 * @param[in,out] atlasingStatus Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still
190 * be loaded, and marked successful, but this will be set to false.
191 * If atlasing succeeds, this will be set to true.
192 * @param[out] loadingStatus The loading status of the texture
193 * @param[in] textureObserver The client object should inherit from this and provide the "LoadCompleted" virtual.
194 * This is called when an image load completes (or fails).
195 * @param[in] atlasObserver This is used if the texture is atlased, and will be called instead of
196 * textureObserver.LoadCompleted
197 * @param[in] imageAtlasManager The atlas manager to use for atlasing textures
198 * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data
199 * @param[in] reloadPolicy Forces a reload of the texture even if already cached
200 * @param[in,out] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if the
201 * image has no alpha channel
203 * @return The texture set containing the image, or empty if still loading.
205 TextureSet LoadTexture(
206 const VisualUrl& url,
207 const Dali::ImageDimensions& desiredSize,
208 const Dali::FittingMode::Type& fittingMode,
209 const Dali::SamplingMode::Type& samplingMode,
210 MaskingDataPointer& maskInfo,
211 const bool& synchronousLoading,
212 TextureManager::TextureId& textureId,
213 Dali::Vector4& textureRect,
214 Dali::ImageDimensions& textureRectSize,
215 bool& atlasingStatus,
217 TextureUploadObserver* textureObserver,
218 AtlasUploadObserver* atlasObserver,
219 ImageAtlasManagerPtr imageAtlasManager,
220 const bool& orientationCorrection,
221 const TextureManager::ReloadPolicy& reloadPolicy,
222 TextureManager::MultiplyOnLoad& preMultiplyOnLoad);
225 * @brief Remove a Texture from the TextureManager.
227 * Textures are cached and therefore only the removal of the last
228 * occurrence of a Texture will cause its removal internally.
230 * @param[in] textureId The ID of the Texture to remove.
231 * @param[in] textureObserver The texture observer.
233 void Remove(const TextureManager::TextureId& textureId, TextureUploadObserver* textureObserver);
236 * Add an observer to the object.
237 * @param[in] observer The observer to add.
239 void AddObserver(TextureManager::LifecycleObserver& observer);
242 * Remove an observer from the object
243 * @pre The observer has already been added.
244 * @param[in] observer The observer to remove.
246 void RemoveObserver(TextureManager::LifecycleObserver& observer);
249 * @brief Returns the geometry associated with texture.
250 * @param[in] textureId Id of the texture
251 * @param[out] frontElements number of front elements
252 * @param[out] backElements number of back elements
253 * @return Returns valid geometry object
255 Geometry GetRenderGeometry(const TextureManager::TextureId& textureId, std::uint32_t& frontElements, std::uint32_t& backElements);
258 * @brief Returns the textureSet in texture manager.
259 * @param[in] textureId Id of the texture
260 * @return The textureSet in texture manager. These textures include YUV textures or images and masks.
262 TextureSet GetTextureSet(const TextureManager::TextureId& textureId);
265 * @brief Returns the textureSet in texture manager.
266 * @param[in] textureInfo the information of the texture
267 * @return The textureSet in texture manager. These textures include YUV textures or images and masks.
269 TextureSet GetTextureSet(const TextureManager::TextureInfo& textureInfo);
272 // API list that need to access TextureCacheManager.
275 * @copydoc TextureCacheManager::GetVisualUrl
277 inline VisualUrl GetVisualUrl(const TextureManager::TextureId& textureId)
279 return mTextureCacheManager.GetVisualUrl(textureId);
283 * @copydoc TextureCacheManager::GetTexture
285 inline Texture GetTexture(const TextureManager::TextureId& textureId)
287 return mTextureCacheManager.GetTexture(textureId);
291 * @copydoc TextureCacheManager::RemoveExternalTexture
293 inline TextureSet RemoveExternalTexture(const std::string& url)
295 return mTextureCacheManager.RemoveExternalTexture(url);
299 * @copydoc TextureCacheManager::RemoveEncodedImageBuffer
301 inline EncodedImageBuffer RemoveEncodedImageBuffer(const std::string& url)
303 return mTextureCacheManager.RemoveEncodedImageBuffer(url);
307 * @copydoc TextureCacheManager::UseExternalResource
309 inline void UseExternalResource(const VisualUrl& url)
311 mTextureCacheManager.UseExternalResource(url);
315 * @copydoc TextureCacheManager::GetEncodedImageBuffer
317 inline EncodedImageBuffer GetEncodedImageBuffer(const std::string& url)
319 return mTextureCacheManager.GetEncodedImageBuffer(url);
323 * @copydoc TextureCacheManager::AddExternalTexture
325 inline std::string AddExternalTexture(const TextureSet& texture)
327 return mTextureCacheManager.AddExternalTexture(texture);
331 * @copydoc TextureCacheManager::AddEncodedImageBuffer
333 inline std::string AddEncodedImageBuffer(const EncodedImageBuffer& encodedImageBuffer)
335 return mTextureCacheManager.AddEncodedImageBuffer(encodedImageBuffer);
338 public: // Load Request API
340 * @brief Requests an image load of the given URL.
342 * The parameters are used to specify how the image is loaded.
343 * The observer has the LoadComplete method called when the load is ready.
345 * When the client has finished with the Texture, Remove() should be called.
347 * @param[in] url The URL of the image to load
348 * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic
349 * @param[in] fittingMode The FittingMode to use
350 * @param[in] samplingMode The SamplingMode to use
351 * @param[in] useAtlasing Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still be loaded, and marked successful,
352 * but "useAtlasing" will be set to false in the "LoadCompleted" callback from the TextureManagerUploadObserver.
353 * @param[in] observer The client object should inherit from this and provide the "LoadCompleted" virtual.
354 * This is called when an image load completes (or fails).
355 * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data
356 * @param[in] reloadPolicy Forces a reload of the texture even if already cached
357 * @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
358 * @param[in] synchronousLoading True if the frame should be loaded synchronously. If you skip this parameter,
360 * @return A TextureId to use as a handle to reference this Texture
362 TextureId RequestLoad(
363 const VisualUrl& url,
364 const ImageDimensions& desiredSize,
365 const Dali::FittingMode::Type& fittingMode,
366 const Dali::SamplingMode::Type& samplingMode,
367 const TextureManager::UseAtlas& useAtlasing,
368 TextureUploadObserver* observer,
369 const bool& orientationCorrection,
370 const TextureManager::ReloadPolicy& reloadPolicy,
371 TextureManager::MultiplyOnLoad& preMultiplyOnLoad,
372 const bool& synchronousLoading = false);
375 * @brief Requests an image load of the given URL, when the texture has
376 * have loaded, it will perform a blend with the image mask, and upload
377 * the blended texture.
379 * The parameters are used to specify how the image is loaded.
380 * The observer has the LoadComplete method called when the load is ready.
382 * When the client has finished with the Texture, Remove() should be called.
384 * @param[in] url The URL of the image to load
385 * @param[in] maskTextureId The texture id of an image to mask this with
386 * (can be INVALID if no masking required)
387 * @param[in] contentScale The scale factor to apply to the image before masking
388 * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic
389 * @param[in] fittingMode The FittingMode to use
390 * @param[in] samplingMode The SamplingMode to use
391 * @param[in] useAtlasing Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still
392 * be loaded, and marked successful,
393 * but "useAtlasing" will be set to false in the "LoadCompleted" callback from
394 * the TextureManagerUploadObserver.
395 * @param[in] cropToMask Only used with masking, this will crop the scaled image to the mask size.
396 * If false, then the mask will be scaled to fit the image before being applied.
397 * @param[in] observer The client object should inherit from this and provide the "LoadCompleted"
399 * This is called when an image load completes (or fails).
400 * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data
401 * @param[in] reloadPolicy Forces a reload of the texture even if already cached
402 * @param[in,out] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if the
403 * image has no alpha channel
404 * @param[in] synchronousLoading True if the frame should be loaded synchronously. If you skip this parameter,
406 * @return A TextureId to use as a handle to reference this Texture
408 TextureId RequestLoad(
409 const VisualUrl& url,
410 const TextureManager::TextureId& maskTextureId,
411 const float& contentScale,
412 const ImageDimensions& desiredSize,
413 const Dali::FittingMode::Type& fittingMode,
414 const Dali::SamplingMode::Type& samplingMode,
415 const TextureManager::UseAtlas& useAtlasing,
416 const bool& cropToMask,
417 TextureUploadObserver* observer,
418 const bool& orientationCorrection,
419 const TextureManager::ReloadPolicy& reloadPolicy,
420 TextureManager::MultiplyOnLoad& preMultiplyOnLoad,
421 const bool& synchronousLoading = false);
424 * @brief Requests a masking image to be loaded. This mask is not uploaded to GL,
425 * instead, it is stored in CPU memory, and can be used for CPU blending.
426 * @param[in] maskUrl The URL of the mask image to load
427 * @param[in] storageType, Whether the pixel data is stored in the cache or uploaded to the GPU
428 * @param[in] synchronousLoading True if the frame should be loaded synchronously. If you skip this parameter,
430 * @return A TextureId to use as a handle to reference this mask Texture
432 TextureId RequestMaskLoad(
433 const VisualUrl& maskUrl,
434 StorageType storageType,
435 const bool& synchronousLoading = false);
439 * @brief Requests an image load of the given URL, when the texture has
440 * have loaded, if there is a valid maskTextureId, it will perform a
441 * CPU blend with the mask, and upload the blend texture.
443 * The parameters are used to specify how the image is loaded.
444 * The observer has the LoadComplete method called when the load is ready.
446 * When the client has finished with the Texture, Remove() should be called.
448 * @param[in] url The URL of the image to load
449 * @param[in] maskTextureId The texture id of an image to use as a mask. If no mask is required, then set
450 * to INVALID_TEXTURE_ID
451 * @param[in] contentScale The scaling factor to apply to the content when masking
452 * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic
453 * @param[in] fittingMode The FittingMode to use
454 * @param[in] samplingMode The SamplingMode to use
455 * @param[in] useAtlasing Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still be
456 * loaded, and marked successful, but "useAtlasing" will be set to false in the
457 * "LoadCompleted" callback from the TextureManagerUploadObserver.
458 * @param[in] cropToMask Whether to crop the target after masking, or scale the mask to the image before
460 * @param[in] storageType, Whether the pixel data is stored in the cache or uploaded to the GPU
461 * @param[in] observer The client object should inherit from this and provide the "LoadCompleted"
463 * This is called when an image load completes (or fails).
464 * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data
465 * @param[in] reloadPolicy Forces a reload of the texture even if already cached
466 * @param[in,out] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if
468 * @param[in] animatedImageLoading The AnimatedImageLoading to load animated image
469 * @param[in] frameIndex The frame index of a frame to be loaded frame
470 * @param[in] synchronousLoading True if the frame should be loaded synchronously. If you skip this parameter,
472 * @return A TextureId to use as a handle to reference this Texture
474 TextureId RequestLoadInternal(
475 const VisualUrl& url,
476 const TextureManager::TextureId& maskTextureId,
477 const float& contentScale,
478 const Dali::ImageDimensions& desiredSize,
479 const Dali::FittingMode::Type& fittingMode,
480 const Dali::SamplingMode::Type& samplingMode,
481 const TextureManager::UseAtlas& useAtlas,
482 const bool& cropToMask,
483 const TextureManager::StorageType& storageType,
484 TextureUploadObserver* observer,
485 const bool& orientationCorrection,
486 const TextureManager::ReloadPolicy& reloadPolicy,
487 TextureManager::MultiplyOnLoad& preMultiplyOnLoad,
488 Dali::AnimatedImageLoading animatedImageLoading,
489 const std::uint32_t& frameIndex,
490 const bool& synchronousLoading);
493 * @brief Load a new image synchronously.
494 * @param[in] url The URL of the image to load
495 * @param[in] desiredSize The size the image is likely to appear at.
496 * This can be set to 0,0 for automatic
497 * @param[in] fittingMode The FittingMode to use
498 * @param[in] samplingMode The SamplingMode to use
499 * @param[in] orientationCorrection Whether to use image metadata to rotate or flip the image,
500 * e.g., from portrait to landscape
501 * @param[in] loadYuvPlanes True if the image should be loaded as yuv planes
502 * @param[out] pixelBuffers The image pixelBuffer
503 * @return PixelBuffer of loaded image.
505 void LoadImageSynchronously(
506 const VisualUrl& url,
507 const Dali::ImageDimensions& desiredSize,
508 const Dali::FittingMode::Type& fittingMode,
509 const Dali::SamplingMode::Type& samplingMode,
510 const bool& orientationCorrection,
511 const bool& loadYuvPlanes,
512 std::vector<Devel::PixelBuffer>& pixelBuffers);
518 * Structure to hold info about a texture load queued during NotifyObservers
522 QueueElement(TextureManager::TextureId textureId, TextureUploadObserver* observer)
523 : mTextureId(textureId),
528 TextureManager::TextureId mTextureId; ///< The texture id of the requested load.
529 TextureUploadObserver* mObserver; ///< Observer of texture load.
533 * @brief Initiate a load or queue load if NotifyObservers is invoking callbacks
534 * @param[in] textureInfo The TextureInfo struct associated with the Texture
535 * @param[in] observer The observer wishing to observe the texture upload
537 void LoadOrQueueTexture(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer);
540 * @brief Queue a texture load to be subsequently handled by ProcessQueuedTextures.
541 * @param[in] textureInfo The TextureInfo struct associated with the Texture
542 * @param[in] observer The observer wishing to observe the texture upload
544 void QueueLoadTexture(const TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer);
547 * @brief Used internally to initiate a load.
548 * @param[in] textureInfo The TextureInfo struct associated with the Texture
549 * @param[in] observer The observer wishing to observe the texture upload
551 void LoadTexture(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer);
554 * @brief Initiate load of textures queued whilst NotifyObservers invoking callbacks.
556 void ProcessLoadQueue();
559 * @brief Initiate remove of texture queued whilst NotifyObservers invoking callbacks.
561 void ProcessRemoveQueue();
564 * Add the observer to the observer list
565 * @param[in] textureInfo The TextureInfo struct associated with the texture
566 * @param[in] observer The observer wishing to observe the texture upload
568 void ObserveTexture(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer);
571 * @brief Performs Post-Load steps including atlasing.
572 * @param[in] textureInfo The struct associated with this Texture
573 * @param[in] pixelBuffers The image pixelBuffer
574 * @return True if successful
576 void PostLoad(TextureManager::TextureInfo& textureInfo, std::vector<Devel::PixelBuffer>& pixelBuffers);
579 * Check if there is a texture waiting to be masked. If there
580 * is then apply this mask and upload it.
581 * @param[in] maskTextureInfo The texture info of the mask that has just loaded.
583 void CheckForWaitingTexture(TextureManager::TextureInfo& maskTextureInfo);
586 * Apply the mask to the pixelBuffer.
587 * @param[in] textureInfo The information of texture to apply the mask to
588 * @param[in] maskTextureId The texture id of the mask.
590 void ApplyMask(TextureManager::TextureInfo& textureInfo, const TextureManager::TextureId& maskTextureId);
593 * Upload the texture specified in pixelBuffer to the appropriate location
594 * @param[in] pixelBuffers The image data to upload
595 * @param[in] textureInfo The texture info containing the location to store the data to.
597 void UploadTextures(std::vector<Devel::PixelBuffer>& pixelBuffers, TextureManager::TextureInfo& textureInfo);
600 * Notify the current observers that the texture upload is complete,
601 * then remove the observers from the list.
602 * @param[in] textureInfo The struct associated with this Texture
603 * @param[in] success If the pixel data was retrieved successfully and uploaded to GPU
605 void NotifyObservers(TextureManager::TextureInfo& textureInfo, const bool& success);
608 * Call LoadComplete to the observer.
609 * @param[in] observer The client object should inherit from this and provide the "LoadCompleted"
610 * @param[in] textureInfo The struct associated with this Texture
611 * @param[in] success If the pixel data was retrieved successfully and uploaded to GPU
613 void EmitLoadComplete(TextureUploadObserver* observer, TextureManager::TextureInfo& textureInfo, const bool& success);
617 * @brief Remove observer in textureInfo
619 * @param textureInfo The struct associated with this Texture.
620 * @param observer The observer wishing to remove.
622 void RemoveTextureObserver(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer);
626 * @brief Common method to handle loading completion.
627 * TextureAsyncLoadingHelper will call this API After async loading finished.
628 * @param[in] textureId The ID of the texture load complete.
629 * @param[in] pixelBuffers The loaded image data
631 void AsyncLoadComplete(const TextureManager::TextureId& textureId, std::vector<Devel::PixelBuffer>& pixelBuffers);
635 * Deleted copy constructor.
637 TextureManager(const TextureManager&) = delete;
640 * Deleted assignment operator.
642 TextureManager& operator=(const TextureManager& rhs) = delete;
645 * This is called by the TextureManagerUploadObserver when an observer is destroyed.
646 * We use the callback to know when to remove an observer from our notify list.
647 * @param[in] observer The observer that generated the callback
649 void ObserverDestroyed(TextureUploadObserver* observer);
651 private: // Member Variables:
652 TextureCacheManager mTextureCacheManager; ///< Manager the life-cycle and caching of Textures
654 RoundRobinContainerView<TextureAsyncLoadingHelper> mAsyncLocalLoaders; ///< The Asynchronous image loaders used to provide all local async loads
655 RoundRobinContainerView<TextureAsyncLoadingHelper> mAsyncRemoteLoaders; ///< The Asynchronous image loaders used to provide all remote async loads
657 Dali::Vector<LifecycleObserver*> mLifecycleObservers; ///< Lifecycle observers of texture manager
658 Dali::Vector<QueueElement> mLoadQueue; ///< Queue of textures to load after NotifyObservers
659 Dali::Vector<QueueElement> mRemoveQueue; ///< Queue of textures to remove after NotifyObservers
660 TextureManager::TextureId mLoadingQueueTextureId; ///< TextureId when it is loading. it causes Load Textures to be queued.
661 bool mLoadYuvPlanes; ///< A global flag to specify if the image should be loaded as yuv planes
664 } // namespace Internal
666 } // namespace Toolkit
670 #endif // DALI_TOOLKIT_TEXTURE_MANAGER_IMPL_H