};
using MaskingDataPointer = std::unique_ptr<MaskingData>;
+
+ /**
+ * 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.
*/
/**
* Destructor.
*/
- ~TextureManager() = default;
-
+ ~TextureManager();
// TextureManager Main API:
* @param[in] maskInfo Mask info structure
* @param[in] synchronousLoading true if the URL should be loaded synchronously
* @param[out] textureId, The textureId of the URL
- * @param[out] textureRect The rectangle within the texture atlas that this URL occupies
+ * @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
* be loaded, and marked successful, but this will be set to false.
* If atlasing succeeds, this will be set to true.
bool synchronousLoading,
TextureManager::TextureId& textureId,
Vector4& textureRect,
+ Dali::ImageDimensions& textureRectSize,
bool& atlasingStatus,
bool& loadingStatus,
Dali::WrapMode::Type wrapModeU,
void Remove( const TextureManager::TextureId textureId );
/**
- * Get the visualUrl associated with the texture id
+ * @brief Get the visualUrl associated with the texture id.
+ * @param[in] textureId The texture Id to get
+ * @return The visual Url associated with the texture id.
*/
- const VisualUrl& GetVisualUrl( TextureId textureId );
+ VisualUrl GetVisualUrl( TextureId textureId );
/**
* @brief Get the current state of a texture
*/
TextureSet RemoveExternalTexture( const std::string& url );
+ /**
+ * Add an observer to the object.
+ * @param[in] observer The observer to add.
+ */
+ void AddObserver( TextureManager::LifecycleObserver& observer );
+
+ /**
+ * Remove an observer from the object
+ * @pre The observer has already been added.
+ * @param[in] observer The observer to remove.
+ */
+ void RemoveObserver( TextureManager::LifecycleObserver& observer );
+
+ /**
+ * @brief Set an image to be used when a visual has failed to correctly render
+ * @param[in] brokenImageUrl The broken image url.
+ */
+ void SetBrokenImageUrl(const std::string& brokenImageUrl);
+
private:
/**
RoundRobinContainerView< AsyncLoadingHelper > mAsyncLocalLoaders; ///< The Asynchronous image loaders used to provide all local async loads
RoundRobinContainerView< AsyncLoadingHelper > mAsyncRemoteLoaders; ///< The Asynchronous image loaders used to provide all remote async loads
std::vector< ExternalTextureInfo > mExternalTextures; ///< Externally provided textures
+ Dali::Vector<LifecycleObserver*> mLifecycleObservers; ///< Lifecycle observers of texture manager
+ std::string mBrokenImageUrl; ///< Broken image url
TextureId mCurrentTextureId; ///< The current value used for the unique Texture Id generation
};