Blitter: Change some informational virtual functions to member values
This commit is contained in:
@@ -18,7 +18,11 @@
|
||||
/** Base for all 32bpp blitters. */
|
||||
class Blitter_32bppBase : public Blitter {
|
||||
public:
|
||||
uint8 GetScreenDepth() override { return 32; }
|
||||
Blitter_32bppBase()
|
||||
{
|
||||
this->SetScreenDepth(32);
|
||||
}
|
||||
|
||||
void *MoveTo(void *video, int x, int y) override;
|
||||
void SetPixel(void *video, int x, int y, uint8 colour) override;
|
||||
void SetPixel32(void *video, int x, int y, uint8 colour, uint32 colour32) override;
|
||||
|
||||
@@ -15,7 +15,11 @@
|
||||
/** Base for all 8bpp blitters. */
|
||||
class Blitter_8bppBase : public Blitter {
|
||||
public:
|
||||
uint8 GetScreenDepth() override { return 8; }
|
||||
Blitter_8bppBase()
|
||||
{
|
||||
this->SetScreenDepth(8);
|
||||
}
|
||||
|
||||
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
|
||||
void *MoveTo(void *video, int x, int y) override;
|
||||
void SetPixel(void *video, int x, int y, uint8 colour) override;
|
||||
|
||||
@@ -44,6 +44,15 @@ DECLARE_ENUM_AS_BIT_SET(BlitterSpriteFlags);
|
||||
* How all blitters should look like. Extend this class to make your own.
|
||||
*/
|
||||
class Blitter : public SpriteEncoder {
|
||||
uint8 screen_depth = 0;
|
||||
|
||||
protected:
|
||||
void SetScreenDepth(uint8 depth)
|
||||
{
|
||||
this->screen_depth = depth;
|
||||
this->SetIs32BppSupported(depth > 8);
|
||||
}
|
||||
|
||||
public:
|
||||
/** Parameters related to blitting. */
|
||||
struct BlitterParams {
|
||||
@@ -75,11 +84,9 @@ public:
|
||||
* Get the screen depth this blitter works for.
|
||||
* This is either: 8, 16, 24 or 32.
|
||||
*/
|
||||
virtual uint8 GetScreenDepth() = 0;
|
||||
|
||||
bool Is32BppSupported() override
|
||||
inline uint8 GetScreenDepth() const
|
||||
{
|
||||
return this->GetScreenDepth() > 8;
|
||||
return this->screen_depth;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,11 @@
|
||||
/** Blitter that does nothing. */
|
||||
class Blitter_Null : public Blitter {
|
||||
public:
|
||||
uint8 GetScreenDepth() override { return 0; }
|
||||
Blitter_Null()
|
||||
{
|
||||
this->SetScreenDepth(0);
|
||||
}
|
||||
|
||||
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override {};
|
||||
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override {};
|
||||
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
|
||||
|
||||
Reference in New Issue
Block a user