aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/picture.h
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-18 20:29:14 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commitbd86fd7bbf19324e06834ee8f2e08e7e0df02e14 (patch)
tree825c11b8f6f7c1f51c4e3cfd8954cda1502f57be /engines/glk/picture.h
parent0f0b8ae3b72d066259332a728eab1edc760de5df (diff)
downloadscummvm-rg350-bd86fd7bbf19324e06834ee8f2e08e7e0df02e14.tar.gz
scummvm-rg350-bd86fd7bbf19324e06834ee8f2e08e7e0df02e14.tar.bz2
scummvm-rg350-bd86fd7bbf19324e06834ee8f2e08e7e0df02e14.zip
GLK: Implementing picture loading
Diffstat (limited to 'engines/glk/picture.h')
-rw-r--r--engines/glk/picture.h92
1 files changed, 80 insertions, 12 deletions
diff --git a/engines/glk/picture.h b/engines/glk/picture.h
index 3ca615b84f..ca4f9995c8 100644
--- a/engines/glk/picture.h
+++ b/engines/glk/picture.h
@@ -23,20 +23,15 @@
#ifndef GLK_PICTURE_H
#define GLK_PICTURE_H
-#include "graphics/surface.h"
+#include "common/array.h"
+#include "graphics/managed_surface.h"
namespace Glk {
-class PicList {
-public:
- void increment();
-
- void decrement();
-};
-
-struct Picture : Graphics::Surface {
-public:
- static Picture *load(uint32 id);
+/**
+ * Picture/image class
+ */
+struct Picture : Graphics::ManagedSurface {
public:
int _refCount;
uint32 _id;
@@ -45,7 +40,7 @@ public:
/**
* Constructor
*/
- Picture() : Graphics::Surface(), _refCount(0), _id(0), _scaled(0) {}
+ Picture() : Graphics::ManagedSurface(), _refCount(0), _id(0), _scaled(0) {}
/**
* Increment reference counter
@@ -68,6 +63,79 @@ public:
void drawPicture(int x0, int y0, int dx0, int dy0, int dx1, int dy1);
};
+/**
+ * Picture entry in the in-memory store
+ */
+struct PictureEntry {
+ Picture *_picture;
+ Picture *_scaled;
+ PictureEntry() : _picture(nullptr), _scaled(nullptr) {}
+};
+
+/**
+ * Pictures manager
+ */
+class Pictures {
+private:
+ int _refCount;
+ Common::Array<PictureEntry> _store;
+private:
+ /**
+ * Stores an original picture in the store
+ */
+ void storeOriginal(Picture *pic);
+
+ /**
+ * Stores a scaled picture in the store
+ */
+ void storeScaled(Picture *pic);
+public:
+ /**
+ * Constructor
+ */
+ Pictures() : _refCount(0) {}
+
+ /**
+ * Destructor
+ */
+ ~Pictures() { clear(); }
+
+ /**
+ * Clear the picture list
+ */
+ void clear();
+
+ /**
+ * Increments the count of the number of pictures in use
+ */
+ void increment();
+
+ /**
+ * Decrements the count of the number of pictures in use
+ */
+ void decrement();
+
+ /**
+ * Searches for an existing picture entry
+ */
+ PictureEntry *search(uint id);
+
+ /**
+ * Stores a picture in the store
+ */
+ void store(Picture *pic);
+
+ /**
+ * Retrieves a picture from the store
+ */
+ Picture *retrieve(uint id, bool scaled);
+
+ /**
+ * Load a given picture
+ */
+ Picture *load(uint32 id);
+};
+
} // End of namespace Glk
#endif