Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
Background texture loading manager. More...
#include <GUILargeTextureManager.h>
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, unsigned int width, unsigned int height, CAspectRatio::AspectRatio aspectRatio, bool firstRequest, bool useCache=true) |
Request a texture to be loaded in the background. | |
void | ReleaseImage (const std::string &path, unsigned int width, unsigned int height, CAspectRatio::AspectRatio aspectRatio, 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. | |
Background texture loading manager.
Used to load textures for the user interface asynchronously, allowing fluid framerates while background loading textures.
|
default |
|
overridedefault |
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.
immediately | set to true to cleanup images regardless of whether the delay has passed |
bool CGUILargeTextureManager::GetImage | ( | const std::string & | path, |
CTextureArray & | texture, | ||
unsigned int | width, | ||
unsigned int | height, | ||
CAspectRatio::AspectRatio | aspectRatio, | ||
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.
path | path of the image to load. |
texture | texture object to hold the resulting texture |
width | target width of the image. 0 means original width. |
height | target height of the image. 0 means original height. |
firstRequest | true if this is the first time we are requesting this texture |
useCache | whether to load from image cache. |
|
overridevirtual |
Callback from CImageLoader on completion of a loaded image.
Transfers texture information from the loading job to our allocated texture list.
Implements IJobCallback.
void CGUILargeTextureManager::ReleaseImage | ( | const std::string & | path, |
unsigned int | width, | ||
unsigned int | height, | ||
CAspectRatio::AspectRatio | aspectRatio, | ||
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.
path | path of the image to release. |
width | target width of the image to release. |
height | target height of the image to release. |
immediately | if set true the image is immediately unloaded once its reference count reaches zero rather than being unloaded after a delay. |