/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2008.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: src/sgx/graphics/drawsurface_manager.cpp

*/

#include "sgx/core/core.hpp"
#include "sgx/graphics/graphics.hpp"

CSGXDrawSurfaceManager *CSGXDrawSurfaceManager::m_pSingleton;
	
CSGXDrawSurfaceManager *CSGXDrawSurfaceManager::get() {
	if (!m_pSingleton) {
		m_pSingleton = new CSGXDrawSurfaceManager();
	}
	return m_pSingleton;
}

CSGXDrawSurfaceManager::CSGXDrawSurfaceManager() {
	m_pDisplay = NULL;
	m_pWorking = NULL;
}

CSGXDrawSurface *CSGXDrawSurfaceManager ::createSurface(tUINT32 width, tUINT32 height) {
	return new CSGXDrawSurface(width, height);
}

CSGXDrawSurface *CSGXDrawSurfaceManager ::createDisplaySurface(tUINT32 width, tUINT32 height) {
	sgxAssert(m_pDisplay==NULL);
	return m_pDisplay = new CSGXDrawSurface(width, height);
}

CSGXDrawSurface *CSGXDrawSurfaceManager ::createWorkingSurface(tUINT32 width, tUINT32 height) {
	sgxAssert(m_pWorking==NULL);
	return m_pWorking = new CSGXDrawSurface(width, height);
}

CSGXDrawSurface *CSGXDrawSurfaceManager ::getDisplaySurface() const {
	return m_pDisplay;
}
	
CSGXDrawSurface *CSGXDrawSurfaceManager ::getWorkingSurface() const {
	return m_pWorking;
}
