OpenClonk
C4TexMgr Class Reference

#include <C4Surface.h>

Public Member Functions

 C4TexMgr ()
 
 ~C4TexMgr ()
 
void RegTex (C4TexRef *pTex)
 
void UnregTex (C4TexRef *pTex)
 
void IntLock ()
 
void IntUnlock ()
 

Public Attributes

std::list< C4TexRef * > Textures
 

Detailed Description

Definition at line 182 of file C4Surface.h.

Constructor & Destructor Documentation

◆ C4TexMgr()

C4TexMgr::C4TexMgr ( )

Definition at line 813 of file C4Surface.cpp.

814 {
815  // clear textures
816  Textures.clear();
817 }
std::list< C4TexRef * > Textures
Definition: C4Surface.h:185

References Textures.

◆ ~C4TexMgr()

C4TexMgr::~C4TexMgr ( )

Definition at line 819 of file C4Surface.cpp.

820 {
821  // unlock all textures
822  IntUnlock();
823 }
void IntUnlock()
Definition: C4Surface.cpp:863

References IntUnlock().

Here is the call graph for this function:

Member Function Documentation

◆ IntLock()

void C4TexMgr::IntLock ( )

Definition at line 839 of file C4Surface.cpp.

840 {
841  // lock all textures
842  int j=Textures.size();
843  for (std::list<C4TexRef *>::iterator i=Textures.begin(); j--; ++i)
844  {
845  C4TexRef *pRef = *i;
846  if (pRef->Lock() && pRef->texLock.pBits)
847  {
848  pRef->fIntLock = true;
849 #ifndef USE_CONSOLE
850  // Release the underlying texture with GL and recreate
851  // it on unlock, so that the texture survives
852  // context recreation.
853  if(pGL)
854  {
855  glDeleteTextures(1, &pRef->texName);
856  pRef->texName = 0;
857  }
858 #endif
859  }
860  }
861 }
CStdGL * pGL
Definition: C4DrawGL.cpp:907
std::unique_ptr< unsigned char[]> pBits
Definition: C4Surface.h:146
unsigned int texName
Definition: C4Surface.h:155
LOCKED_RECT texLock
Definition: C4Surface.h:153
bool fIntLock
Definition: C4Surface.h:159
bool Lock()
Definition: C4Surface.cpp:728

References C4TexRef::fIntLock, C4TexRef::Lock(), _LOCKED_RECT::pBits, pGL, C4TexRef::texLock, C4TexRef::texName, and Textures.

Here is the call graph for this function:

◆ IntUnlock()

void C4TexMgr::IntUnlock ( )

Definition at line 863 of file C4Surface.cpp.

864 {
865  // unlock all internally locked textures
866  int j=Textures.size();
867  for (std::list<C4TexRef *>::iterator i=Textures.begin(); j--; ++i)
868  {
869  C4TexRef *pRef = *i;
870  if (pRef->fIntLock)
871  {
872  pRef->fIntLock = false;
873  pRef->CreateTexture();
874  pRef->Unlock();
875  }
876  }
877 }
void Unlock()
Definition: C4Surface.cpp:754

References C4TexRef::fIntLock, Textures, and C4TexRef::Unlock().

Referenced by ~C4TexMgr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegTex()

void C4TexMgr::RegTex ( C4TexRef pTex)

Definition at line 825 of file C4Surface.cpp.

826 {
827  // add texture to list
828  Textures.push_front(pTex);
829 }

References Textures.

Referenced by C4TexRef::C4TexRef().

Here is the caller graph for this function:

◆ UnregTex()

void C4TexMgr::UnregTex ( C4TexRef pTex)

Definition at line 831 of file C4Surface.cpp.

832 {
833  // remove texture from list
834  Textures.remove(pTex);
835  // if list is empty, remove self
836  if (Textures.empty()) { delete this; pTexMgr=nullptr; }
837 }
C4TexMgr * pTexMgr
Definition: C4Surface.cpp:879

References pTexMgr, and Textures.

Referenced by C4TexRef::~C4TexRef().

Here is the caller graph for this function:

Member Data Documentation

◆ Textures

std::list<C4TexRef *> C4TexMgr::Textures

Definition at line 185 of file C4Surface.h.

Referenced by C4TexMgr(), IntLock(), IntUnlock(), RegTex(), and UnregTex().


The documentation for this class was generated from the following files: