Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
No Matches
CGUILargeTextureManager Class Reference

Background texture loading manager. More...

#include <GUILargeTextureManager.h>

Inheritance diagram for CGUILargeTextureManager:

Public Member Functions

 CGUILargeTextureManager ()
 ~CGUILargeTextureManager () override
void OnJobComplete (unsigned int jobID, bool success, CJob *job) override
 Callback from CImageLoader on completion of a loaded image.
bool GetImage (const std::string &path, CTextureArray &texture, bool firstRequest, bool useCache=true)
 Request a texture to be loaded in the background.
void ReleaseImage (const std::string &path, bool immediately=false)
 Request a texture to be unloaded.
void CleanupUnusedImages (bool immediately=false)
 Cleanup images that are no longer in use.
- Public Member Functions inherited from IJobCallback
virtual ~IJobCallback ()=default
 Destructor for job call back objects.
virtual void OnJobAbort (unsigned int jobID, CJob *job)
 An optional callback function used when a job will be aborted.
virtual void OnJobProgress (unsigned int jobID, unsigned int progress, unsigned int total, const CJob *job)
 An optional callback function that a job may call while processing.

Detailed Description

Background texture loading manager.

Used to load textures for the user interface asynchronously, allowing fluid framerates while background loading textures.

See also
IJobCallback, CGUITexture

Constructor & Destructor Documentation

◆ CGUILargeTextureManager()

CGUILargeTextureManager::CGUILargeTextureManager ( )

◆ ~CGUILargeTextureManager()

CGUILargeTextureManager::~CGUILargeTextureManager ( )

Member Function Documentation

◆ CleanupUnusedImages()

void CGUILargeTextureManager::CleanupUnusedImages ( bool immediately = false)

Cleanup images that are no longer in use.

Loaded textures are reference counted, and upon reaching reference count 0 through ReleaseImage() they are flagged as unused with the current time. After a delay they may be unloaded, hence CleanupUnusedImages() should be called periodically to ensure this occurs.

immediatelyset to true to cleanup images regardless of whether the delay has passed

◆ GetImage()

bool CGUILargeTextureManager::GetImage ( const std::string & path,
CTextureArray & texture,
bool firstRequest,
bool useCache = true )

Request a texture to be loaded in the background.

Loaded textures are reference counted, hence this call may immediately return with the texture object filled if the texture has been previously loaded, else will return with an empty texture object if it is being loaded.

pathpath of the image to load.
texturetexture object to hold the resulting texture
orientationorientation of resulting texture
firstRequesttrue if this is the first time we are requesting this texture
true if the image exists, else false.
See also
CGUITextureArray and CGUITexture

◆ OnJobComplete()

void CGUILargeTextureManager::OnJobComplete ( unsigned int jobID,
bool success,
CJob * job )

Callback from CImageLoader on completion of a loaded image.

Transfers texture information from the loading job to our allocated texture list.

See also
CImageLoader, IJobCallback

Implements IJobCallback.

◆ ReleaseImage()

void CGUILargeTextureManager::ReleaseImage ( const std::string & path,
bool immediately = false )

Request a texture to be unloaded.

When textures are finished with, this function should be called. This decrements the texture's reference count, and schedules it to be unloaded once the reference count reaches zero. If the texture is still queued for loading, or is in the process of loading, the image load is cancelled.

pathpath of the image to release.
immediatelyif set true the image is immediately unloaded once its reference count reaches zero rather than being unloaded after a delay.

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