OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

32bpp_anim.hpp
Go to the documentation of this file.
1 /* $Id: 32bpp_anim.hpp 27796 2017-03-18 17:14:53Z frosch $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
9
12 #ifndef BLITTER_32BPP_ANIM_HPP
13 #define BLITTER_32BPP_ANIM_HPP
14
15 #include "32bpp_optimized.hpp"
16
18 class Blitter_32bppAnim : public Blitter_32bppOptimized {
19 protected:
20 uint16 *anim_buf;
21 int anim_buf_width;
22 int anim_buf_height;
23 int anim_buf_pitch;
24 Palette palette;
25
26 public:
27 Blitter_32bppAnim() :
28 anim_buf(NULL),
29 anim_buf_width(0),
30 anim_buf_height(0),
31 anim_buf_pitch(0)
32 {
33 this->palette = _cur_palette;
34 }
35
36 ~Blitter_32bppAnim();
37
38 /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
39 /* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
40 /* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
41 /* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
42 /* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
43 /* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);
44 /* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y);
45 /* virtual */ int BufferSize(int width, int height);
46 /* virtual */ void PaletteAnimate(const Palette &palette);
47 /* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
48
49 /* virtual */ const char *GetName() { return "32bpp-anim"; }
50 /* virtual */ int GetBytesPerPixel() { return 6; }
51 /* virtual */ void PostResize();
52
56 inline Colour LookupColourInPalette(uint index)
57 {
58 return this->palette.palette[index];
59 }
60
61 template <BlitterMode mode> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
62 };
63
65 class FBlitter_32bppAnim : public BlitterFactory {
66 public:
67 FBlitter_32bppAnim() : BlitterFactory("32bpp-anim", "32bpp Animation Blitter (palette animation)") {}
68 /* virtual */ Blitter *CreateInstance() { return new Blitter_32bppAnim(); }
69 };
70
71 #endif /* BLITTER_32BPP_ANIM_HPP */