From 34e48f788684ce4e1d41adc1b05037beb3a78e13 Mon Sep 17 00:00:00 2001 From: truelight Date: Sun, 9 Sep 2007 23:16:01 +0000 Subject: (svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch) -Add: let 32bpp-anim use 32bpp-optimizeds, so he profits from the speed-up too --- src/blitter/32bpp_anim.cpp | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'src/blitter/32bpp_anim.cpp') diff --git a/src/blitter/32bpp_anim.cpp b/src/blitter/32bpp_anim.cpp index 7f8fe7651..f3f60b337 100644 --- a/src/blitter/32bpp_anim.cpp +++ b/src/blitter/32bpp_anim.cpp @@ -38,11 +38,24 @@ void Blitter_32bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL anim_line += this->anim_buf_width; for (int x = 0; x < bp->width; x++) { + if (src->a == 0) { + /* src->r is 'misused' here to indicate how much more pixels are following with an alpha of 0 */ + int skip = UnScaleByZoom(src->r, zoom); + + dst += skip; + /* Make sure the anim-buffer is cleared */ + memset(anim, 0, skip); + anim += skip; + x += skip - 1; + src += ScaleByZoom(1, zoom) * skip; + continue; + } + switch (mode) { case BM_COLOUR_REMAP: /* In case the m-channel is zero, do not remap this pixel in any way */ if (src->m == 0) { - if (src->a != 0) *dst = ComposeColourRGBA(src->r, src->g, src->b, src->a, *dst); + *dst = ComposeColourRGBA(src->r, src->g, src->b, src->a, *dst); *anim = 0; } else { if (bp->remap[src->m] != 0) { @@ -58,19 +71,15 @@ void Blitter_32bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL * we produce a result the newgrf maker didn't expect ;) */ /* Make the current color a bit more black, so it looks like this image is transparent */ - if (src->a != 0) { - *dst = MakeTransparent(*dst, 192); - *anim = bp->remap[*anim]; - } + *dst = MakeTransparent(*dst, 192); + *anim = bp->remap[*anim]; break; default: - if (src->a != 0) { - /* Above 217 is palette animation */ - if (src->m >= 217) *dst = ComposeColourPA(this->LookupColourInPalette(src->m), src->a, *dst); - else *dst = ComposeColourRGBA(src->r, src->g, src->b, src->a, *dst); - *anim = src->m; - } + /* Above 217 is palette animation */ + if (src->m >= 217) *dst = ComposeColourPA(this->LookupColourInPalette(src->m), src->a, *dst); + else *dst = ComposeColourRGBA(src->r, src->g, src->b, src->a, *dst); + *anim = src->m; break; } dst++; -- cgit v1.2.3-54-g00ecf