Codechange: Allow for using a sprite encoder that is not the currently active blitter when loading a sprite.

This commit is contained in:
Michael Lutz
2021-01-16 16:43:27 +01:00
parent f94b2e73e1
commit 02e8741457
4 changed files with 41 additions and 16 deletions

View File

@@ -25,7 +25,7 @@ enum BlitterMode {
/**
* How all blitters should look like. Extend this class to make your own.
*/
class Blitter {
class Blitter : public SpriteEncoder {
public:
/** Parameters related to blitting. */
struct BlitterParams {
@@ -58,6 +58,11 @@ public:
*/
virtual uint8 GetScreenDepth() = 0;
bool Is32BppSupported() override
{
return this->GetScreenDepth() > 8;
}
/**
* Draw an image to the screen, given an amount of params defined above.
*/
@@ -74,11 +79,6 @@ public:
*/
virtual void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) = 0;
/**
* Convert a sprite from the loader to our own format.
*/
virtual Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) = 0;
/**
* Move the destination pointer the requested amount x and y, keeping in mind
* any pitch and bpp of the renderer.