summaryrefslogtreecommitdiff
path: root/src/blitter/32bpp_anim.cpp
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-09-09 23:16:01 +0000
committertruelight <truelight@openttd.org>2007-09-09 23:16:01 +0000
commit34e48f788684ce4e1d41adc1b05037beb3a78e13 (patch)
treefe46e704df372bfa17f9bda4128052013ebf40ab /src/blitter/32bpp_anim.cpp
parent89bdfaacd93f543a72c37adbb277531f5e39482c (diff)
downloadopenttd-34e48f788684ce4e1d41adc1b05037beb3a78e13.tar.xz
(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
Diffstat (limited to 'src/blitter/32bpp_anim.cpp')
-rw-r--r--src/blitter/32bpp_anim.cpp31
1 files changed, 20 insertions, 11 deletions
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++;