GSdx GSDevice: Using FastList instead of std::list. Using range loops (correctly). Using auto instead of declaring iterator type.

This commit is contained in:
Alessandro Vetere 2017-08-04 19:59:41 +02:00 committed by Gregory Hainaut
parent 965334350f
commit b2508dcb59
2 changed files with 7 additions and 7 deletions

View File

@ -45,7 +45,7 @@ GSDevice::GSDevice()
GSDevice::~GSDevice() GSDevice::~GSDevice()
{ {
for(auto &t : m_pool) delete t; for(auto t : m_pool) delete t;
delete m_backbuffer; delete m_backbuffer;
delete m_merge; delete m_merge;
@ -66,7 +66,7 @@ bool GSDevice::Create(const std::shared_ptr<GSWnd>& wnd)
bool GSDevice::Reset(int w, int h) bool GSDevice::Reset(int w, int h)
{ {
for(auto &t : m_pool) delete t; for(auto t : m_pool) delete t;
m_pool.clear(); m_pool.clear();
@ -133,9 +133,9 @@ void GSDevice::Present(GSTexture* sTex, GSTexture* dTex, const GSVector4& dRect,
GSTexture* GSDevice::FetchSurface(int type, int w, int h, bool msaa, int format) GSTexture* GSDevice::FetchSurface(int type, int w, int h, bool msaa, int format)
{ {
GSVector2i size(w, h); const GSVector2i size(w, h);
for(list<GSTexture*>::iterator i = m_pool.begin(); i != m_pool.end(); ++i) for(auto i = m_pool.begin(); i != m_pool.end(); ++i)
{ {
GSTexture* t = *i; GSTexture* t = *i;
@ -154,9 +154,8 @@ void GSDevice::PrintMemoryUsage()
{ {
#ifdef ENABLE_OGL_DEBUG #ifdef ENABLE_OGL_DEBUG
uint32 pool = 0; uint32 pool = 0;
for(list<GSTexture*>::iterator i = m_pool.begin(); i != m_pool.end(); i++) for(auto t : m_pool)
{ {
GSTexture* t = *i;
if (t) if (t)
pool += t->GetMemUsage(); pool += t->GetMemUsage();
} }

View File

@ -21,6 +21,7 @@
#pragma once #pragma once
#include "GSFastList.h"
#include "GSWnd.h" #include "GSWnd.h"
#include "GSTexture.h" #include "GSTexture.h"
#include "GSVertex.h" #include "GSVertex.h"
@ -103,7 +104,7 @@ public:
class GSDevice : public GSAlignedClass<32> class GSDevice : public GSAlignedClass<32>
{ {
list<GSTexture*> m_pool; FastList<GSTexture*> m_pool;
protected: protected:
std::shared_ptr<GSWnd> m_wnd; std::shared_ptr<GSWnd> m_wnd;