From 3031883409504c9108d60f6f68d98b3cc9923b77 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Thu, 26 Mar 2015 21:24:51 +0600 Subject: [PATCH] Move zLUT initialization to DepthBufferList ctor. Destruction of zLUT moved to DepthBufferList destructor. --- DepthBuffer.cpp | 16 ++++++++++++---- DepthBuffer.h | 3 ++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/DepthBuffer.cpp b/DepthBuffer.cpp index 5c2e6b0f..69b3c557 100644 --- a/DepthBuffer.cpp +++ b/DepthBuffer.cpp @@ -204,10 +204,8 @@ void DepthBuffer::bindDepthImageTexture() #endif } -void DepthBufferList::init() +DepthBufferList::DepthBufferList() : m_pCurrent(NULL), m_pzLUT(NULL) { - m_pCurrent = NULL; - m_pzLUT = new u16[0x40000]; for (int i = 0; i<0x40000; i++) { u32 exponent = 0; @@ -222,10 +220,20 @@ void DepthBufferList::init() } } -void DepthBufferList::destroy() +DepthBufferList::~DepthBufferList() { delete[] m_pzLUT; m_pzLUT = NULL; + m_list.clear(); +} + +void DepthBufferList::init() +{ + m_pCurrent = NULL; +} + +void DepthBufferList::destroy() +{ m_pCurrent = NULL; m_list.clear(); } diff --git a/DepthBuffer.h b/DepthBuffer.h index b3431a26..246a0ef2 100644 --- a/DepthBuffer.h +++ b/DepthBuffer.h @@ -52,8 +52,9 @@ public: const u16 * const getZLUT() const {return m_pzLUT;} private: - DepthBufferList() : m_pCurrent(NULL), m_pzLUT(NULL) {} + DepthBufferList(); DepthBufferList(const FrameBufferList &); + ~DepthBufferList(); typedef std::list DepthBuffers; DepthBuffers m_list;