summaryrefslogtreecommitdiff
path: root/SkinEngine/src/bitmap_cache.h
blob: 3cf4893733ca41fafbe3ab3a88f4cc8e515fac6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef bitmap_cache_h__
#define bitmap_cache_h__

class CMyBitmap;

class CBitmapCache
{
private:
	struct CacheNode
	{
		TCHAR *path;
		HBITMAP bitmap;
		int refCount;

		static int cmp(const CacheNode *p1, const CacheNode *p2)
		{
			return lstrcmp(p1->path, p2->path);
		}
	};
	OBJLIST<CacheNode> m_cache;

public:
	CBitmapCache();
	~CBitmapCache();
	HBITMAP LoadBitmap(const TCHAR *path);
	void UnloadBitmap(HBITMAP);
};

// The only instance
extern CBitmapCache g_BitmapCache;

#endif // bitmap_cache_h__