2007-06-19 17:43:30 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
|
|
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file 32bpp_anim.hpp A 32 bpp blitter with animation support. */
|
2007-06-19 17:43:30 +00:00
|
|
|
|
|
|
|
#ifndef BLITTER_32BPP_ANIM_HPP
|
|
|
|
#define BLITTER_32BPP_ANIM_HPP
|
|
|
|
|
2007-09-09 23:16:01 +00:00
|
|
|
#include "32bpp_optimized.hpp"
|
2007-06-19 17:43:30 +00:00
|
|
|
|
2011-05-01 10:15:33 +00:00
|
|
|
/** The optimised 32 bpp blitter with palette animation. */
|
2014-01-02 23:52:13 +00:00
|
|
|
class Blitter_32bppAnim : public Blitter_32bppOptimized {
|
|
|
|
protected:
|
2011-12-24 23:33:45 +00:00
|
|
|
uint16 *anim_buf; ///< In this buffer we keep track of the 8bpp indexes so we can do palette animation
|
2011-05-01 10:15:33 +00:00
|
|
|
int anim_buf_width; ///< The width of the animation buffer.
|
|
|
|
int anim_buf_height; ///< The height of the animation buffer.
|
2011-12-08 19:37:33 +00:00
|
|
|
Palette palette; ///< The current palette.
|
2007-06-19 17:43:30 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
Blitter_32bppAnim() :
|
|
|
|
anim_buf(NULL),
|
|
|
|
anim_buf_width(0),
|
|
|
|
anim_buf_height(0)
|
|
|
|
{}
|
|
|
|
|
2016-05-22 10:28:57 +00:00
|
|
|
~Blitter_32bppAnim();
|
|
|
|
|
2007-06-19 17:43:30 +00:00
|
|
|
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
2010-01-21 01:44:51 +00:00
|
|
|
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
|
2009-02-09 02:57:15 +00:00
|
|
|
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
|
|
|
|
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
|
2007-06-21 12:36:46 +00:00
|
|
|
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
|
|
|
|
/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);
|
2007-06-19 17:43:30 +00:00
|
|
|
/* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y);
|
2007-06-21 13:31:41 +00:00
|
|
|
/* virtual */ int BufferSize(int width, int height);
|
2011-12-08 19:37:33 +00:00
|
|
|
/* virtual */ void PaletteAnimate(const Palette &palette);
|
2007-06-19 17:43:30 +00:00
|
|
|
/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
|
2007-06-21 13:56:59 +00:00
|
|
|
|
|
|
|
/* virtual */ const char *GetName() { return "32bpp-anim"; }
|
2012-01-03 10:50:06 +00:00
|
|
|
/* virtual */ int GetBytesPerPixel() { return 6; }
|
2010-01-04 02:32:36 +00:00
|
|
|
/* virtual */ void PostResize();
|
2008-06-26 15:46:19 +00:00
|
|
|
|
2011-12-08 19:37:33 +00:00
|
|
|
/**
|
|
|
|
* Look up the colour in the current palette.
|
|
|
|
*/
|
2012-04-10 20:16:51 +00:00
|
|
|
inline Colour LookupColourInPalette(uint index)
|
2011-12-08 19:37:33 +00:00
|
|
|
{
|
2012-04-10 20:16:51 +00:00
|
|
|
return this->palette.palette[index];
|
2011-12-08 19:37:33 +00:00
|
|
|
}
|
|
|
|
|
2008-06-26 15:46:19 +00:00
|
|
|
template <BlitterMode mode> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
|
2007-06-19 17:43:30 +00:00
|
|
|
};
|
|
|
|
|
2011-05-01 10:15:33 +00:00
|
|
|
/** Factory for the 32bpp blitter with animation. */
|
2014-01-02 22:41:58 +00:00
|
|
|
class FBlitter_32bppAnim : public BlitterFactory {
|
2007-06-19 17:43:30 +00:00
|
|
|
public:
|
2014-01-02 22:41:58 +00:00
|
|
|
FBlitter_32bppAnim() : BlitterFactory("32bpp-anim", "32bpp Animation Blitter (palette animation)") {}
|
2007-06-19 17:43:30 +00:00
|
|
|
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppAnim(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* BLITTER_32BPP_ANIM_HPP */
|