Krita Source Code Documentation
Loading...
Searching...
No Matches
KisTextureTileInfoPoolSingleSize Class Reference

#include <kis_texture_tile_info_pool.h>

Public Member Functions

int chunkSize () const
 
bool free (quint8 *ptr)
 
 KisTextureTileInfoPoolSingleSize (int tileWidth, int tileHeight, int pixelSize)
 
quint8 * malloc ()
 
int numFrees () const
 
void tryPurge (int numFrees)
 

Private Attributes

const int m_chunkSize
 
int m_maxAllocations
 
int m_numAllocations
 
int m_numFrees
 
boost::pool< boost::default_user_allocator_new_delete > m_pool
 

Detailed Description

A pool for keeping the chunks of data of constant size. We have one such pool per used openGL tile size. The size of the chunk obviously depends on the size of the tile in pixels and the size of a single pixel in bytes.

As soon as the number of allocations drops to zero, all the memory is returned back to the operating system. Please note, that there is no way of reclaiming even unused pool memory until all the allocated chunks are free'd.

Definition at line 42 of file kis_texture_tile_info_pool.h.

Constructor & Destructor Documentation

◆ KisTextureTileInfoPoolSingleSize()

KisTextureTileInfoPoolSingleSize::KisTextureTileInfoPoolSingleSize ( int tileWidth,
int tileHeight,
int pixelSize )
inline

Member Function Documentation

◆ chunkSize()

int KisTextureTileInfoPoolSingleSize::chunkSize ( ) const
inline

Definition at line 71 of file kis_texture_tile_info_pool.h.

71 {
72 return m_chunkSize;
73 }

◆ free()

bool KisTextureTileInfoPoolSingleSize::free ( quint8 * ptr)
inline

Definition at line 61 of file kis_texture_tile_info_pool.h.

61 {
63 m_numFrees++;
64 m_pool.free(ptr);
65
67
69 }
#define KIS_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:97
const int freeThreshold

References freeThreshold, and KIS_ASSERT_RECOVER_NOOP.

◆ malloc()

quint8 * KisTextureTileInfoPoolSingleSize::malloc ( )
inline

Definition at line 54 of file kis_texture_tile_info_pool.h.

54 {
57
58 return (quint8*)m_pool.malloc();
59 }

◆ numFrees()

int KisTextureTileInfoPoolSingleSize::numFrees ( ) const
inline

Definition at line 75 of file kis_texture_tile_info_pool.h.

75 {
76 return m_numFrees;
77 }

◆ tryPurge()

void KisTextureTileInfoPoolSingleSize::tryPurge ( int numFrees)
inline

Definition at line 79 of file kis_texture_tile_info_pool.h.

79 {
80 // checking numFrees here is asserting that there were no frees
81 // between the time we originally indicated the purge and now.
83 m_pool.purge_memory();
85 }
86 }

Member Data Documentation

◆ m_chunkSize

const int KisTextureTileInfoPoolSingleSize::m_chunkSize
private

Definition at line 89 of file kis_texture_tile_info_pool.h.

◆ m_maxAllocations

int KisTextureTileInfoPoolSingleSize::m_maxAllocations
private

Definition at line 92 of file kis_texture_tile_info_pool.h.

◆ m_numAllocations

int KisTextureTileInfoPoolSingleSize::m_numAllocations
private

Definition at line 91 of file kis_texture_tile_info_pool.h.

◆ m_numFrees

int KisTextureTileInfoPoolSingleSize::m_numFrees
private

Definition at line 93 of file kis_texture_tile_info_pool.h.

◆ m_pool

boost::pool<boost::default_user_allocator_new_delete> KisTextureTileInfoPoolSingleSize::m_pool
private

Definition at line 90 of file kis_texture_tile_info_pool.h.


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