#include <pgsurfacecache.h>
Public Member Functions | |
| PG_SurfaceCache () | |
| virtual | ~PG_SurfaceCache () |
| void | CreateKey (std::string &key, Uint16 w, Uint16 h, PG_Gradient *gradient, SDL_Surface *background, PG_Draw::BkMode bkmode, Uint8 blend) |
| Create a fairly unique key for a given surface. | |
| SDL_Surface * | FindSurface (const std::string &key) |
| Find the surface to a given key . | |
| SDL_Surface * | AddSurface (const std::string &key, SDL_Surface *surface) |
| Add a surface to the list. | |
| void | DeleteSurface (SDL_Surface *surface, bool bDeleteIfNotExists=true) |
| Deletes a surface from the list. | |
| void | IncRef (const std::string &key) |
| Increase the reference counter of a surface. | |
| void | Cleanup () |
| Removes all surfaces from the cache. | |
To reduce memory consumption, paragui classes use this class to cache their surfaces. The class stores an internal counter for each surface that is decreased every time the surface is deleted. It is proposed to use this interface if you add a new class to ParaGui.
Definition at line 57 of file pgsurfacecache.h.
|
|
Definition at line 77 of file pgsurfacecache.cpp. |
|
|
Definition at line 82 of file pgsurfacecache.cpp. References Cleanup(), MY_SURFACEINDEX, and MY_SURFACEMAP. |
|
||||||||||||
|
Add a surface to the list.
Definition at line 200 of file pgsurfacecache.cpp. References pg_surface_cache_t::key, PG_LogDBG(), pg_surface_cache_t::refcount, and pg_surface_cache_t::surface. Referenced by PG_ThemeWidget::CreateThemedSurface(), and PG_FileArchive::LoadSurface(). |
|
|
Removes all surfaces from the cache.
Definition at line 92 of file pgsurfacecache.cpp. References MY_SURFACEINDEX, MY_SURFACEMAP, and pg_surface_cache_t::surface. Referenced by ~PG_SurfaceCache(). |
|
||||||||||||||||||||||||||||||||
|
Create a fairly unique key for a given surface.
Definition at line 113 of file pgsurfacecache.cpp. References assert, and PG_Gradient::colors. Referenced by PG_ThemeWidget::CreateThemedSurface(). |
|
||||||||||||
|
Deletes a surface from the list.
Definition at line 236 of file pgsurfacecache.cpp. References pg_surface_cache_t::key, MY_SURFACEINDEX, MY_SURFACEMAP, pg_surface_cache_t::refcount, and pg_surface_cache_t::surface. Referenced by PG_ThemeWidget::DeleteThemedSurface(), and PG_FileArchive::UnloadSurface(). |
|
|
Find the surface to a given key .
Definition at line 185 of file pgsurfacecache.cpp. References MY_SURFACEMAP. Referenced by PG_ThemeWidget::CreateThemedSurface(), and PG_FileArchive::LoadSurface(). |
|
|
Increase the reference counter of a surface.
Definition at line 267 of file pgsurfacecache.cpp. References pg_surface_cache_t::refcount. Referenced by PG_ThemeWidget::CreateThemedSurface(), and PG_FileArchive::LoadSurface(). |
1.4.2