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