summaryrefslogtreecommitdiff
path: root/src/spriteloader
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-01-16 16:43:27 +0100
committerMichael Lutz <michi@icosahedron.de>2021-02-22 22:16:07 +0100
commit02e874145792670c46205d28e876b01de4cc2348 (patch)
tree9222ca749d6433baeef18f761d475d9b88564e4e /src/spriteloader
parentf94b2e73e118522c29898a77c2de4bd23451e1c7 (diff)
downloadopenttd-02e874145792670c46205d28e876b01de4cc2348.tar.xz
Codechange: Allow for using a sprite encoder that is not the currently active blitter when loading a sprite.
Diffstat (limited to 'src/spriteloader')
-rw-r--r--src/spriteloader/spriteloader.hpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/spriteloader/spriteloader.hpp b/src/spriteloader/spriteloader.hpp
index 012263171..5a37abc2d 100644
--- a/src/spriteloader/spriteloader.hpp
+++ b/src/spriteloader/spriteloader.hpp
@@ -13,6 +13,9 @@
#include "../core/alloc_type.hpp"
#include "../gfx_type.h"
+struct Sprite;
+typedef void *AllocatorProc(size_t size);
+
/** Interface for the loader of our sprites. */
class SpriteLoader {
public:
@@ -64,4 +67,20 @@ public:
virtual ~SpriteLoader() { }
};
+/** Interface for something that can encode a sprite. */
+class SpriteEncoder {
+public:
+
+ virtual ~SpriteEncoder() { }
+
+ /**
+ * Can the sprite encoder make use of RGBA sprites?
+ */
+ virtual bool Is32BppSupported() = 0;
+
+ /**
+ * Convert a sprite from the loader to our own format.
+ */
+ virtual Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) = 0;
+};
#endif /* SPRITELOADER_HPP */