From 2b1e6790fa942f88d00f29e5ce87559847311364 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Sun, 12 Aug 2012 22:08:18 -0700 Subject: [PATCH] Free up texture data when using renderer_null. --- src/renderer_null.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/renderer_null.cpp b/src/renderer_null.cpp index 9b3042a9a..2e85510fa 100644 --- a/src/renderer_null.cpp +++ b/src/renderer_null.cpp @@ -105,8 +105,23 @@ namespace bgfx { } - void Context::rendererCreateTexture(TextureHandle /*_handle*/, Memory* /*_mem*/, uint32_t /*_flags*/) + void Context::rendererCreateTexture(TextureHandle /*_handle*/, Memory* _mem, uint32_t /*_flags*/) { + StreamRead stream(_mem->data, _mem->size); + + uint32_t magic; + stream.read(magic); + + if (BGFX_MAGIC == magic) + { + TextureInfo ti; + stream.read(ti); + + if (NULL != ti.m_mem) + { + release(ti.m_mem); + } + } } void Context::rendererUpdateTexture(TextureHandle /*_handle*/, uint8_t /*_mip*/, const Rect& /*_rect*/, const Memory* /*_mem*/)