@@ -15,20 +15,22 @@
#include "32bpp_optimized.hpp"
/** The optimised 32 bpp blitter with palette animation. */
class Blitter_32bppAnim : public Blitter_32bppOptimized {
protected:
uint16 *anim_buf; ///< In this buffer we keep track of the 8bpp indexes so we can do palette animation
void *anim_alloc; ///< The raw allocated buffer, not necessarily aligned correctly
int anim_buf_width; ///< The width of the animation buffer.
int anim_buf_height; ///< The height of the animation buffer.
int anim_buf_pitch; ///< The pitch of the animation buffer.
int anim_buf_pitch; ///< The pitch of the animation buffer (width rounded up to 16 byte boundary).
Palette palette; ///< The current palette.
public:
Blitter_32bppAnim() :
anim_buf(NULL),
anim_alloc(NULL),
anim_buf_width(0),
anim_buf_height(0),
anim_buf_pitch(0)
{
this->palette = _cur_palette;
}
@@ -55,12 +57,21 @@ public:
*/
inline Colour LookupColourInPalette(uint index)
return this->palette.palette[index];
inline int ScreenToAnimOffset(const uint32 *video)
int raw_offset = video - (const uint32 *)_screen.dst_ptr;
if (_screen.pitch == this->anim_buf_pitch) return raw_offset;
int lines = raw_offset / _screen.pitch;
int across = raw_offset % _screen.pitch;
return across + (lines * this->anim_buf_pitch);
template <BlitterMode mode> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
};
/** Factory for the 32bpp blitter with animation. */
class FBlitter_32bppAnim : public BlitterFactory {