Changeset - r9486:b23cca773133
[Not reviewed]
master
0 2 0
smatz - 16 years ago 2008-06-10 17:28:37
smatz@openttd.org
(svn r13445) -Codechange: make 32bpp_optimized blitter ~10-20% faster in drawing (depends on architecture and compiler)
2 files changed with 25 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/blitter/32bpp_optimized.cpp
Show inline comments
 
@@ -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(Blitte
 
	}
 
}
 

	
 
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;
src/blitter/32bpp_optimized.hpp
Show inline comments
 
@@ -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> {
0 comments (0 inline, 0 general)