#include <dali/devel-api/rendering/geometry.h>
#include <dali/devel-api/rendering/shader.h>
#include <dali/devel-api/rendering/renderer.h>
+#include <dali/devel-api/common/owner-container.h>
+#include <dali/devel-api/object/weak-handle.h>
+
namespace Dali
{
{
COLOR_SHADER,
BORDER_SHADER,
+ BORDER_SHADER_ANTI_ALIASING,
GRADIENT_SHADER_LINEAR_USER_SPACE,
GRADIENT_SHADER_LINEAR_BOUNDING_BOX,
GRADIENT_SHADER_RADIAL_USER_SPACE,
static Geometry CreateQuadGeometry();
public:
- struct CachedRenderer : RefObject
- {
- std::string mKey;
- Renderer mRenderer;
-
- CachedRenderer( const std::string& key, const Renderer& renderer )
- : mKey( key ),
- mRenderer( renderer )
- {}
- };
-
- typedef IntrusivePtr< CachedRenderer > CachedRendererPtr;
/**
* @brief Request renderer from the url
*
- * @return The cached renderer if exist in the cache. Otherwise null is returned.
+ * @return The cached renderer if exist in the cache. Otherwise an empty handle is returned.
*/
- CachedRendererPtr GetRenderer( const std::string& key ) const;
+ Renderer GetRenderer( const std::string& key ) const;
/**
* @brief Cache the renderer based on the given key.
*
* @param[in] key The key to use for caching
* @param[in] renderer The Renderer to be cached
- *
- * @return The cached renderer stored in the cache
*/
- CachedRendererPtr SaveRenderer( const std::string& key, Renderer& renderer );
+ void SaveRenderer( const std::string& key, Renderer& renderer );
/**
- * @brief Removes the renderer from the cache based on the given key
+ * @brief Cleans the renderer cache by removing the renderer from the cache based on the given key if there are no longer any references to it
*
* @param[in] key The key used for caching
+ *
+ * @return True if the renderer is no longer used anywhere, false otherwise
+ */
+ bool CleanRendererCache( const std::string& key );
+
+ /**
+ * @brief Cache the debug renderer
+ */
+ void CacheDebugRenderer( Renderer& renderer );
+
+ /**
+ * @brief Request the debug renderer;
*/
- void RemoveRenderer( const std::string& key );
+ Renderer GetDebugRenderer();
protected:
RendererFactoryCache& operator=(const RendererFactoryCache& rhs);
private:
+ struct CachedRenderer
+ {
+ std::string mKey;
+ WeakHandle< Renderer > mRenderer;
+
+ CachedRenderer( const std::string& key, Renderer& renderer )
+ : mKey( key ),
+ mRenderer( renderer)
+ {}
+ };
+
typedef Dali::Vector< std::size_t > HashVector;
- typedef std::vector< CachedRendererPtr > CachedRenderers;
+ typedef Dali::OwnerContainer< const CachedRenderer* > CachedRenderers;
/**
* @brief Finds the first index into the cached renderers from the url
HashVector mRendererHashes;
CachedRenderers mRenderers;
+
+ Renderer mDebugRenderer;
};
} // namespace Internal