#include "pch.cpp" #pragma hdrstop CHandleFactory::CHandleFactory() : m_Handles() { m_Free = __INVALIDHANDLE; } CHandleFactory::CHandleFactory(DWORD dwGrowSize) : m_Handles() { m_Free = __INVALIDHANDLE; m_Handles.SetGrowSize(dwGrowSize); } DWORD CHandleFactory::CreateNewHandle( LPD3DBASEOBJ pObj ) { DWORD handle = m_Free; if (m_Free != __INVALIDHANDLE) { m_Free = m_Handles[m_Free].m_Next; } else { handle = m_Handles.GetSize(); m_Free = handle + 1; if( FAILED(m_Handles.Grow( m_Free )) ) return __INVALIDHANDLE; DWORD dwSize = m_Handles.GetSize(); for( DWORD i = handle; i> 1; return CHandleFactory::GetObject( dwIndex ); } BOOL CVShaderHandleFactory::SetObject( DWORD dwHandle, LPD3DBASEOBJ pObject) { DWORD dwIndex = dwHandle >> 1; return CHandleFactory::SetObject( dwIndex, pObject ); } void CVShaderHandleFactory::ReleaseHandle(DWORD dwHandle, BOOL bDeleteObject) { DWORD dwIndex = dwHandle >> 1; CHandleFactory::ReleaseHandle( dwIndex, bDeleteObject ); }