X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftexture-manager%2Ftexture-manager-impl.h;h=fdae67aee57501798ee8bba88e49a51a33cd25e2;hp=01f62ee16bcc52d00c9c64fdf1d0c4c0650862fc;hb=HEAD;hpb=c202bbacd19fb0e552f15f1a4106f207927845c3 diff --git a/dali-toolkit/internal/texture-manager/texture-manager-impl.h b/dali-toolkit/internal/texture-manager/texture-manager-impl.h index 01f62ee..f460893 100644 --- a/dali-toolkit/internal/texture-manager/texture-manager-impl.h +++ b/dali-toolkit/internal/texture-manager/texture-manager-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_TEXTURE_MANAGER_IMPL_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. @@ -20,13 +20,14 @@ // EXTERNAL INCLUDES #include #include +#include #include +#include #include #include // INTERNAL INCLUDES #include -#include #include #include #include @@ -45,13 +46,13 @@ class TextureAsyncLoadingHelper; /** * The TextureManager provides a common Image loading API for Visuals. * - * The TextureManager is responsible for providing sync, async, atlased and non-atlased + * The TextureManager is responsible for providing sync, async, * CPU time alpha masking, animated image loads. * * Texture caching is provided and performed by TextureCacheManager. * TextureUploadObserver.LoadComplete called when async load completed. */ -class TextureManager : public ConnectionTracker +class TextureManager : public ConnectionTracker, public Integration::Processor { public: // Copy enum and types and const values that TextureManager will use. @@ -62,9 +63,7 @@ public: static constexpr TextureId INVALID_TEXTURE_ID = TextureManagerType::INVALID_TEXTURE_ID; static constexpr TextureCacheIndex INVALID_CACHE_INDEX = TextureManagerType::INVALID_CACHE_INDEX; - using UseAtlas = TextureManagerType::UseAtlas; using StorageType = TextureManagerType::StorageType; - using LoadType = TextureManagerType::LoadType; using LoadState = TextureManagerType::LoadState; using ReloadPolicy = TextureManagerType::ReloadPolicy; using MultiplyOnLoad = TextureManagerType::MultiplyOnLoad; @@ -80,24 +79,17 @@ public: TextureManager::TextureId mAlphaMaskId; float mContentScaleFactor; bool mCropToMask; + bool mPreappliedMasking; + bool mMaskImageLoadingFailed; }; using MaskingDataPointer = std::unique_ptr; /** - * Class to provide lifecycle event on destruction of texture manager. - */ - struct LifecycleObserver - { - /** - * Called shortly before the texture manager is destroyed. - */ - virtual void TextureManagerDestroyed() = 0; - }; - - /** * Constructor. + * + * @param[in] loadYuvPlanes Whether we allow to load YuvPlanes or not. Default is false. */ - TextureManager(); + TextureManager(bool loadYuvPlanes = false); /** * Destructor. @@ -112,28 +104,33 @@ public: * The parameters are used to specify how the animated image is loaded. * The observer has the LoadComplete method called when the load is ready. * + * @param[in] url The URL of the image to load * @param[in] animatedImageLoading The AnimatedImageLoading that contain the animated image information * @param[in] frameIndex The frame index to load. * @param[out] textureId The textureId of the frame + * @param[in, out] maskInfo Mask info structure + * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0, 0 for automatic + * @param[in] fittingMode The FittingMode to use * @param[in] samplingMode The SamplingMode to use - * @param[in] wrapModeU Horizontal Wrap mode - * @param[in] wrapModeV Vertical Wrap mode * @param[in] synchronousLoading true if the frame should be loaded synchronously - * @param[in] useCache true if this frame loading uses cache. * @param[in] textureObserver The client object should inherit from this and provide the "LoadCompleted" virtual. * This is called when an image load completes (or fails). + * @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 containing the frame of animated image, or empty if still loading. */ - TextureSet LoadAnimatedImageTexture(Dali::AnimatedImageLoading animatedImageLoading, - const uint32_t& frameIndex, + TextureSet LoadAnimatedImageTexture(const VisualUrl& url, + Dali::AnimatedImageLoading animatedImageLoading, + const uint32_t frameIndex, TextureManager::TextureId& textureId, - const Dali::SamplingMode::Type& samplingMode, - const Dali::WrapMode::Type& wrapModeU, - const Dali::WrapMode::Type& wrapModeV, - const bool& synchronousLoading, - const bool& useCache, - TextureUploadObserver* textureObserver); + MaskingDataPointer& maskInfo, + const Dali::ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool synchronousLoading, + TextureUploadObserver* textureObserver, + TextureManager::MultiplyOnLoad& preMultiplyOnLoad); /** * @brief Requests an image load of the given URL to get PixelBuffer. @@ -157,11 +154,11 @@ public: Devel::PixelBuffer LoadPixelBuffer( const VisualUrl& url, const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const bool& synchronousLoading, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool synchronousLoading, TextureUploadObserver* textureObserver, - const bool& orientationCorrection, + const bool orientationCorrection, TextureManager::MultiplyOnLoad& preMultiplyOnLoad); /** @@ -178,17 +175,16 @@ public: * @param[in] samplingMode The SamplingMode to use * @param[in, out] maskInfo Mask info structure * @param[in] synchronousLoading true if the URL should be loaded synchronously - * @param[out] textureId, The textureId of the URL + * @param[in, out] textureId The textureId of the URL. It is also be used to check the previous textureId + * what requestor had. It will be used only ReloadPolicy::FORCED for now. * @param[out] textureRect The rectangle within the texture atlas that this URL occupies, * this is the rectangle in normalized coordinates. * @param[out] textureRectSize The rectangle within the texture atlas that this URL occupies, * this is the same rectangle in pixels. - * @param[in,out] atlasingStatus Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still + * @param[in,out] atlasingStatus Set to true to attempt atlasing. If atlasing fails, the image will still * be loaded, and marked successful, but this will be set to false. * If atlasing succeeds, this will be set to true. * @param[out] loadingStatus The loading status of the texture - * @param[in] wrapModeU Horizontal Wrap mode - * @param[in] wrapModeV Vertical Wrap mode * @param[in] textureObserver The client object should inherit from this and provide the "LoadCompleted" virtual. * This is called when an image load completes (or fails). * @param[in] atlasObserver This is used if the texture is atlased, and will be called instead of @@ -202,58 +198,46 @@ public: * @return The texture set containing the image, or empty if still loading. */ TextureSet LoadTexture( - const VisualUrl& url, - const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - MaskingDataPointer& maskInfo, - const bool& synchronousLoading, - TextureManager::TextureId& textureId, - Dali::Vector4& textureRect, - Dali::ImageDimensions& textureRectSize, - bool& atlasingStatus, - bool& loadingStatus, - const Dali::WrapMode::Type& wrapModeU, - const Dali::WrapMode::Type& wrapModeV, - TextureUploadObserver* textureObserver, - AtlasUploadObserver* atlasObserver, - ImageAtlasManagerPtr imageAtlasManager, - const bool& orientationCorrection, - const TextureManager::ReloadPolicy& reloadPolicy, - TextureManager::MultiplyOnLoad& preMultiplyOnLoad); + const VisualUrl& url, + const Dali::ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + MaskingDataPointer& maskInfo, + const bool synchronousLoading, + TextureManager::TextureId& textureId, + Dali::Vector4& textureRect, + Dali::ImageDimensions& textureRectSize, + bool& atlasingStatus, + bool& loadingStatus, + TextureUploadObserver* textureObserver, + AtlasUploadObserver* atlasObserver, + ImageAtlasManagerPtr imageAtlasManager, + const bool orientationCorrection, + const TextureManager::ReloadPolicy reloadPolicy, + TextureManager::MultiplyOnLoad& preMultiplyOnLoad); /** - * @brief Remove a Texture from the TextureManager. - * - * Textures are cached and therefore only the removal of the last - * occurrence of a Texture will cause its removal internally. - * - * @param[in] textureId The ID of the Texture to remove. - * @param[in] textureObserver The texture observer. - */ - void Remove(const TextureManager::TextureId& textureId, TextureUploadObserver* textureObserver); - - /** - * Add an observer to the object. - * @param[in] observer The observer to add. + * @brief Returns the geometry associated with texture. + * @param[in] textureId Id of the texture + * @param[out] frontElements number of front elements + * @param[out] backElements number of back elements + * @return Returns valid geometry object */ - void AddObserver(TextureManager::LifecycleObserver& observer); + Geometry GetRenderGeometry(const TextureManager::TextureId textureId, uint32_t& frontElements, uint32_t& backElements); /** - * Remove an observer from the object - * @pre The observer has already been added. - * @param[in] observer The observer to remove. + * @brief Returns the textureSet in texture manager. + * @param[in] textureId Id of the texture + * @return The textureSet in texture manager. These textures include YUV textures or images and masks. */ - void RemoveObserver(TextureManager::LifecycleObserver& observer); + TextureSet GetTextureSet(const TextureManager::TextureId textureId); /** - * @brief Returns the geometry associated with texture. - * @param[in] textureId Id of the texture - * @param[out] frontElements number of front elements - * @param[out] backElements number of back elements - * @return Returns valid geometry object + * @brief Returns the textureSet in texture manager. + * @param[in] textureInfo the information of the texture + * @return The textureSet in texture manager. These textures include YUV textures or images and masks. */ - Geometry GetRenderGeometry(const TextureManager::TextureId& textureId, std::uint32_t& frontElements, std::uint32_t& backElements); + TextureSet GetTextureSet(const TextureManager::TextureInfo& textureInfo); public: // API list that need to access TextureCacheManager. @@ -261,17 +245,17 @@ public: /** * @copydoc TextureCacheManager::GetVisualUrl */ - inline VisualUrl GetVisualUrl(const TextureManager::TextureId& textureId) + inline VisualUrl GetVisualUrl(const TextureManager::TextureId textureId) { return mTextureCacheManager.GetVisualUrl(textureId); } /** - * @copydoc TextureCacheManager::GetTextureSet + * @copydoc TextureCacheManager::GetTexture */ - inline TextureSet GetTextureSet(const TextureManager::TextureId& textureId) + inline Texture GetTexture(const TextureManager::TextureId textureId) { - return mTextureCacheManager.GetTextureSet(textureId); + return mTextureCacheManager.GetTexture(textureId); } /** @@ -283,11 +267,11 @@ public: } /** - * @copydoc TextureCacheManager::RemoveExternalEncodedImageBuffer + * @copydoc TextureCacheManager::RemoveEncodedImageBuffer */ - inline EncodedImageBuffer RemoveExternalEncodedImageBuffer(const std::string& url) + inline EncodedImageBuffer RemoveEncodedImageBuffer(const std::string& url) { - return mTextureCacheManager.RemoveExternalEncodedImageBuffer(url); + return mTextureCacheManager.RemoveEncodedImageBuffer(url); } /** @@ -309,17 +293,17 @@ public: /** * @copydoc TextureCacheManager::AddExternalTexture */ - inline std::string AddExternalTexture(const TextureSet& texture) + inline std::string AddExternalTexture(const TextureSet& texture, const bool preMultiplied = false) { - return mTextureCacheManager.AddExternalTexture(texture); + return mTextureCacheManager.AddExternalTexture(texture, preMultiplied); } /** - * @copydoc TextureCacheManager::AddExternalEncodedImageBuffer + * @copydoc TextureCacheManager::AddEncodedImageBuffer */ - inline std::string AddExternalEncodedImageBuffer(const EncodedImageBuffer& encodedImageBuffer) + inline std::string AddEncodedImageBuffer(const EncodedImageBuffer& encodedImageBuffer) { - return mTextureCacheManager.AddExternalEncodedImageBuffer(encodedImageBuffer); + return mTextureCacheManager.AddEncodedImageBuffer(encodedImageBuffer); } public: // Load Request API @@ -335,8 +319,6 @@ public: // Load Request API * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic * @param[in] fittingMode The FittingMode to use * @param[in] samplingMode The SamplingMode to use - * @param[in] useAtlasing Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still be loaded, and marked successful, - * but "useAtlasing" will be set to false in the "LoadCompleted" callback from the TextureManagerUploadObserver. * @param[in] observer The client object should inherit from this and provide the "LoadCompleted" virtual. * This is called when an image load completes (or fails). * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data @@ -347,17 +329,17 @@ public: // Load Request API * @return A TextureId to use as a handle to reference this Texture */ TextureId RequestLoad( - const VisualUrl& url, - const ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const TextureManager::UseAtlas& useAtlasing, - TextureUploadObserver* observer, - const bool& orientationCorrection, - const TextureManager::ReloadPolicy& reloadPolicy, - TextureManager::MultiplyOnLoad& preMultiplyOnLoad, - const bool& synchronousLoading = false); - + const VisualUrl& url, + const ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + TextureUploadObserver* observer, + const bool orientationCorrection, + const TextureManager::ReloadPolicy reloadPolicy, + TextureManager::MultiplyOnLoad& preMultiplyOnLoad, + const bool synchronousLoading = false); + +private: // Internal Load Request API /** * @brief Requests an image load of the given URL, when the texture has * have loaded, it will perform a blend with the image mask, and upload @@ -371,14 +353,11 @@ public: // Load Request API * @param[in] url The URL of the image to load * @param[in] maskTextureId The texture id of an image to mask this with * (can be INVALID if no masking required) + * @param[in] previousTextureId The texture id of an image which the requestor already has before * @param[in] contentScale The scale factor to apply to the image before masking * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic * @param[in] fittingMode The FittingMode to use * @param[in] samplingMode The SamplingMode to use - * @param[in] useAtlasing Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still - * be loaded, and marked successful, - * but "useAtlasing" will be set to false in the "LoadCompleted" callback from - * the TextureManagerUploadObserver. * @param[in] cropToMask Only used with masking, this will crop the scaled image to the mask size. * If false, then the mask will be scaled to fit the image before being applied. * @param[in] observer The client object should inherit from this and provide the "LoadCompleted" @@ -393,33 +372,34 @@ public: // Load Request API * @return A TextureId to use as a handle to reference this Texture */ TextureId RequestLoad( - const VisualUrl& url, - const TextureManager::TextureId& maskTextureId, - const float& contentScale, - const ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const TextureManager::UseAtlas& useAtlasing, - const bool& cropToMask, - TextureUploadObserver* observer, - const bool& orientationCorrection, - const TextureManager::ReloadPolicy& reloadPolicy, - TextureManager::MultiplyOnLoad& preMultiplyOnLoad, - const bool& synchronousLoading = false); + const VisualUrl& url, + const TextureManager::TextureId maskTextureId, + const TextureManager::TextureId previousTextureId, + const float contentScale, + const ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool cropToMask, + TextureUploadObserver* observer, + const bool orientationCorrection, + const TextureManager::ReloadPolicy reloadPolicy, + TextureManager::MultiplyOnLoad& preMultiplyOnLoad, + const bool synchronousLoading = false); /** * @brief Requests a masking image to be loaded. This mask is not uploaded to GL, * instead, it is stored in CPU memory, and can be used for CPU blending. * @param[in] maskUrl The URL of the mask image to load + * @param[in] storageType Whether the pixel data is stored in the cache or uploaded to the GPU * @param[in] synchronousLoading True if the frame should be loaded synchronously. If you skip this parameter, * default is false. * @return A TextureId to use as a handle to reference this mask Texture */ TextureId RequestMaskLoad( - const VisualUrl& maskUrl, - const bool& synchronousLoading = false); + const VisualUrl& maskUrl, + const TextureManager::StorageType storageType, + const bool synchronousLoading = false); -private: /** * @brief Requests an image load of the given URL, when the texture has * have loaded, if there is a valid maskTextureId, it will perform a @@ -433,16 +413,15 @@ private: * @param[in] url The URL of the image to load * @param[in] maskTextureId The texture id of an image to use as a mask. If no mask is required, then set * to INVALID_TEXTURE_ID + * @param[in] previousTextureId The texture id of an image which the requestor already has before. It will be used + * when reloadPolicy is FORCED. * @param[in] contentScale The scaling factor to apply to the content when masking * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic * @param[in] fittingMode The FittingMode to use * @param[in] samplingMode The SamplingMode to use - * @param[in] useAtlasing Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still be - * loaded, and marked successful, but "useAtlasing" will be set to false in the - * "LoadCompleted" callback from the TextureManagerUploadObserver. * @param[in] cropToMask Whether to crop the target after masking, or scale the mask to the image before * masking. - * @param[in] storageType, Whether the pixel data is stored in the cache or uploaded to the GPU + * @param[in] storageType Whether the pixel data is stored in the cache or uploaded to the GPU * @param[in] observer The client object should inherit from this and provide the "LoadCompleted" * virtual. * This is called when an image load completes (or fails). @@ -454,27 +433,25 @@ private: * @param[in] frameIndex The frame index of a frame to be loaded frame * @param[in] synchronousLoading True if the frame should be loaded synchronously. If you skip this parameter, * default is false. - * @param[in] useCache True if the texture will be cached. * @return A TextureId to use as a handle to reference this Texture */ TextureId RequestLoadInternal( - const VisualUrl& url, - const TextureManager::TextureId& maskTextureId, - const float& contentScale, - const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const TextureManager::UseAtlas& useAtlas, - const bool& cropToMask, - const TextureManager::StorageType& storageType, - TextureUploadObserver* observer, - const bool& orientationCorrection, - const TextureManager::ReloadPolicy& reloadPolicy, - TextureManager::MultiplyOnLoad& preMultiplyOnLoad, - Dali::AnimatedImageLoading animatedImageLoading, - const std::uint32_t& frameIndex, - const bool& synchronousLoading, - const bool& useCache); + const VisualUrl& url, + const TextureManager::TextureId maskTextureId, + const TextureManager::TextureId previousTextureId, + const float contentScale, + const Dali::ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool cropToMask, + const TextureManager::StorageType storageType, + TextureUploadObserver* observer, + const bool orientationCorrection, + const TextureManager::ReloadPolicy reloadPolicy, + TextureManager::MultiplyOnLoad& preMultiplyOnLoad, + Dali::AnimatedImageLoading animatedImageLoading, + const uint32_t frameIndex, + const bool synchronousLoading); /** * @brief Load a new image synchronously. @@ -485,14 +462,46 @@ private: * @param[in] samplingMode The SamplingMode to use * @param[in] orientationCorrection Whether to use image metadata to rotate or flip the image, * e.g., from portrait to landscape + * @param[in] loadYuvPlanes True if the image should be loaded as yuv planes + * @param[out] pixelBuffers The image pixelBuffer * @return PixelBuffer of loaded image. */ - Devel::PixelBuffer LoadImageSynchronously( - const VisualUrl& url, - const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const bool& orientationCorrection); + void LoadImageSynchronously( + const VisualUrl& url, + const Dali::ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool orientationCorrection, + const bool loadYuvPlanes, + std::vector& pixelBuffers); + +public: // Remove Request API + /** + * @brief Request Remove a Texture from the TextureManager. + * + * Textures are cached and therefore only the removal of the last + * occurrence of a Texture will cause its removal internally. + * + * @param[in] textureId The ID of the Texture to remove. + * @param[in] textureObserver The texture observer. + */ + void RequestRemove(const TextureManager::TextureId textureId, TextureUploadObserver* textureObserver); + +private: + /** + * @brief Remove a Texture from the TextureManager. + * + * Textures are cached and therefore only the removal of the last + * occurrence of a Texture will cause its removal internally. + * + * @param[in] textureId The ID of the Texture to remove. + */ + void Remove(const TextureManager::TextureId textureId); + + /** + * @brief Initiate remove of texture queued. + */ + void ProcessRemoveQueue(); private: // Load and queue @@ -500,9 +509,9 @@ private: /** * Structure to hold info about a texture load queued during NotifyObservers */ - struct LoadQueueElement + struct QueueElement { - LoadQueueElement(TextureManager::TextureId textureId, TextureUploadObserver* observer) + QueueElement(const TextureManager::TextureId textureId, TextureUploadObserver* observer) : mTextureId(textureId), mObserver(observer) { @@ -520,7 +529,7 @@ private: void LoadOrQueueTexture(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer); /** - * @brief Queue a texture load to be subsequently handled by ProcessQueuedTextures. + * @brief Queue a texture load to be subsequently handled by ProcessLoadQueue. * @param[in] textureInfo The TextureInfo struct associated with the Texture * @param[in] observer The observer wishing to observe the texture upload */ @@ -536,7 +545,7 @@ private: /** * @brief Initiate load of textures queued whilst NotifyObservers invoking callbacks. */ - void ProcessQueuedTextures(); + void ProcessLoadQueue(); /** * Add the observer to the observer list @@ -546,12 +555,12 @@ private: void ObserveTexture(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer); /** - * @brief Performs Post-Load steps including atlasing. - * @param[in] textureInfo The struct associated with this Texture - * @param[in] pixelBuffer The image pixelBuffer + * @brief Performs Post-Load steps. + * @param[in] textureInfo The struct associated with this Texture + * @param[in] pixelBuffers The image pixelBuffer * @return True if successful */ - void PostLoad(TextureManager::TextureInfo& textureInfo, Devel::PixelBuffer& pixelBuffer); + void PostLoad(TextureManager::TextureInfo& textureInfo, std::vector& pixelBuffers); /** * Check if there is a texture waiting to be masked. If there @@ -565,15 +574,14 @@ private: * @param[in] textureInfo The information of texture to apply the mask to * @param[in] maskTextureId The texture id of the mask. */ - void ApplyMask(TextureManager::TextureInfo& textureInfo, const TextureManager::TextureId& maskTextureId); + void ApplyMask(TextureManager::TextureInfo& textureInfo, const TextureManager::TextureId maskTextureId); /** * Upload the texture specified in pixelBuffer to the appropriate location - * @param[in] pixelBuffer The image data to upload - * @param[in] textureInfo The texture info containing the location to - * store the data to. + * @param[in] pixelBuffers The image data to upload + * @param[in] textureInfo The texture info containing the location to store the data to. */ - void UploadTexture(Devel::PixelBuffer& pixelBuffer, TextureManager::TextureInfo& textureInfo); + void UploadTextures(std::vector& pixelBuffers, TextureManager::TextureInfo& textureInfo); /** * Notify the current observers that the texture upload is complete, @@ -581,7 +589,7 @@ private: * @param[in] textureInfo The struct associated with this Texture * @param[in] success If the pixel data was retrieved successfully and uploaded to GPU */ - void NotifyObservers(TextureManager::TextureInfo& textureInfo, const bool& success); + void NotifyObservers(TextureManager::TextureInfo& textureInfo, const bool success); /** * Call LoadComplete to the observer. @@ -589,16 +597,38 @@ private: * @param[in] textureInfo The struct associated with this Texture * @param[in] success If the pixel data was retrieved successfully and uploaded to GPU */ - void EmitLoadComplete(TextureUploadObserver* observer, TextureManager::TextureInfo& textureInfo, const bool& success); + void EmitLoadComplete(TextureUploadObserver* observer, TextureManager::TextureInfo& textureInfo, const bool success); + + /** + * @brief Remove observer in textureInfo + * + * @param textureInfo The struct associated with this Texture. + * @param observer The observer wishing to remove. + */ + void RemoveTextureObserver(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer); public: /** * @brief Common method to handle loading completion. * TextureAsyncLoadingHelper will call this API After async loading finished. - * @param[in] textureId The ID of the texture load complete. - * @param[in] pixelBuffer The loaded image data + * @param[in] textureId The ID of the texture load complete. + * @param[in] pixelBuffers The loaded image data */ - void AsyncLoadComplete(const TextureManager::TextureId& textureId, Devel::PixelBuffer pixelBuffer); + void AsyncLoadComplete(const TextureManager::TextureId textureId, std::vector& pixelBuffers); + +protected: // Implementation of Processor + /** + * @copydoc Dali::Integration::Processor::Process() + */ + void Process(bool postProcessor) override; + + /** + * @copydoc Dali::Integration::Processor::GetProcessorName() + */ + std::string_view GetProcessorName() const override + { + return "TextureManager"; + } private: /** @@ -621,12 +651,15 @@ private: private: // Member Variables: TextureCacheManager mTextureCacheManager; ///< Manager the life-cycle and caching of Textures - RoundRobinContainerView mAsyncLocalLoaders; ///< The Asynchronous image loaders used to provide all local async loads - RoundRobinContainerView mAsyncRemoteLoaders; ///< The Asynchronous image loaders used to provide all remote async loads + std::unique_ptr mAsyncLoader; ///< The Asynchronous image loader used to provide all local async loads + + Dali::Vector mLoadQueue; ///< Queue of textures to load after NotifyObservers + TextureManager::TextureId mLoadingQueueTextureId; ///< TextureId when it is loading. it causes Load Textures to be queued. + + Dali::Vector mRemoveQueue; ///< Queue of textures to remove at PostProcess. It will be cleared after PostProcess. - Dali::Vector mLifecycleObservers; ///< Lifecycle observers of texture manager - Dali::Vector mLoadQueue; ///< Queue of textures to load after NotifyObservers - bool mQueueLoadFlag; ///< Flag that causes Load Textures to be queued. + const bool mLoadYuvPlanes; ///< A global flag to specify if the image should be loaded as yuv planes + bool mRemoveProcessorRegistered; ///< Flag if remove processor registered or not. }; } // namespace Internal