diff options
-rw-r--r-- | src/blitter/32bpp_optimized.cpp | 23 | ||||
-rw-r--r-- | src/blitter/32bpp_optimized.hpp | 3 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/blitter/32bpp_optimized.cpp b/src/blitter/32bpp_optimized.cpp index c0958b0e9..b113ed0dc 100644 --- a/src/blitter/32bpp_optimized.cpp +++ b/src/blitter/32bpp_optimized.cpp @@ -10,7 +10,7 @@ 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; 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 *dest_sprite; diff --git a/src/blitter/32bpp_optimized.hpp b/src/blitter/32bpp_optimized.hpp index 46c30ec25..099aaa159 100644 --- a/src/blitter/32bpp_optimized.hpp +++ b/src/blitter/32bpp_optimized.hpp @@ -14,6 +14,9 @@ public: /* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator); /* 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> { |