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/adaptor-framework/round-robin-container-view.h>
25 #include <dali/public-api/common/dali-vector.h>
26 #include <dali/public-api/rendering/geometry.h>
29 #include <dali-toolkit/devel-api/image-loader/image-atlas.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] desiredSize The size the image is likely to appear at. This can be set to 0, 0 for automatic
123 * @param[in] fittingMode The FittingMode to use
124 * @param[in] samplingMode The SamplingMode to use
125 * @param[in] synchronousLoading true if the frame should be loaded synchronously
126 * @param[in] textureObserver The client object should inherit from this and provide the "LoadCompleted" virtual.
127 * This is called when an image load completes (or fails).
128 * @param[in,out] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if the
129 * image has no alpha channel
131 * @return The texture set containing the frame of animated image, or empty if still loading.
133 TextureSet LoadAnimatedImageTexture(const VisualUrl& url,
134 Dali::AnimatedImageLoading animatedImageLoading,
135 const uint32_t& frameIndex,
136 TextureManager::TextureId& textureId,
137 MaskingDataPointer& maskInfo,
138 const Dali::ImageDimensions& desiredSize,
139 const Dali::FittingMode::Type& fittingMode,
140 const Dali::SamplingMode::Type& samplingMode,
141 const bool& synchronousLoading,
142 TextureUploadObserver* textureObserver,
143 TextureManager::MultiplyOnLoad& preMultiplyOnLoad);
146 * @brief Requests an image load of the given URL to get PixelBuffer.
148 * The parameters are used to specify how the image is loaded.
149 * The observer has the LoadComplete method called when the load is ready.
151 * @param[in] url The URL of the image to load
152 * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic
153 * @param[in] fittingMode The FittingMode to use
154 * @param[in] samplingMode The SamplingMode to use
155 * @param[in] synchronousLoading true if the URL should be loaded synchronously
156 * @param[in] textureObserver The client object should inherit from this and provide the "LoadCompleted" virtual.
157 * This is called when an image load completes (or fails).
158 * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data
159 * @param[in,out] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if the
160 * image has no alpha channel
162 * @return The pixel buffer containing the image, or empty if still loading.
164 Devel::PixelBuffer LoadPixelBuffer(
165 const VisualUrl& url,
166 const Dali::ImageDimensions& desiredSize,
167 const Dali::FittingMode::Type& fittingMode,
168 const Dali::SamplingMode::Type& samplingMode,
169 const bool& synchronousLoading,
170 TextureUploadObserver* textureObserver,
171 const bool& orientationCorrection,
172 TextureManager::MultiplyOnLoad& preMultiplyOnLoad);
175 * @brief Requests an image load of the given URL.
177 * The parameters are used to specify how the image is loaded.
178 * The observer has the LoadComplete method called when the load is ready.
180 * When the client has finished with the Texture, Remove() should be called.
182 * @param[in] url The URL of the image to load
183 * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic
184 * @param[in] fittingMode The FittingMode to use
185 * @param[in] samplingMode The SamplingMode to use
186 * @param[in, out] maskInfo Mask info structure
187 * @param[in] synchronousLoading true if the URL should be loaded synchronously
188 * @param[out] textureId, The textureId of the URL
189 * @param[out] textureRect The rectangle within the texture atlas that this URL occupies,
190 * this is the rectangle in normalized coordinates.
191 * @param[out] textureRectSize The rectangle within the texture atlas that this URL occupies,
192 * this is the same rectangle in pixels.
193 * @param[in,out] atlasingStatus Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still
194 * be loaded, and marked successful, but this will be set to false.
195 * If atlasing succeeds, this will be set to true.
196 * @param[out] loadingStatus The loading status of the texture
197 * @param[in] textureObserver The client object should inherit from this and provide the "LoadCompleted" virtual.
198 * This is called when an image load completes (or fails).
199 * @param[in] atlasObserver This is used if the texture is atlased, and will be called instead of
200 * textureObserver.LoadCompleted
201 * @param[in] imageAtlasManager The atlas manager to use for atlasing textures
202 * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data
203 * @param[in] reloadPolicy Forces a reload of the texture even if already cached
204 * @param[in,out] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if the
205 * image has no alpha channel
207 * @return The texture set containing the image, or empty if still loading.
209 TextureSet LoadTexture(
210 const VisualUrl& url,
211 const Dali::ImageDimensions& desiredSize,
212 const Dali::FittingMode::Type& fittingMode,
213 const Dali::SamplingMode::Type& samplingMode,
214 MaskingDataPointer& maskInfo,
215 const bool& synchronousLoading,
216 TextureManager::TextureId& textureId,
217 Dali::Vector4& textureRect,
218 Dali::ImageDimensions& textureRectSize,
219 bool& atlasingStatus,
221 TextureUploadObserver* textureObserver,
222 AtlasUploadObserver* atlasObserver,
223 ImageAtlasManagerPtr imageAtlasManager,
224 const bool& orientationCorrection,
225 const TextureManager::ReloadPolicy& reloadPolicy,
226 TextureManager::MultiplyOnLoad& preMultiplyOnLoad);
229 * @brief Remove a Texture from the TextureManager.
231 * Textures are cached and therefore only the removal of the last
232 * occurrence of a Texture will cause its removal internally.
234 * @param[in] textureId The ID of the Texture to remove.
235 * @param[in] textureObserver The texture observer.
237 void Remove(const TextureManager::TextureId& textureId, TextureUploadObserver* textureObserver);
240 * Add an observer to the object.
241 * @param[in] observer The observer to add.
243 void AddObserver(TextureManager::LifecycleObserver& observer);
246 * Remove an observer from the object
247 * @pre The observer has already been added.
248 * @param[in] observer The observer to remove.
250 void RemoveObserver(TextureManager::LifecycleObserver& observer);
253 * @brief Returns the geometry associated with texture.
254 * @param[in] textureId Id of the texture
255 * @param[out] frontElements number of front elements
256 * @param[out] backElements number of back elements
257 * @return Returns valid geometry object
259 Geometry GetRenderGeometry(const TextureManager::TextureId& textureId, std::uint32_t& frontElements, std::uint32_t& backElements);
262 * @brief Returns the textureSet in texture manager.
263 * @param[in] textureId Id of the texture
264 * @return The textureSet in texture manager. These textures include YUV textures or images and masks.
266 TextureSet GetTextureSet(const TextureManager::TextureId& textureId);
269 * @brief Returns the textureSet in texture manager.
270 * @param[in] textureInfo the information of the texture
271 * @return The textureSet in texture manager. These textures include YUV textures or images and masks.
273 TextureSet GetTextureSet(const TextureManager::TextureInfo& textureInfo);
276 // API list that need to access TextureCacheManager.
279 * @copydoc TextureCacheManager::GetVisualUrl
281 inline VisualUrl GetVisualUrl(const TextureManager::TextureId& textureId)
283 return mTextureCacheManager.GetVisualUrl(textureId);
287 * @copydoc TextureCacheManager::GetTexture
289 inline Texture GetTexture(const TextureManager::TextureId& textureId)
291 return mTextureCacheManager.GetTexture(textureId);
295 * @copydoc TextureCacheManager::RemoveExternalTexture
297 inline TextureSet RemoveExternalTexture(const std::string& url)
299 return mTextureCacheManager.RemoveExternalTexture(url);
303 * @copydoc TextureCacheManager::RemoveEncodedImageBuffer
305 inline EncodedImageBuffer RemoveEncodedImageBuffer(const std::string& url)
307 return mTextureCacheManager.RemoveEncodedImageBuffer(url);
311 * @copydoc TextureCacheManager::UseExternalResource
313 inline void UseExternalResource(const VisualUrl& url)
315 mTextureCacheManager.UseExternalResource(url);
319 * @copydoc TextureCacheManager::GetEncodedImageBuffer
321 inline EncodedImageBuffer GetEncodedImageBuffer(const std::string& url)
323 return mTextureCacheManager.GetEncodedImageBuffer(url);
327 * @copydoc TextureCacheManager::AddExternalTexture
329 inline std::string AddExternalTexture(const TextureSet& texture)
331 return mTextureCacheManager.AddExternalTexture(texture);
335 * @copydoc TextureCacheManager::AddEncodedImageBuffer
337 inline std::string AddEncodedImageBuffer(const EncodedImageBuffer& encodedImageBuffer)
339 return mTextureCacheManager.AddEncodedImageBuffer(encodedImageBuffer);
342 public: // Load Request API
344 * @brief Requests an image load of the given URL.
346 * The parameters are used to specify how the image is loaded.
347 * The observer has the LoadComplete method called when the load is ready.
349 * When the client has finished with the Texture, Remove() should be called.
351 * @param[in] url The URL of the image to load
352 * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic
353 * @param[in] fittingMode The FittingMode to use
354 * @param[in] samplingMode The SamplingMode to use
355 * @param[in] useAtlasing Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still be loaded, and marked successful,
356 * but "useAtlasing" will be set to false in the "LoadCompleted" callback from the TextureManagerUploadObserver.
357 * @param[in] observer The client object should inherit from this and provide the "LoadCompleted" virtual.
358 * This is called when an image load completes (or fails).
359 * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data
360 * @param[in] reloadPolicy Forces a reload of the texture even if already cached
361 * @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
362 * @param[in] synchronousLoading True if the frame should be loaded synchronously. If you skip this parameter,
364 * @return A TextureId to use as a handle to reference this Texture
366 TextureId RequestLoad(
367 const VisualUrl& url,
368 const ImageDimensions& desiredSize,
369 const Dali::FittingMode::Type& fittingMode,
370 const Dali::SamplingMode::Type& samplingMode,
371 const TextureManager::UseAtlas& useAtlasing,
372 TextureUploadObserver* observer,
373 const bool& orientationCorrection,
374 const TextureManager::ReloadPolicy& reloadPolicy,
375 TextureManager::MultiplyOnLoad& preMultiplyOnLoad,
376 const bool& synchronousLoading = false);
379 * @brief Requests an image load of the given URL, when the texture has
380 * have loaded, it will perform a blend with the image mask, and upload
381 * the blended texture.
383 * The parameters are used to specify how the image is loaded.
384 * The observer has the LoadComplete method called when the load is ready.
386 * When the client has finished with the Texture, Remove() should be called.
388 * @param[in] url The URL of the image to load
389 * @param[in] maskTextureId The texture id of an image to mask this with
390 * (can be INVALID if no masking required)
391 * @param[in] contentScale The scale factor to apply to the image before masking
392 * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic
393 * @param[in] fittingMode The FittingMode to use
394 * @param[in] samplingMode The SamplingMode to use
395 * @param[in] useAtlasing Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still
396 * be loaded, and marked successful,
397 * but "useAtlasing" will be set to false in the "LoadCompleted" callback from
398 * the TextureManagerUploadObserver.
399 * @param[in] cropToMask Only used with masking, this will crop the scaled image to the mask size.
400 * If false, then the mask will be scaled to fit the image before being applied.
401 * @param[in] observer The client object should inherit from this and provide the "LoadCompleted"
403 * This is called when an image load completes (or fails).
404 * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data
405 * @param[in] reloadPolicy Forces a reload of the texture even if already cached
406 * @param[in,out] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if the
407 * image has no alpha channel
408 * @param[in] synchronousLoading True if the frame should be loaded synchronously. If you skip this parameter,
410 * @return A TextureId to use as a handle to reference this Texture
412 TextureId RequestLoad(
413 const VisualUrl& url,
414 const TextureManager::TextureId& maskTextureId,
415 const float& contentScale,
416 const ImageDimensions& desiredSize,
417 const Dali::FittingMode::Type& fittingMode,
418 const Dali::SamplingMode::Type& samplingMode,
419 const TextureManager::UseAtlas& useAtlasing,
420 const bool& cropToMask,
421 TextureUploadObserver* observer,
422 const bool& orientationCorrection,
423 const TextureManager::ReloadPolicy& reloadPolicy,
424 TextureManager::MultiplyOnLoad& preMultiplyOnLoad,
425 const bool& synchronousLoading = false);
428 * @brief Requests a masking image to be loaded. This mask is not uploaded to GL,
429 * instead, it is stored in CPU memory, and can be used for CPU blending.
430 * @param[in] maskUrl The URL of the mask image to load
431 * @param[in] storageType, Whether the pixel data is stored in the cache or uploaded to the GPU
432 * @param[in] synchronousLoading True if the frame should be loaded synchronously. If you skip this parameter,
434 * @return A TextureId to use as a handle to reference this mask Texture
436 TextureId RequestMaskLoad(
437 const VisualUrl& maskUrl,
438 StorageType storageType,
439 const bool& synchronousLoading = false);
443 * @brief Requests an image load of the given URL, when the texture has
444 * have loaded, if there is a valid maskTextureId, it will perform a
445 * CPU blend with the mask, and upload the blend texture.
447 * The parameters are used to specify how the image is loaded.
448 * The observer has the LoadComplete method called when the load is ready.
450 * When the client has finished with the Texture, Remove() should be called.
452 * @param[in] url The URL of the image to load
453 * @param[in] maskTextureId The texture id of an image to use as a mask. If no mask is required, then set
454 * to INVALID_TEXTURE_ID
455 * @param[in] contentScale The scaling factor to apply to the content when masking
456 * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic
457 * @param[in] fittingMode The FittingMode to use
458 * @param[in] samplingMode The SamplingMode to use
459 * @param[in] useAtlasing Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still be
460 * loaded, and marked successful, but "useAtlasing" will be set to false in the
461 * "LoadCompleted" callback from the TextureManagerUploadObserver.
462 * @param[in] cropToMask Whether to crop the target after masking, or scale the mask to the image before
464 * @param[in] storageType, Whether the pixel data is stored in the cache or uploaded to the GPU
465 * @param[in] observer The client object should inherit from this and provide the "LoadCompleted"
467 * This is called when an image load completes (or fails).
468 * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data
469 * @param[in] reloadPolicy Forces a reload of the texture even if already cached
470 * @param[in,out] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if
472 * @param[in] animatedImageLoading The AnimatedImageLoading to load animated image
473 * @param[in] frameIndex The frame index of a frame to be loaded frame
474 * @param[in] synchronousLoading True if the frame should be loaded synchronously. If you skip this parameter,
476 * @return A TextureId to use as a handle to reference this Texture
478 TextureId RequestLoadInternal(
479 const VisualUrl& url,
480 const TextureManager::TextureId& maskTextureId,
481 const float& contentScale,
482 const Dali::ImageDimensions& desiredSize,
483 const Dali::FittingMode::Type& fittingMode,
484 const Dali::SamplingMode::Type& samplingMode,
485 const TextureManager::UseAtlas& useAtlas,
486 const bool& cropToMask,
487 const TextureManager::StorageType& storageType,
488 TextureUploadObserver* observer,
489 const bool& orientationCorrection,
490 const TextureManager::ReloadPolicy& reloadPolicy,
491 TextureManager::MultiplyOnLoad& preMultiplyOnLoad,
492 Dali::AnimatedImageLoading animatedImageLoading,
493 const std::uint32_t& frameIndex,
494 const bool& synchronousLoading);
497 * @brief Load a new image synchronously.
498 * @param[in] url The URL of the image to load
499 * @param[in] desiredSize The size the image is likely to appear at.
500 * This can be set to 0,0 for automatic
501 * @param[in] fittingMode The FittingMode to use
502 * @param[in] samplingMode The SamplingMode to use
503 * @param[in] orientationCorrection Whether to use image metadata to rotate or flip the image,
504 * e.g., from portrait to landscape
505 * @param[in] loadYuvPlanes True if the image should be loaded as yuv planes
506 * @param[out] pixelBuffers The image pixelBuffer
507 * @return PixelBuffer of loaded image.
509 void LoadImageSynchronously(
510 const VisualUrl& url,
511 const Dali::ImageDimensions& desiredSize,
512 const Dali::FittingMode::Type& fittingMode,
513 const Dali::SamplingMode::Type& samplingMode,
514 const bool& orientationCorrection,
515 const bool& loadYuvPlanes,
516 std::vector<Devel::PixelBuffer>& pixelBuffers);
522 * Structure to hold info about a texture load queued during NotifyObservers
526 QueueElement(TextureManager::TextureId textureId, TextureUploadObserver* observer)
527 : mTextureId(textureId),
532 TextureManager::TextureId mTextureId; ///< The texture id of the requested load.
533 TextureUploadObserver* mObserver; ///< Observer of texture load.
537 * @brief Initiate a load or queue load if NotifyObservers is invoking callbacks
538 * @param[in] textureInfo The TextureInfo struct associated with the Texture
539 * @param[in] observer The observer wishing to observe the texture upload
541 void LoadOrQueueTexture(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer);
544 * @brief Queue a texture load to be subsequently handled by ProcessQueuedTextures.
545 * @param[in] textureInfo The TextureInfo struct associated with the Texture
546 * @param[in] observer The observer wishing to observe the texture upload
548 void QueueLoadTexture(const TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer);
551 * @brief Used internally to initiate a load.
552 * @param[in] textureInfo The TextureInfo struct associated with the Texture
553 * @param[in] observer The observer wishing to observe the texture upload
555 void LoadTexture(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer);
558 * @brief Initiate load of textures queued whilst NotifyObservers invoking callbacks.
560 void ProcessLoadQueue();
563 * @brief Initiate remove of texture queued whilst NotifyObservers invoking callbacks.
565 void ProcessRemoveQueue();
568 * Add the observer to the observer list
569 * @param[in] textureInfo The TextureInfo struct associated with the texture
570 * @param[in] observer The observer wishing to observe the texture upload
572 void ObserveTexture(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer);
575 * @brief Performs Post-Load steps including atlasing.
576 * @param[in] textureInfo The struct associated with this Texture
577 * @param[in] pixelBuffers The image pixelBuffer
578 * @return True if successful
580 void PostLoad(TextureManager::TextureInfo& textureInfo, std::vector<Devel::PixelBuffer>& pixelBuffers);
583 * Check if there is a texture waiting to be masked. If there
584 * is then apply this mask and upload it.
585 * @param[in] maskTextureInfo The texture info of the mask that has just loaded.
587 void CheckForWaitingTexture(TextureManager::TextureInfo& maskTextureInfo);
590 * Apply the mask to the pixelBuffer.
591 * @param[in] textureInfo The information of texture to apply the mask to
592 * @param[in] maskTextureId The texture id of the mask.
594 void ApplyMask(TextureManager::TextureInfo& textureInfo, const TextureManager::TextureId& maskTextureId);
597 * Upload the texture specified in pixelBuffer to the appropriate location
598 * @param[in] pixelBuffers The image data to upload
599 * @param[in] textureInfo The texture info containing the location to store the data to.
601 void UploadTextures(std::vector<Devel::PixelBuffer>& pixelBuffers, TextureManager::TextureInfo& textureInfo);
604 * Notify the current observers that the texture upload is complete,
605 * then remove the observers from the list.
606 * @param[in] textureInfo The struct associated with this Texture
607 * @param[in] success If the pixel data was retrieved successfully and uploaded to GPU
609 void NotifyObservers(TextureManager::TextureInfo& textureInfo, const bool& success);
612 * Call LoadComplete to the observer.
613 * @param[in] observer The client object should inherit from this and provide the "LoadCompleted"
614 * @param[in] textureInfo The struct associated with this Texture
615 * @param[in] success If the pixel data was retrieved successfully and uploaded to GPU
617 void EmitLoadComplete(TextureUploadObserver* observer, TextureManager::TextureInfo& textureInfo, const bool& success);
620 * @brief Remove observer in textureInfo
622 * @param textureInfo The struct associated with this Texture.
623 * @param observer The observer wishing to remove.
625 void RemoveTextureObserver(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer);
629 * @brief Common method to handle loading completion.
630 * TextureAsyncLoadingHelper will call this API After async loading finished.
631 * @param[in] textureId The ID of the texture load complete.
632 * @param[in] pixelBuffers The loaded image data
634 void AsyncLoadComplete(const TextureManager::TextureId& textureId, std::vector<Devel::PixelBuffer>& pixelBuffers);
638 * Deleted copy constructor.
640 TextureManager(const TextureManager&) = delete;
643 * Deleted assignment operator.
645 TextureManager& operator=(const TextureManager& rhs) = delete;
648 * This is called by the TextureManagerUploadObserver when an observer is destroyed.
649 * We use the callback to know when to remove an observer from our notify list.
650 * @param[in] observer The observer that generated the callback
652 void ObserverDestroyed(TextureUploadObserver* observer);
654 private: // Member Variables:
655 TextureCacheManager mTextureCacheManager; ///< Manager the life-cycle and caching of Textures
656 std::unique_ptr<TextureAsyncLoadingHelper> mAsyncLoader; ///< The Asynchronous image loader used to provide all local 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