1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2025-04-21 12:27:27 +03:00

Created separate subclasses for output and off-screen surfaces

There are a few exclusive operations for each type. Also we no longer
need the freeWhenDone flag since the class now determines whether the
surface should be freed or not.
This commit is contained in:
Maarten ter Huurne
2014-08-10 13:25:54 +02:00
parent b3719d1331
commit 4bd1c799bd
17 changed files with 195 additions and 161 deletions

View File

@@ -23,9 +23,10 @@
#include <string>
#include <unordered_map>
class OffscreenSurface;
class Surface;
typedef std::unordered_map<std::string, Surface *> SurfaceHash;
typedef std::unordered_map<std::string, OffscreenSurface *> SurfaceHash;
/**
Hash Map of surfaces that loads surfaces not already loaded and reuses already loaded ones.
@@ -49,17 +50,17 @@ public:
* Adds a copy of the given surface to this collection under the given
* path. Returns the copy.
*/
Surface *add(Surface const& s, std::string const& path);
OffscreenSurface *add(Surface const& s, std::string const& path);
Surface *add(const std::string &path);
Surface *addSkinRes(const std::string &path, bool useDefault = true);
OffscreenSurface *add(const std::string &path);
OffscreenSurface *addSkinRes(const std::string &path, bool useDefault = true);
void del(const std::string &path);
void clear();
void move(const std::string &from, const std::string &to);
bool exists(const std::string &path);
Surface *operator[](const std::string &);
Surface *skinRes(const std::string &key, bool useDefault = true);
OffscreenSurface *operator[](const std::string &);
OffscreenSurface *skinRes(const std::string &key, bool useDefault = true);
private:
SurfaceHash surfaces;