mirror of https://github.com/OpenTTD/OpenTTD
(svn r21782) -Codechange: Move declaration of AllocatorProc from Blitter:: to spritecache.h
parent
09d7f172a6
commit
3d1008318b
|
@ -21,7 +21,7 @@ public:
|
||||||
/* virtual */ uint8 GetScreenDepth() { return 32; }
|
/* virtual */ uint8 GetScreenDepth() { return 32; }
|
||||||
// /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
// /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||||
// /* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
|
// /* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
|
||||||
// /* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
// /* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||||
/* virtual */ void *MoveTo(const void *video, int x, int y);
|
/* virtual */ void *MoveTo(const void *video, int x, int y);
|
||||||
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
|
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
|
||||||
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
|
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
|
||||||
|
|
|
@ -255,7 +255,7 @@ static const SpriteLoader::Sprite *ResizeSprite(const SpriteLoader::Sprite *spri
|
||||||
return sprite;
|
return sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||||
{
|
{
|
||||||
/* streams of pixels (a, r, g, b channels)
|
/* streams of pixels (a, r, g, b channels)
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||||
|
|
||||||
/* virtual */ const char *GetName() { return "32bpp-optimized"; }
|
/* virtual */ const char *GetName() { return "32bpp-optimized"; }
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ void Blitter_32bppSimple::DrawColourMappingRect(void *dst, int width, int height
|
||||||
DEBUG(misc, 0, "32bpp blitter doesn't know how to draw this colour table ('%d')", pal);
|
DEBUG(misc, 0, "32bpp blitter doesn't know how to draw this colour table ('%d')", pal);
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite *Blitter_32bppSimple::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
Sprite *Blitter_32bppSimple::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||||
{
|
{
|
||||||
Sprite *dest_sprite;
|
Sprite *dest_sprite;
|
||||||
SpriteLoader::CommonPixel *dst;
|
SpriteLoader::CommonPixel *dst;
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Blitter_32bppSimple : public Blitter_32bppBase {
|
||||||
public:
|
public:
|
||||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||||
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
|
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
|
||||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||||
|
|
||||||
/* virtual */ const char *GetName() { return "32bpp-simple"; }
|
/* virtual */ const char *GetName() { return "32bpp-simple"; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
/* virtual */ uint8 GetScreenDepth() { return 8; }
|
/* virtual */ uint8 GetScreenDepth() { return 8; }
|
||||||
// /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
// /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||||
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
|
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
|
||||||
// /* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
// /* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||||
/* virtual */ void *MoveTo(const void *video, int x, int y);
|
/* virtual */ void *MoveTo(const void *video, int x, int y);
|
||||||
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
|
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
|
||||||
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
|
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
|
||||||
|
|
|
@ -41,7 +41,7 @@ void Blitter_8bppDebug::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite *Blitter_8bppDebug::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
Sprite *Blitter_8bppDebug::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||||
{
|
{
|
||||||
Sprite *dest_sprite;
|
Sprite *dest_sprite;
|
||||||
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width);
|
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
class Blitter_8bppDebug : public Blitter_8bppBase {
|
class Blitter_8bppDebug : public Blitter_8bppBase {
|
||||||
public:
|
public:
|
||||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||||
|
|
||||||
/* virtual */ const char *GetName() { return "8bpp-debug"; }
|
/* virtual */ const char *GetName() { return "8bpp-debug"; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -110,7 +110,7 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite *Blitter_8bppOptimized::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
Sprite *Blitter_8bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||||
{
|
{
|
||||||
/* Make memory for all zoom-levels */
|
/* Make memory for all zoom-levels */
|
||||||
uint memory = sizeof(SpriteData);
|
uint memory = sizeof(SpriteData);
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||||
|
|
||||||
/* virtual */ const char *GetName() { return "8bpp-optimized"; }
|
/* virtual */ const char *GetName() { return "8bpp-optimized"; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,7 +54,7 @@ void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite *Blitter_8bppSimple::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
Sprite *Blitter_8bppSimple::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||||
{
|
{
|
||||||
Sprite *dest_sprite;
|
Sprite *dest_sprite;
|
||||||
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width);
|
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
class Blitter_8bppSimple : public Blitter_8bppBase {
|
class Blitter_8bppSimple : public Blitter_8bppBase {
|
||||||
public:
|
public:
|
||||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||||
|
|
||||||
/* virtual */ const char *GetName() { return "8bpp-simple"; }
|
/* virtual */ const char *GetName() { return "8bpp-simple"; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,8 +46,6 @@ public:
|
||||||
PALETTE_ANIMATION_BLITTER, ///< The blitter takes care of the palette animation
|
PALETTE_ANIMATION_BLITTER, ///< The blitter takes care of the palette animation
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void *AllocatorProc(size_t size);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the screen depth this blitter works for.
|
* Get the screen depth this blitter works for.
|
||||||
* This is either: 8, 16, 24 or 32.
|
* This is either: 8, 16, 24 or 32.
|
||||||
|
@ -73,7 +71,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Convert a sprite from the loader to our own format.
|
* Convert a sprite from the loader to our own format.
|
||||||
*/
|
*/
|
||||||
virtual Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator) = 0;
|
virtual Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the destination pointer the requested amount x and y, keeping in mind
|
* Move the destination pointer the requested amount x and y, keeping in mind
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
static FBlitter_Null iFBlitter_Null;
|
static FBlitter_Null iFBlitter_Null;
|
||||||
|
|
||||||
Sprite *Blitter_Null::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
Sprite *Blitter_Null::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||||
{
|
{
|
||||||
Sprite *dest_sprite;
|
Sprite *dest_sprite;
|
||||||
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite));
|
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite));
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
/* virtual */ uint8 GetScreenDepth() { return 0; }
|
/* virtual */ uint8 GetScreenDepth() { return 0; }
|
||||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) {};
|
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) {};
|
||||||
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) {};
|
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) {};
|
||||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||||
/* virtual */ void *MoveTo(const void *video, int x, int y) { return NULL; };
|
/* virtual */ void *MoveTo(const void *video, int x, int y) { return NULL; };
|
||||||
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour) {};
|
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour) {};
|
||||||
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour) {};
|
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour) {};
|
||||||
|
|
|
@ -25,6 +25,8 @@ struct Sprite {
|
||||||
|
|
||||||
extern uint _sprite_cache_size;
|
extern uint _sprite_cache_size;
|
||||||
|
|
||||||
|
typedef void *AllocatorProc(size_t size);
|
||||||
|
|
||||||
void *GetRawSprite(SpriteID sprite, SpriteType type);
|
void *GetRawSprite(SpriteID sprite, SpriteType type);
|
||||||
bool SpriteExists(SpriteID sprite);
|
bool SpriteExists(SpriteID sprite);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue