ManaPlus
Public Member Functions | Data Fields
TextureAtlas Struct Reference

#include <textureatlas.h>

Inheritance diagram for TextureAtlas:
MemoryCounter

Public Member Functions

 TextureAtlas ()
 
int calcMemoryLocal () const
 
int calcMemoryChilds (const int level) const
 
std::string getCounterName () const
 
- Public Member Functions inherited from MemoryCounter
 MemoryCounter ()
 
virtual ~MemoryCounter ()
 
int calcMemory (const int level) const
 

Data Fields

std::string name
 
ImageatlasImage
 
int width
 
int height
 
std::vector< AtlasItem * > items
 

Detailed Description

Definition at line 40 of file textureatlas.h.

Constructor & Destructor Documentation

◆ TextureAtlas()

TextureAtlas::TextureAtlas ( )
inline

Definition at line 42 of file textureatlas.h.

42  :
43  MemoryCounter(),
44  name(),
45  atlasImage(nullptr),
46  width(0),
47  height(0),
48  items()
49  {
50  }
std::string name
Definition: textureatlas.h:74
Image * atlasImage
Definition: textureatlas.h:75
std::vector< AtlasItem * > items
Definition: textureatlas.h:78

Referenced by calcMemoryLocal().

Member Function Documentation

◆ calcMemoryChilds()

int TextureAtlas::calcMemoryChilds ( const int  level) const
inlinevirtual

Reimplemented from MemoryCounter.

Definition at line 60 of file textureatlas.h.

61  {
62  int sz = 0;
63  FOR_EACH (STD_VECTOR<AtlasItem*>::const_iterator, it, items)
64  {
65  AtlasItem *const item = *it;
66  sz += item->calcMemory(level + 1);
67  }
68  return sz;
69  }
int calcMemory(const int level) const
#define FOR_EACH(type, iter, array)
Definition: foreach.h:25

References MemoryCounter::calcMemory(), FOR_EACH, and items.

◆ calcMemoryLocal()

int TextureAtlas::calcMemoryLocal ( ) const
inlinevirtual

Reimplemented from MemoryCounter.

Definition at line 54 of file textureatlas.h.

55  {
56  return static_cast<int>(sizeof(TextureAtlas) +
57  items.capacity() * sizeof(AtlasItem*));
58  }

References items, and TextureAtlas().

◆ getCounterName()

std::string TextureAtlas::getCounterName ( ) const
inlinevirtual

Reimplemented from MemoryCounter.

Definition at line 71 of file textureatlas.h.

72  { return name; }

References name.

Field Documentation

◆ atlasImage

Image* TextureAtlas::atlasImage

◆ height

int TextureAtlas::height

Definition at line 77 of file textureatlas.h.

Referenced by AtlasManager::createSDLAtlas(), and AtlasManager::simpleSort().

◆ items

std::vector<AtlasItem*> TextureAtlas::items

◆ name

std::string TextureAtlas::name

◆ width

int TextureAtlas::width

Definition at line 76 of file textureatlas.h.

Referenced by AtlasManager::createSDLAtlas(), and AtlasManager::simpleSort().


The documentation for this struct was generated from the following file: