mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r13445) -Codechange: make 32bpp_optimized blitter ~10-20% faster in drawing (depends on architecture and compiler)
This commit is contained in:
parent
199b3d7886
commit
4ce73a679c
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
static FBlitter_32bppOptimized iFBlitter_32bppOptimized;
|
static FBlitter_32bppOptimized iFBlitter_32bppOptimized;
|
||||||
|
|
||||||
void Blitter_32bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
template <BlitterMode mode, ZoomLevel zoom> inline void Blitter_32bppOptimized::Draw(Blitter::BlitterParams *bp)
|
||||||
{
|
{
|
||||||
const SpriteLoader::CommonPixel *src, *src_line;
|
const SpriteLoader::CommonPixel *src, *src_line;
|
||||||
uint32 *dst, *dst_line;
|
uint32 *dst, *dst_line;
|
||||||
@ -66,6 +66,27 @@ void Blitter_32bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <BlitterMode mode> inline void Blitter_32bppOptimized::Draw(Blitter::BlitterParams *bp, ZoomLevel zoom)
|
||||||
|
{
|
||||||
|
switch (zoom) {
|
||||||
|
default: NOT_REACHED();
|
||||||
|
case ZOOM_LVL_NORMAL: Draw<mode, ZOOM_LVL_NORMAL>(bp); return;
|
||||||
|
case ZOOM_LVL_OUT_2X: Draw<mode, ZOOM_LVL_OUT_2X>(bp); return;
|
||||||
|
case ZOOM_LVL_OUT_4X: Draw<mode, ZOOM_LVL_OUT_4X>(bp); return;
|
||||||
|
case ZOOM_LVL_OUT_8X: Draw<mode, ZOOM_LVL_OUT_8X>(bp); return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Blitter_32bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
||||||
|
{
|
||||||
|
switch (mode) {
|
||||||
|
default: NOT_REACHED();
|
||||||
|
case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return;
|
||||||
|
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return;
|
||||||
|
case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
||||||
{
|
{
|
||||||
Sprite *dest_sprite;
|
Sprite *dest_sprite;
|
||||||
|
@ -14,6 +14,9 @@ public:
|
|||||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||||
|
|
||||||
/* virtual */ const char *GetName() { return "32bpp-optimized"; }
|
/* virtual */ const char *GetName() { return "32bpp-optimized"; }
|
||||||
|
|
||||||
|
template <BlitterMode mode, ZoomLevel zoom> void Draw(Blitter::BlitterParams *bp);
|
||||||
|
template <BlitterMode mode> void Draw(Blitter::BlitterParams *bp, ZoomLevel zoom);
|
||||||
};
|
};
|
||||||
|
|
||||||
class FBlitter_32bppOptimized: public BlitterFactory<FBlitter_32bppOptimized> {
|
class FBlitter_32bppOptimized: public BlitterFactory<FBlitter_32bppOptimized> {
|
||||||
|
Loading…
Reference in New Issue
Block a user