11 #include "TextureCacheJob.h" 12 #include "TextureDatabase.h" 13 #include "threads/CriticalSection.h" 14 #include "threads/Event.h" 15 #include "utils/JobManager.h" 60 std::string
CheckCachedImage(
const std::string &image,
bool &needsRecaching);
94 std::string
CacheImage(
const std::string& image,
95 std::unique_ptr<CTexture>* texture =
nullptr,
131 static std::string
GetCacheFile(
const std::string &url);
159 bool Export(
const std::string &image,
const std::string &destination,
bool overwrite);
160 bool Export(
const std::string &image,
const std::string &destination);
170 bool IsCachedImage(
const std::string &image)
const;
179 std::string GetCachedImage(
const std::string &image,
CTextureDetails &details,
bool trackUsage =
false);
187 bool GetCachedTexture(
const std::string &url,
CTextureDetails &details);
195 bool ClearCachedTexture(
const std::string &url, std::string &cacheFile);
196 bool ClearCachedTexture(
int textureID, std::string &cacheFile);
210 bool SetCachedTextureValid(
const std::string &url,
bool updateable);
212 void OnJobComplete(
unsigned int jobID,
bool success,
CJob *job)
override;
222 CCriticalSection m_databaseSection;
224 std::set<std::string> m_processinglist;
225 CCriticalSection m_processingSection;
227 std::vector<CTextureDetails> m_useCounts;
228 CCriticalSection m_useCountSection;
This is an Event class built from a ConditionVariable.
Definition: Event.h:35
Texture cache class for handling the caching of images.
Definition: TextureCache.h:36
Base class for jobs that are executed asynchronously.
Definition: Job.h:109
void BackgroundCacheImage(const std::string &image)
Cache image (if required) using a background job.
Definition: TextureCache.cpp:116
static std::string GetCachedPath(const std::string &file)
retrieve the full path of the given cached file
Definition: TextureCache.cpp:288
void Deinitialize()
Deinitialize the texture cache.
Definition: TextureCache.cpp:47
Simple class for passing texture detail around.
Definition: TextureCacheJob.h:26
std::string CheckCachedImage(const std::string &image, bool &needsRecaching)
Check whether we already have this image cached.
Definition: TextureCache.cpp:106
void Initialize()
Initialize the texture cache.
Definition: TextureCache.cpp:40
bool AddCachedTexture(const std::string &image, const CTextureDetails &details)
Add this image to the database Thread-safe wrapper of CTextureDatabase::AddCachedTexture.
Definition: TextureCache.cpp:243
Job class for caching textures.
Definition: TextureCacheJob.h:55
Base texture class, subclasses of which depend on the render spec (DX, GL etc.)
Definition: Texture.h:34
void ClearCachedImage(const std::string &image, bool deleteSource=false)
clear the cached version of the given image
Definition: TextureCache.cpp:207
bool StartCacheImage(const std::string &image)
Updates the in-process list.
Definition: TextureCache.cpp:134
static bool CanCacheImageURL(const CURL &url)
check whether an image:// URL may be cached
Definition: TextureCache.cpp:97
bool HasCachedImage(const std::string &image)
Check whether an image is in the cache Note: If the image url won't normally be cached (eg a skin ima...
Definition: TextureCache.cpp:72
bool Export(const std::string &image, const std::string &destination, bool overwrite)
Export a (possibly) cached image to a file.
Definition: TextureCache.cpp:322
Definition: TextureDatabase.h:58
static std::string GetCacheFile(const std::string &url)
retrieve a cache file (relative to the cache path) to associate with the given image, excluding extension Use GetCachedPath(GetCacheFile(url)+extension) for the full path to the file.
Definition: TextureCache.cpp:280
std::string CacheImage(const std::string &image, std::unique_ptr< CTexture > *texture=nullptr, CTextureDetails *details=nullptr)
Cache an image to image cache, optionally return the texture.
Definition: TextureCache.cpp:146
Job Queue class to handle a queue of unique jobs to be processed sequentially.
Definition: JobManager.h:63