|
Kodi Documentation 23.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 mipmap, 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 mipmap, bool immediately=false) |
| Request a texture to be unloaded. | |
| void | CleanupUnusedImages (bool immediately=false) |
| Cleanup images that are no longer in use. | |
| bool | GetInterimImage (const std::string &path, CAspectRatio::AspectRatio aspectRatio, CTextureArray &texture) |
| Get the largest loaded decode of an image, to draw while another size loads. | |
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 | mipmap, | ||
| 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. A zero target size keeps the image's own size on that side, and with no target size the image loads at screen size, unless the aspect ratio is center.
| path | path of the image to load. |
| texture | texture object to hold the resulting texture |
| width | target width of the image. |
| height | target height of the image. |
| mipmap | whether to generate mipmaps, for smooth downscaling. |
| firstRequest | true if this is the first time we are requesting this texture |
| useCache | whether to load from image cache. |
| bool CGUILargeTextureManager::GetInterimImage | ( | const std::string & | path, |
| CAspectRatio::AspectRatio | aspectRatio, | ||
| CTextureArray & | texture ) |
Get the largest loaded decode of an image, to draw while another size loads.
| path | path of the image. |
| aspectRatio | aspect ratio mode of the control that will draw it. |
| texture | texture object to hold the decode. |
|
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 | mipmap, | ||
| 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. |
| mipmap | whether the image to release has mipmaps. |
| immediately | if set true the image is immediately unloaded once its reference count reaches zero rather than being unloaded after a delay. |