fixing some bad memory usage

This commit is contained in:
Kbz-8
2024-03-25 13:57:20 +01:00
parent 57c5ae5415
commit be52578d37
35 changed files with 1294 additions and 1298 deletions

View File

@@ -11,7 +11,6 @@
/* ************************************************************************** */
#include <core/graphics.h>
#include <iostream>
namespace mlx
{
@@ -64,4 +63,17 @@ namespace mlx
MLX_PROFILE_FUNCTION();
_text_manager.loadFont(*_renderer, filepath, scale);
}
void GraphicsSupport::tryEraseTextureFromManager(Texture* texture) noexcept
{
MLX_PROFILE_FUNCTION();
for(auto it = _drawlist.begin(); it != _drawlist.end();)
{
if(_texture_manager.isTextureKnown(texture))
it = _drawlist.erase(it);
else
++it;
}
_texture_manager.eraseTextures(texture);
}
}