diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/api/skin/regioncache.h | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Wasabi/api/skin/regioncache.h')
-rw-r--r-- | Src/Wasabi/api/skin/regioncache.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Src/Wasabi/api/skin/regioncache.h b/Src/Wasabi/api/skin/regioncache.h new file mode 100644 index 00000000..ea2df961 --- /dev/null +++ b/Src/Wasabi/api/skin/regioncache.h @@ -0,0 +1,53 @@ +#ifndef __REGIONCACHE_H +#define __REGIONCACHE_H + +#include <bfc/string/StringW.h> +#include <tataki/region/region.h> +#include <bfc/ptrlist.h> + +class CacheRegionServer : public RegionServerI { + public: + CacheRegionServer(api_region *r) { + reg = new RegionI(r->getOSHandle()); + } + ~CacheRegionServer() { + delete reg; + } + + virtual api_region *getRegion() { + return reg; + } + + private: + RegionI *reg; +}; + +struct RegionCacheItem { + RegionCacheItem(const wchar_t *filename) : region(NULL) { } + virtual ~RegionCacheItem() { } + StringW filename; + CacheRegionServer *region; +}; + +class SortRegionCacheItem { +public: + static int compareItem(RegionCacheItem *p1, RegionCacheItem *p2) { + return WCSICMP(p1->filename, p2->filename); + } + static int compareAttrib(const wchar_t *attrib, RegionCacheItem *item) { + return WCSICMP(attrib, item->filename); + } +}; + + +class RegionCache { + public: + + static RegionServer *requestSkinRegion(const wchar_t *id); + static void cacheSkinRegion(const wchar_t *id, api_region *r); + + static PtrListQuickSorted<RegionCacheItem, SortRegionCacheItem> cache; + static int getNumCaches() { return cache.getNumItems(); } +}; + +#endif
\ No newline at end of file |