mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
fixing some bad memory usage
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/11 00:56:15 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/11 01:49:12 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/03/25 13:53:59 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace mlx
|
||||
TextureManager() = default;
|
||||
|
||||
inline void clear() { _texture_descriptors.clear(); }
|
||||
|
||||
inline std::pair<DrawableResource*, bool> registerTexture(Texture* texture, int x, int y)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
@@ -33,6 +34,29 @@ namespace mlx
|
||||
return std::make_pair(static_cast<DrawableResource*>(&const_cast<TextureRenderDescriptor&>(*res.first)), res.second);
|
||||
}
|
||||
|
||||
inline bool isTextureKnown(Texture* texture) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
for(const auto& desc : _texture_descriptors)
|
||||
{
|
||||
if(desc.texture == texture)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline void eraseTextures(Texture* texture)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
for(auto it = _texture_descriptors.begin(); it != _texture_descriptors.end();)
|
||||
{
|
||||
if(it->texture == texture)
|
||||
it = _texture_descriptors.erase(it);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
~TextureManager() = default;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user