pref: remove global texture cache
This commit is contained in:
parent
03439bb431
commit
524ddd055a
|
|
@ -54,13 +54,13 @@ GifSprite::GifSprite(GifImagePtr gif)
|
|||
|
||||
bool GifSprite::Load(const String& file_path)
|
||||
{
|
||||
GifImagePtr image = TextureCache::GetInstance().PreloadGif(file_path);
|
||||
GifImagePtr image = new GifImage(file_path);
|
||||
return Load(image);
|
||||
}
|
||||
|
||||
bool GifSprite::Load(const Resource& res)
|
||||
{
|
||||
GifImagePtr image = TextureCache::GetInstance().PreloadGif(res);
|
||||
GifImagePtr image = new GifImage(res);
|
||||
return Load(image);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ SpriteFrame::SpriteFrame(TexturePtr texture, const Rect& crop_rect)
|
|||
|
||||
bool SpriteFrame::Load(const String& file_path)
|
||||
{
|
||||
TexturePtr texture = TextureCache::GetInstance().Preload(file_path);
|
||||
TexturePtr texture = new Texture(file_path);
|
||||
if (texture->IsValid())
|
||||
{
|
||||
SetTexture(texture);
|
||||
|
|
@ -72,7 +72,7 @@ bool SpriteFrame::Load(const String& file_path)
|
|||
|
||||
bool SpriteFrame::Load(const Resource& res)
|
||||
{
|
||||
TexturePtr texture = TextureCache::GetInstance().Preload(res);
|
||||
TexturePtr texture = new Texture(res);
|
||||
if (texture->IsValid())
|
||||
{
|
||||
SetTexture(texture);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/render/Renderer.h>
|
||||
#include <kiwano/render/TextureCache.h>
|
||||
#include <kiwano/event/WindowEvent.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
@ -49,7 +48,6 @@ void Renderer::ResetResolutionWhenWindowResized(bool enabled)
|
|||
|
||||
void Renderer::Destroy()
|
||||
{
|
||||
TextureCache::GetInstance().Clear();
|
||||
FontCache::GetInstance().Clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
#pragma once
|
||||
#include <kiwano/render/GifImage.h>
|
||||
#include <kiwano/render/Texture.h>
|
||||
#include <kiwano/core/Singleton.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -34,10 +33,8 @@ namespace kiwano
|
|||
* \~chinese
|
||||
* @brief 纹理缓存
|
||||
*/
|
||||
class KGE_API TextureCache final : public Singleton<TextureCache>
|
||||
class KGE_API TextureCache final
|
||||
{
|
||||
friend Singleton<TextureCache>;
|
||||
|
||||
public:
|
||||
/// \~chinese
|
||||
/// @brief 预加载本地图片
|
||||
|
|
|
|||
Loading…
Reference in New Issue