Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ActiveFramePool Class Reference

ActiveFramePool implemented a LRU cache to keep tracking the most recent accessed key frames A key frame will be unloaded if it's not accessed for a while (at the end of cache list) The ActiveFramePool will be updated whenever Editor::scrubTo() gets called. More...

#include <activeframepool.h>

+ Inheritance diagram for ActiveFramePool:
Inheritance graph
[legend]
+ Collaboration diagram for ActiveFramePool:
Collaboration graph
[legend]

Public Member Functions

void put (KeyFrame *key)
 
void clear ()
 
void resize (quint64 memoryBudget)
 
bool isFrameInPool (KeyFrame *)
 
void setMinFrameCount (size_t frameCount)
 
void onKeyFrameDestroy (KeyFrame *) override
 
virtual void onKeyFrameDestroy (KeyFrame *)=0
 

Private Types

using list_iterator_t = std::list< KeyFrame * >::iterator
 

Private Member Functions

void discardLeastUsedFrames ()
 
void unloadFrame (KeyFrame *key)
 
void recalcuateTotalUsedMemory ()
 

Private Attributes

std::list< KeyFrame * > mCacheFramesList
 
std::unordered_map< KeyFrame *, list_iterator_t > mCacheFramesMap
 
quint64 mMemoryBudgetInBytes = 1024 * 1024 * 1024
 
quint64 mTotalUsedMemory = 0
 
size_t mMinFrameCount = 15
 

Detailed Description

ActiveFramePool implemented a LRU cache to keep tracking the most recent accessed key frames A key frame will be unloaded if it's not accessed for a while (at the end of cache list) The ActiveFramePool will be updated whenever Editor::scrubTo() gets called.

Note: ActiveFramePool does not handle file saving. It loads frames, but never writes frames to disks.

Definition at line 33 of file activeframepool.h.

Member Typedef Documentation

◆ list_iterator_t

using ActiveFramePool::list_iterator_t = std::list<KeyFrame*>::iterator
private

Definition at line 52 of file activeframepool.h.

Constructor & Destructor Documentation

◆ ActiveFramePool()

ActiveFramePool::ActiveFramePool ( )
explicit

Definition at line 23 of file activeframepool.cpp.

◆ ~ActiveFramePool()

ActiveFramePool::~ActiveFramePool ( )
virtual

Definition at line 28 of file activeframepool.cpp.

Member Function Documentation

◆ clear()

void ActiveFramePool::clear ( )

Definition at line 62 of file activeframepool.cpp.

◆ discardLeastUsedFrames()

void ActiveFramePool::discardLeastUsedFrames ( )
private

Definition at line 105 of file activeframepool.cpp.

◆ isFrameInPool()

bool ActiveFramePool::isFrameInPool ( KeyFrame *  key)

Definition at line 80 of file activeframepool.cpp.

◆ onKeyFrameDestroy()

void ActiveFramePool::onKeyFrameDestroy ( KeyFrame *  key)
overridevirtual

Implements KeyFrameEventListener.

Definition at line 91 of file activeframepool.cpp.

◆ put()

void ActiveFramePool::put ( KeyFrame *  key)

Definition at line 33 of file activeframepool.cpp.

◆ recalcuateTotalUsedMemory()

void ActiveFramePool::recalcuateTotalUsedMemory ( )
private

Definition at line 128 of file activeframepool.cpp.

◆ resize()

void ActiveFramePool::resize ( quint64  memoryBudget)

Definition at line 72 of file activeframepool.cpp.

◆ setMinFrameCount()

void ActiveFramePool::setMinFrameCount ( size_t  frameCount)

Definition at line 86 of file activeframepool.cpp.

◆ unloadFrame()

void ActiveFramePool::unloadFrame ( KeyFrame *  key)
private

Definition at line 122 of file activeframepool.cpp.

Member Data Documentation

◆ mCacheFramesList

std::list<KeyFrame*> ActiveFramePool::mCacheFramesList
private

Definition at line 54 of file activeframepool.h.

◆ mCacheFramesMap

std::unordered_map<KeyFrame*, list_iterator_t> ActiveFramePool::mCacheFramesMap
private

Definition at line 55 of file activeframepool.h.

◆ mMemoryBudgetInBytes

quint64 ActiveFramePool::mMemoryBudgetInBytes = 1024 * 1024 * 1024
private

Definition at line 56 of file activeframepool.h.

◆ mMinFrameCount

size_t ActiveFramePool::mMinFrameCount = 15
private

Definition at line 58 of file activeframepool.h.

◆ mTotalUsedMemory

quint64 ActiveFramePool::mTotalUsedMemory = 0
private

Definition at line 57 of file activeframepool.h.


The documentation for this class was generated from the following files:
  • core_lib/src/activeframepool.h
  • core_lib/src/activeframepool.cpp
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39