From 13bdecc3aa176584370a32a7cb0d9dd83ff9c7b6 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 8 Sep 2019 10:38:18 +0300 Subject: [PATCH] Changed: Helper functions (clear, empty) for CTextureId --HG-- branch : html-improvements --- code/nel/include/nel/gui/view_renderer.h | 6 ++++++ code/nel/src/gui/view_renderer.cpp | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/code/nel/include/nel/gui/view_renderer.h b/code/nel/include/nel/gui/view_renderer.h index 6a09a085b..1b489802f 100644 --- a/code/nel/include/nel/gui/view_renderer.h +++ b/code/nel/include/nel/gui/view_renderer.h @@ -101,6 +101,12 @@ namespace NLGUI return _TextureId; } + // Return true if TextureId is not set + bool empty() const { return _TextureId < 0; }; + + // delete TextureId if set + void clear(); + void serial(NLMISC::IStream &f); private: diff --git a/code/nel/src/gui/view_renderer.cpp b/code/nel/src/gui/view_renderer.cpp index 66da2800b..7d60f3c31 100644 --- a/code/nel/src/gui/view_renderer.cpp +++ b/code/nel/src/gui/view_renderer.cpp @@ -1932,6 +1932,16 @@ namespace NLGUI return _TextureId >= 0; } + // *************************************************************************** + void CViewRenderer::CTextureId::clear() + { + if (_TextureId >= 0) + { + CViewRenderer::getInstance()->deleteTexture(_TextureId); + _TextureId = -1; + } + } + // *************************************************************************** void CViewRenderer::CTextureId::serial(NLMISC::IStream &f) {