2007-12-17 01:35:45 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file 32bpp_anim.cpp Implementation of the optimized 32 bpp blitter with animation support. */
|
|
|
|
|
2007-06-19 17:43:30 +00:00
|
|
|
#include "../stdafx.h"
|
2007-12-25 09:48:53 +00:00
|
|
|
#include "../core/alloc_func.hpp"
|
2008-06-18 13:11:02 +00:00
|
|
|
#include "../core/math_func.hpp"
|
2007-12-23 10:56:02 +00:00
|
|
|
#include "../gfx_func.h"
|
|
|
|
#include "../zoom_func.h"
|
2007-06-19 17:43:30 +00:00
|
|
|
#include "../debug.h"
|
2007-07-05 12:23:54 +00:00
|
|
|
#include "../video/video_driver.hpp"
|
2007-06-19 17:43:30 +00:00
|
|
|
#include "32bpp_anim.hpp"
|
|
|
|
|
2008-01-13 01:21:35 +00:00
|
|
|
#include "../table/sprites.h"
|
|
|
|
|
2007-06-19 17:43:30 +00:00
|
|
|
static FBlitter_32bppAnim iFBlitter_32bppAnim;
|
|
|
|
|
2008-06-26 15:46:19 +00:00
|
|
|
template <BlitterMode mode>
|
|
|
|
inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
|
2007-06-19 17:43:30 +00:00
|
|
|
{
|
2008-06-26 15:46:19 +00:00
|
|
|
const SpriteData *src = (const SpriteData *)bp->sprite;
|
2007-09-10 00:05:27 +00:00
|
|
|
|
2008-06-26 15:46:19 +00:00
|
|
|
const Colour *src_px = (const Colour *)(src->data + src->offset[zoom][0]);
|
|
|
|
const uint8 *src_n = (const uint8 *)(src->data + src->offset[zoom][1]);
|
2007-06-19 17:43:30 +00:00
|
|
|
|
2008-06-26 15:46:19 +00:00
|
|
|
for (uint i = bp->skip_top; i != 0; i--) {
|
|
|
|
src_px = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
|
|
|
|
src_n += *(const uint32 *)src_n;
|
2007-06-19 17:43:30 +00:00
|
|
|
}
|
|
|
|
|
2008-06-26 15:46:19 +00:00
|
|
|
uint32 *dst = (uint32 *)bp->dst + bp->top * bp->pitch + bp->left;
|
|
|
|
uint8 *anim = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_width + bp->left;
|
|
|
|
|
|
|
|
const byte *remap = bp->remap; // store so we don't have to access it via bp everytime
|
2007-06-19 17:43:30 +00:00
|
|
|
|
|
|
|
for (int y = 0; y < bp->height; y++) {
|
2008-06-26 15:46:19 +00:00
|
|
|
uint32 *dst_ln = dst + bp->pitch;
|
|
|
|
uint8 *anim_ln = anim + this->anim_buf_width;
|
|
|
|
|
|
|
|
const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
|
|
|
|
src_px++;
|
|
|
|
|
|
|
|
const uint8 *src_n_ln = src_n + *(uint32 *)src_n;
|
|
|
|
src_n += 4;
|
|
|
|
|
|
|
|
uint32 *dst_end = dst + bp->skip_left;
|
|
|
|
|
|
|
|
uint n;
|
|
|
|
|
|
|
|
while (dst < dst_end) {
|
|
|
|
n = *src_n++;
|
|
|
|
|
|
|
|
if (src_px->a == 0) {
|
|
|
|
dst += n;
|
|
|
|
src_px ++;
|
|
|
|
src_n++;
|
|
|
|
|
|
|
|
if (dst > dst_end) anim += dst - dst_end;
|
|
|
|
} else {
|
|
|
|
if (dst + n > dst_end) {
|
|
|
|
uint d = dst_end - dst;
|
|
|
|
src_px += d;
|
|
|
|
src_n += d;
|
|
|
|
|
|
|
|
dst = dst_end - bp->skip_left;
|
|
|
|
dst_end = dst + bp->width;
|
|
|
|
|
|
|
|
n = min<uint>(n - d, (uint)bp->width);
|
|
|
|
goto draw;
|
|
|
|
}
|
|
|
|
dst += n;
|
|
|
|
src_px += n;
|
|
|
|
src_n += n;
|
|
|
|
}
|
|
|
|
}
|
2007-06-19 17:43:30 +00:00
|
|
|
|
2008-06-26 15:46:19 +00:00
|
|
|
dst -= bp->skip_left;
|
|
|
|
dst_end -= bp->skip_left;
|
2007-06-19 17:43:30 +00:00
|
|
|
|
2008-06-26 15:46:19 +00:00
|
|
|
dst_end += bp->width;
|
2007-06-19 17:43:30 +00:00
|
|
|
|
2008-06-26 15:46:19 +00:00
|
|
|
while (dst < dst_end) {
|
|
|
|
n = min<uint>(*src_n++, (uint)(dst_end - dst));
|
2007-09-09 23:16:01 +00:00
|
|
|
|
2008-06-26 15:46:19 +00:00
|
|
|
if (src_px->a == 0) {
|
|
|
|
anim += n;
|
|
|
|
dst += n;
|
|
|
|
src_px++;
|
|
|
|
src_n++;
|
2007-09-09 23:16:01 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2008-06-26 15:46:19 +00:00
|
|
|
draw:;
|
|
|
|
|
2007-06-19 17:43:30 +00:00
|
|
|
switch (mode) {
|
|
|
|
case BM_COLOUR_REMAP:
|
2008-06-26 15:46:19 +00:00
|
|
|
if (src_px->a == 255) {
|
|
|
|
do {
|
|
|
|
uint m = *src_n;
|
|
|
|
/* In case the m-channel is zero, do not remap this pixel in any way */
|
|
|
|
if (m == 0) {
|
|
|
|
*dst = *src_px;
|
|
|
|
*anim = 0;
|
|
|
|
} else {
|
|
|
|
uint r = remap[m];
|
|
|
|
*anim = r;
|
|
|
|
if (r != 0) *dst = this->LookupColourInPalette(r);
|
|
|
|
}
|
|
|
|
anim++;
|
|
|
|
dst++;
|
|
|
|
src_px++;
|
|
|
|
src_n++;
|
|
|
|
} while (--n != 0);
|
2007-06-19 17:43:30 +00:00
|
|
|
} else {
|
2008-06-26 15:46:19 +00:00
|
|
|
do {
|
|
|
|
uint m = *src_n;
|
|
|
|
if (m == 0) {
|
|
|
|
*dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst);
|
|
|
|
*anim = 0;
|
|
|
|
} else {
|
|
|
|
uint r = remap[m];
|
|
|
|
*anim = r;
|
|
|
|
if (r != 0) *dst = ComposeColourPANoCheck(this->LookupColourInPalette(r), src_px->a, *dst);
|
|
|
|
}
|
|
|
|
anim++;
|
|
|
|
dst++;
|
|
|
|
src_px++;
|
|
|
|
src_n++;
|
|
|
|
} while (--n != 0);
|
2007-06-19 17:43:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BM_TRANSPARENT:
|
|
|
|
/* TODO -- We make an assumption here that the remap in fact is transparency, not some color.
|
|
|
|
* This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
|
|
|
|
* 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 */
|
2008-06-26 15:46:19 +00:00
|
|
|
src_n += n;
|
2008-06-26 16:47:29 +00:00
|
|
|
if (src_px->a == 255) {
|
|
|
|
src_px += n;
|
|
|
|
do {
|
|
|
|
*dst = MakeTransparent(*dst, 3, 4);
|
|
|
|
*anim = remap[*anim];
|
|
|
|
anim++;
|
|
|
|
dst++;
|
|
|
|
} while (--n != 0);
|
|
|
|
} else {
|
|
|
|
do {
|
|
|
|
*dst = MakeTransparent(*dst, (256 * 4 - src_px->a), 256 * 4);
|
|
|
|
*anim = remap[*anim];
|
|
|
|
anim++;
|
|
|
|
dst++;
|
|
|
|
src_px++;
|
|
|
|
} while (--n != 0);
|
|
|
|
}
|
2007-06-19 17:43:30 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2008-06-26 15:46:19 +00:00
|
|
|
if (src_px->a == 255) {
|
|
|
|
do {
|
|
|
|
/* Compiler assumes pointer aliasing, can't optimise this on its own */
|
|
|
|
uint m = *src_n++;
|
2008-08-08 02:28:28 +00:00
|
|
|
/* Above 217 (PALETTE_ANIM_SIZE_START) is palette animation */
|
2008-06-26 15:46:19 +00:00
|
|
|
*anim++ = m;
|
2008-08-08 02:28:28 +00:00
|
|
|
*dst++ = (m >= PALETTE_ANIM_SIZE_START) ? this->LookupColourInPalette(m) : *src_px;
|
2008-06-26 15:46:19 +00:00
|
|
|
src_px++;
|
|
|
|
} while (--n != 0);
|
|
|
|
} else {
|
|
|
|
do {
|
|
|
|
uint m = *src_n++;
|
|
|
|
*anim++ = m;
|
2008-08-08 02:28:28 +00:00
|
|
|
if (m >= PALETTE_ANIM_SIZE_START) {
|
2008-06-26 15:46:19 +00:00
|
|
|
*dst = ComposeColourPANoCheck(this->LookupColourInPalette(m), src_px->a, *dst);
|
|
|
|
} else {
|
|
|
|
*dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst);
|
|
|
|
}
|
|
|
|
dst++;
|
|
|
|
src_px++;
|
|
|
|
} while (--n != 0);
|
|
|
|
}
|
2007-06-19 17:43:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-06-26 15:46:19 +00:00
|
|
|
|
|
|
|
anim = anim_ln;
|
|
|
|
dst = dst_ln;
|
|
|
|
src_px = src_px_ln;
|
|
|
|
src_n = src_n_ln;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Blitter_32bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
|
|
|
{
|
|
|
|
if (_screen_disable_anim) {
|
|
|
|
/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent Draw() */
|
|
|
|
Blitter_32bppOptimized::Draw(bp, mode, zoom);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_screen.width != this->anim_buf_width || _screen.height != this->anim_buf_height) {
|
|
|
|
/* The size of the screen changed; we can assume we can wipe all data from our buffer */
|
|
|
|
free(this->anim_buf);
|
|
|
|
this->anim_buf = CallocT<uint8>(_screen.width * _screen.height);
|
|
|
|
this->anim_buf_width = _screen.width;
|
|
|
|
this->anim_buf_height = _screen.height;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2007-06-19 17:43:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-21 12:36:46 +00:00
|
|
|
void Blitter_32bppAnim::DrawColorMappingRect(void *dst, int width, int height, int pal)
|
|
|
|
{
|
2008-01-11 17:12:41 +00:00
|
|
|
if (_screen_disable_anim) {
|
|
|
|
/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawColorMappingRect() */
|
|
|
|
Blitter_32bppOptimized::DrawColorMappingRect(dst, width, height, pal);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-06-21 12:36:46 +00:00
|
|
|
uint32 *udst = (uint32 *)dst;
|
|
|
|
uint8 *anim;
|
|
|
|
|
|
|
|
anim = this->anim_buf + ((uint32 *)dst - (uint32 *)_screen.dst_ptr);
|
|
|
|
|
|
|
|
if (pal == PALETTE_TO_TRANSPARENT) {
|
|
|
|
do {
|
|
|
|
for (int i = 0; i != width; i++) {
|
2007-09-09 21:56:52 +00:00
|
|
|
*udst = MakeTransparent(*udst, 154);
|
2007-06-21 12:36:46 +00:00
|
|
|
*anim = 0;
|
|
|
|
udst++;
|
|
|
|
anim++;
|
|
|
|
}
|
|
|
|
udst = udst - width + _screen.pitch;
|
|
|
|
anim = anim - width + this->anim_buf_width;
|
|
|
|
} while (--height);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (pal == PALETTE_TO_STRUCT_GREY) {
|
|
|
|
do {
|
|
|
|
for (int i = 0; i != width; i++) {
|
|
|
|
*udst = MakeGrey(*udst);
|
|
|
|
*anim = 0;
|
|
|
|
udst++;
|
|
|
|
anim++;
|
|
|
|
}
|
|
|
|
udst = udst - width + _screen.pitch;
|
|
|
|
anim = anim - width + this->anim_buf_width;
|
|
|
|
} while (--height);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUG(misc, 0, "32bpp blitter doesn't know how to draw this color table ('%d')", pal);
|
|
|
|
}
|
|
|
|
|
2007-06-19 17:43:30 +00:00
|
|
|
void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8 color)
|
|
|
|
{
|
|
|
|
*((uint32 *)video + x + y * _screen.pitch) = LookupColourInPalette(color);
|
2008-01-11 17:12:41 +00:00
|
|
|
|
|
|
|
/* Set the color in the anim-buffer too, if we are rendering to the screen */
|
|
|
|
if (_screen_disable_anim) return;
|
2007-06-19 17:43:30 +00:00
|
|
|
this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = color;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Blitter_32bppAnim::SetPixelIfEmpty(void *video, int x, int y, uint8 color)
|
|
|
|
{
|
|
|
|
uint32 *dst = (uint32 *)video + x + y * _screen.pitch;
|
|
|
|
if (*dst == 0) {
|
|
|
|
*dst = LookupColourInPalette(color);
|
2008-01-11 17:12:41 +00:00
|
|
|
/* Set the color in the anim-buffer too, if we are rendering to the screen */
|
|
|
|
if (_screen_disable_anim) return;
|
2007-06-19 17:43:30 +00:00
|
|
|
this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 color)
|
|
|
|
{
|
2008-01-11 17:12:41 +00:00
|
|
|
if (_screen_disable_anim) {
|
|
|
|
/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawRect() */
|
|
|
|
Blitter_32bppOptimized::DrawRect(video, width, height, color);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-06-19 17:43:30 +00:00
|
|
|
uint32 color32 = LookupColourInPalette(color);
|
|
|
|
uint8 *anim_line;
|
|
|
|
|
|
|
|
anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
|
|
|
|
|
|
|
|
do {
|
|
|
|
uint32 *dst = (uint32 *)video;
|
|
|
|
uint8 *anim = anim_line;
|
|
|
|
|
|
|
|
for (int i = width; i > 0; i--) {
|
|
|
|
*dst = color32;
|
|
|
|
/* Set the color in the anim-buffer too */
|
|
|
|
*anim = color;
|
|
|
|
dst++;
|
|
|
|
anim++;
|
|
|
|
}
|
|
|
|
video = (uint32 *)video + _screen.pitch;
|
|
|
|
anim_line += this->anim_buf_width;
|
|
|
|
} while (--height);
|
|
|
|
}
|
|
|
|
|
2007-06-21 12:36:46 +00:00
|
|
|
void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width, int height)
|
|
|
|
{
|
2008-01-11 17:12:41 +00:00
|
|
|
assert(!_screen_disable_anim);
|
2007-06-21 12:36:46 +00:00
|
|
|
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
|
|
|
|
uint32 *dst = (uint32 *)video;
|
|
|
|
uint32 *usrc = (uint32 *)src;
|
|
|
|
uint8 *anim_line;
|
|
|
|
|
|
|
|
anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
|
|
|
|
|
|
|
|
for (; height > 0; height--) {
|
|
|
|
memcpy(dst, usrc, width * sizeof(uint32));
|
|
|
|
usrc += width;
|
|
|
|
dst += _screen.pitch;
|
|
|
|
/* Copy back the anim-buffer */
|
|
|
|
memcpy(anim_line, usrc, width * sizeof(uint8));
|
|
|
|
usrc = (uint32 *)((uint8 *)usrc + width);
|
|
|
|
anim_line += this->anim_buf_width;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We update the palette (or the pixels that do animation) immediatly, to avoid graphical glitches */
|
2008-08-23 20:16:54 +00:00
|
|
|
this->PaletteAnimate(PALETTE_ANIM_SIZE_START, (_use_palette == PAL_DOS) ? PALETTE_ANIM_SIZE_DOS : PALETTE_ANIM_SIZE_WIN);
|
2007-06-21 12:36:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, int height)
|
|
|
|
{
|
2008-01-11 17:12:41 +00:00
|
|
|
assert(!_screen_disable_anim);
|
2007-06-21 12:36:46 +00:00
|
|
|
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
|
|
|
|
uint32 *udst = (uint32 *)dst;
|
|
|
|
uint32 *src = (uint32 *)video;
|
|
|
|
uint8 *anim_line;
|
|
|
|
|
2007-06-21 12:45:41 +00:00
|
|
|
if (this->anim_buf == NULL) return;
|
|
|
|
|
2007-06-21 12:36:46 +00:00
|
|
|
anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
|
|
|
|
|
|
|
|
for (; height > 0; height--) {
|
|
|
|
memcpy(udst, src, width * sizeof(uint32));
|
|
|
|
src += _screen.pitch;
|
|
|
|
udst += width;
|
|
|
|
/* Copy the anim-buffer */
|
|
|
|
memcpy(udst, anim_line, width * sizeof(uint8));
|
|
|
|
udst = (uint32 *)((uint8 *)udst + width);
|
|
|
|
anim_line += this->anim_buf_width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-19 17:43:30 +00:00
|
|
|
void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y)
|
|
|
|
{
|
2008-01-11 17:12:41 +00:00
|
|
|
assert(!_screen_disable_anim);
|
|
|
|
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
|
2007-06-19 17:43:30 +00:00
|
|
|
uint8 *dst, *src;
|
|
|
|
|
|
|
|
/* We need to scroll the anim-buffer too */
|
|
|
|
if (scroll_y > 0) {
|
|
|
|
dst = this->anim_buf + left + (top + height - 1) * this->anim_buf_width;
|
|
|
|
src = dst - scroll_y * this->anim_buf_width;
|
|
|
|
|
|
|
|
/* Adjust left & width */
|
|
|
|
if (scroll_x >= 0) dst += scroll_x;
|
|
|
|
else src -= scroll_x;
|
|
|
|
|
|
|
|
uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
|
|
|
|
uint th = height - scroll_y;
|
|
|
|
for (; th > 0; th--) {
|
|
|
|
memcpy(dst, src, tw * sizeof(uint8));
|
|
|
|
src -= this->anim_buf_width;
|
|
|
|
dst -= this->anim_buf_width;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Calculate pointers */
|
|
|
|
dst = this->anim_buf + left + top * this->anim_buf_width;
|
|
|
|
src = dst - scroll_y * this->anim_buf_width;
|
|
|
|
|
|
|
|
/* Adjust left & width */
|
|
|
|
if (scroll_x >= 0) dst += scroll_x;
|
|
|
|
else src -= scroll_x;
|
|
|
|
|
|
|
|
/* the y-displacement may be 0 therefore we have to use memmove,
|
|
|
|
* because source and destination may overlap */
|
|
|
|
uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
|
|
|
|
uint th = height + scroll_y;
|
|
|
|
for (; th > 0; th--) {
|
|
|
|
memmove(dst, src, tw * sizeof(uint8));
|
|
|
|
src += this->anim_buf_width;
|
|
|
|
dst += this->anim_buf_width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Blitter_32bppBase::ScrollBuffer(video, left, top, width, height, scroll_x, scroll_y);
|
|
|
|
}
|
|
|
|
|
2007-06-21 13:31:41 +00:00
|
|
|
int Blitter_32bppAnim::BufferSize(int width, int height)
|
|
|
|
{
|
|
|
|
return width * height * (sizeof(uint32) + sizeof(uint8));
|
|
|
|
}
|
|
|
|
|
2007-06-19 17:43:30 +00:00
|
|
|
void Blitter_32bppAnim::PaletteAnimate(uint start, uint count)
|
|
|
|
{
|
2008-01-11 17:12:41 +00:00
|
|
|
assert(!_screen_disable_anim);
|
2007-06-19 17:43:30 +00:00
|
|
|
|
2007-06-20 12:09:47 +00:00
|
|
|
/* Never repaint the transparency pixel */
|
2008-06-18 13:11:02 +00:00
|
|
|
if (start == 0) {
|
|
|
|
start++;
|
|
|
|
count--;
|
|
|
|
}
|
|
|
|
|
|
|
|
const uint8 *anim = this->anim_buf;
|
|
|
|
uint32 *dst = (uint32 *)_screen.dst_ptr;
|
2007-06-20 12:09:47 +00:00
|
|
|
|
2007-06-19 17:43:30 +00:00
|
|
|
/* Let's walk the anim buffer and try to find the pixels */
|
2008-06-18 13:11:02 +00:00
|
|
|
for (int y = this->anim_buf_height; y != 0 ; y--) {
|
|
|
|
for (int x = this->anim_buf_width; x != 0 ; x--) {
|
|
|
|
uint colour = *anim;
|
|
|
|
if (IsInsideBS(colour, start, count)) {
|
2007-06-19 17:43:30 +00:00
|
|
|
/* Update this pixel */
|
2008-06-18 13:11:02 +00:00
|
|
|
*dst = LookupColourInPalette(colour);
|
2007-06-19 17:43:30 +00:00
|
|
|
}
|
2008-06-18 13:11:02 +00:00
|
|
|
dst++;
|
2007-06-19 17:43:30 +00:00
|
|
|
anim++;
|
|
|
|
}
|
2008-06-18 20:20:12 +00:00
|
|
|
dst += _screen.pitch - this->anim_buf_width;
|
2007-06-19 17:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure the backend redraws the whole screen */
|
2007-07-05 12:23:54 +00:00
|
|
|
_video_driver->MakeDirty(0, 0, _screen.width, _screen.height);
|
2007-06-19 17:43:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Blitter::PaletteAnimation Blitter_32bppAnim::UsePaletteAnimation()
|
|
|
|
{
|
|
|
|
return Blitter::PALETTE_ANIMATION_BLITTER;
|
|
|
|
}
|