diff options
author | rubidium <rubidium@openttd.org> | 2011-12-08 19:37:33 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-12-08 19:37:33 +0000 |
commit | 61625e53c96572528745b79a63ba614b74c8f301 (patch) | |
tree | f748a6f1eb557f7466346597b167607d1ae75413 /src/blitter/32bpp_anim.hpp | |
parent | 8630e97b4f0d078ca492944f383790979b85f8c1 (diff) | |
download | openttd-61625e53c96572528745b79a63ba614b74c8f301.tar.xz |
(svn r23448) -Fix: keep a local copy of the palette in the 32bpp animated blitter so changes of the palette data during the game don't influence drawing (with SDL)
Diffstat (limited to 'src/blitter/32bpp_anim.hpp')
-rw-r--r-- | src/blitter/32bpp_anim.hpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/blitter/32bpp_anim.hpp b/src/blitter/32bpp_anim.hpp index 39a55c514..862a21c5d 100644 --- a/src/blitter/32bpp_anim.hpp +++ b/src/blitter/32bpp_anim.hpp @@ -20,6 +20,7 @@ private: uint8 *anim_buf; ///< In this buffer we keep track of the 8bpp indexes so we can do palette animation int anim_buf_width; ///< The width of the animation buffer. int anim_buf_height; ///< The height of the animation buffer. + Palette palette; ///< The current palette. public: Blitter_32bppAnim() : @@ -36,13 +37,21 @@ public: /* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height); /* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y); /* virtual */ int BufferSize(int width, int height); - /* virtual */ void PaletteAnimate(uint start, uint count); + /* virtual */ void PaletteAnimate(const Palette &palette); /* virtual */ Blitter::PaletteAnimation UsePaletteAnimation(); /* virtual */ const char *GetName() { return "32bpp-anim"; } /* virtual */ int GetBytesPerPixel() { return 5; } /* virtual */ void PostResize(); + /** + * Look up the colour in the current palette. + */ + inline uint32 LookupColourInPalette(uint index) + { + return this->palette.palette[index].data; + } + template <BlitterMode mode> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom); }; |