X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-factory-cache.h;h=17d22467fc4c369d18b1bef55fe5764dfceaf8e8;hp=46920c563fab29fb986e80f06d6a70cbd3f11e3c;hb=5c827a7125b3c0420ba39766cbbcb0ee3eb8fccf;hpb=1972f043026a3e1bdcaad71c17859a8f324d1e6d diff --git a/dali-toolkit/internal/visuals/visual-factory-cache.h b/dali-toolkit/internal/visuals/visual-factory-cache.h index 46920c5..17d2246 100644 --- a/dali-toolkit/internal/visuals/visual-factory-cache.h +++ b/dali-toolkit/internal/visuals/visual-factory-cache.h @@ -17,18 +17,18 @@ * limitations under the License. */ -// INTERNAL INCLUDES -#include "svg/svg-rasterize-thread.h" - // EXTERNAL INCLUDES #include #include #include -#include #include #include #include +// INTERNAL INCLUDES +#include +#include +#include namespace Dali { @@ -38,6 +38,12 @@ namespace Toolkit namespace Internal { +class ImageAtlasManager; +class NPatchLoader; +class TextureManager; + +typedef IntrusivePtr ImageAtlasManagerPtr; + /** * Caches shaders and geometries. Owned by VisualFactory. @@ -59,9 +65,14 @@ public: GRADIENT_SHADER_RADIAL_USER_SPACE, GRADIENT_SHADER_RADIAL_BOUNDING_BOX, IMAGE_SHADER, + IMAGE_SHADER_ATLAS_DEFAULT_WRAP, + IMAGE_SHADER_ATLAS_CUSTOM_WRAP, NINE_PATCH_SHADER, SVG_SHADER, - SHADER_TYPE_MAX = SVG_SHADER + TEXT_SHADER_RGBA, + TEXT_SHADER_L8, + WIREFRAME_SHADER, + SHADER_TYPE_MAX = WIREFRAME_SHADER }; /** @@ -73,7 +84,8 @@ public: BORDER_GEOMETRY, NINE_PATCH_GEOMETRY, NINE_PATCH_BORDER_GEOMETRY, - GEOMETRY_TYPE_MAX = NINE_PATCH_BORDER_GEOMETRY + WIREFRAME_GEOMETRY, + GEOMETRY_TYPE_MAX = WIREFRAME_GEOMETRY }; public: @@ -122,48 +134,34 @@ public: */ static Geometry CreateGridGeometry( Uint16Pair gridSize ); -public: - /** - * @brief Request renderer from the url - * - * @return The cached renderer if exist in the cache. Otherwise an empty handle is returned. + * @brief Returns an image to be used when a visual has failed to correctly render + * @return The broken image handle. */ - Renderer GetRenderer( const std::string& key ) const; - - /** - * @brief Cache the renderer based on the given key. - * - * If the key already exists in the cache, then the cache will save an additional renderer to the cache. - * RemoveRenderer will then need to be called twice to remove both items from the cache. - * - * @param[in] key The key to use for caching - * @param[in] renderer The Renderer to be cached - */ - void SaveRenderer( const std::string& key, Renderer& renderer ); + static Image GetBrokenVisualImage(); +public: /** - * @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 + * Get the image atlas manager. + * @return A pointer to the atlas manager */ - bool CleanRendererCache( const std::string& key ); + ImageAtlasManagerPtr GetAtlasManager(); /** - * @brief Cache the debug renderer + * Get the texture manager + * @return A reference to the texture manager */ - void CacheDebugVisual( Renderer& renderer ); + TextureManager& GetTextureManager(); /** - * @brief Request the debug renderer; + * Get the N-Patch texture cache. + * @return A reference to the N patch loader */ - Renderer GetDebugVisual(); + NPatchLoader& GetNPatchLoader(); /** * Get the SVG rasterization thread. - * @return A pointer pointing to the SVG rasterization thread. + * @return A raw pointer pointing to the SVG rasterization thread. */ SvgRasterizeThread* GetSVGRasterizationThread(); @@ -192,36 +190,12 @@ protected: VisualFactoryCache& operator=(const VisualFactoryCache& 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 Dali::OwnerContainer< const CachedRenderer* > CachedRenderers; - - /** - * @brief Finds the first index into the cached visuals from the url - * - * @return Returns the first index into the cached renderer from the url if it exists in the cache, otherwise returns -1 - */ - int FindRenderer( const std::string& key ) const; - -private: Geometry mGeometry[GEOMETRY_TYPE_MAX+1]; Shader mShader[SHADER_TYPE_MAX+1]; - HashVector mRendererHashes; - CachedRenderers mRenderers; - - Renderer mDebugVisual; - + ImageAtlasManagerPtr mAtlasManager; + TextureManager mTextureManager; + NPatchLoader mNPatchLoader; SvgRasterizeThread* mSvgRasterizeThread; };