diff options
author | smatz <smatz@openttd.org> | 2008-06-21 20:58:34 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-06-21 20:58:34 +0000 |
commit | 6cb9d3802de2a332efec8124ecb3a807eed72270 (patch) | |
tree | b718988dd27389c460132e0db1f949cf4fae68eb /src/blitter/8bpp_optimized.cpp | |
parent | d4a4075dc69fc5eb7c92084a456aa65e880e583a (diff) | |
download | openttd-6cb9d3802de2a332efec8124ecb3a807eed72270.tar.xz |
(svn r13602) -Codechange: little speedup for 8bpp-optimized blitter
Diffstat (limited to 'src/blitter/8bpp_optimized.cpp')
-rw-r--r-- | src/blitter/8bpp_optimized.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/blitter/8bpp_optimized.cpp b/src/blitter/8bpp_optimized.cpp index 3fb20e74b..656f910f2 100644 --- a/src/blitter/8bpp_optimized.cpp +++ b/src/blitter/8bpp_optimized.cpp @@ -71,24 +71,28 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z /* Skip transparent pixels */ dst += trans; width -= trans; - if (width <= 0) continue; + if (width <= 0 || pixels == 0) continue; pixels = min<uint>(pixels, (uint)width); width -= pixels; switch (mode) { - case BM_COLOUR_REMAP: - for (uint x = 0; x < pixels; x++) { - if (bp->remap[*src] != 0) *dst = bp->remap[*src]; + case BM_COLOUR_REMAP: { + const uint8 *remap = bp->remap; + do { + uint m = remap[*src]; + if (m != 0) *dst = m; dst++; src++; - } - break; + } while (--pixels != 0); + } break; - case BM_TRANSPARENT: - for (uint x = 0; x < pixels; x++) { - *dst = bp->remap[*dst]; - dst++; src++; - } - break; + case BM_TRANSPARENT: { + const uint8 *remap = bp->remap; + src += pixels; + do { + *dst = remap[*dst]; + dst++; + } while (--pixels != 0); + } break; default: memcpy(dst, src, pixels); |