diff options
Diffstat (limited to 'src/blitter')
-rw-r--r-- | src/blitter/32bpp_anim.cpp | 11 | ||||
-rw-r--r-- | src/blitter/32bpp_anim.hpp | 11 | ||||
-rw-r--r-- | src/blitter/32bpp_base.cpp | 2 | ||||
-rw-r--r-- | src/blitter/32bpp_base.hpp | 2 | ||||
-rw-r--r-- | src/blitter/8bpp_base.cpp | 2 | ||||
-rw-r--r-- | src/blitter/8bpp_base.hpp | 2 | ||||
-rw-r--r-- | src/blitter/base.hpp | 7 | ||||
-rw-r--r-- | src/blitter/null.hpp | 2 |
8 files changed, 24 insertions, 15 deletions
diff --git a/src/blitter/32bpp_anim.cpp b/src/blitter/32bpp_anim.cpp index be8c26f6c..bb14d4608 100644 --- a/src/blitter/32bpp_anim.cpp +++ b/src/blitter/32bpp_anim.cpp @@ -410,14 +410,15 @@ int Blitter_32bppAnim::BufferSize(int width, int height) return width * height * (sizeof(uint32) + sizeof(uint8)); } -void Blitter_32bppAnim::PaletteAnimate(uint start, uint count) +void Blitter_32bppAnim::PaletteAnimate(const Palette &palette) { assert(!_screen_disable_anim); + this->palette = palette; /* Never repaint the transparency pixel */ - if (start == 0) { - start++; - count--; + if (this->palette.first_dirty == 0) { + this->palette.first_dirty++; + this->palette.count_dirty--; } const uint8 *anim = this->anim_buf; @@ -427,7 +428,7 @@ void Blitter_32bppAnim::PaletteAnimate(uint start, uint count) 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)) { + if (IsInsideBS(colour, this->palette.first_dirty, this->palette.count_dirty)) { /* Update this pixel */ *dst = LookupColourInPalette(colour); } 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); }; diff --git a/src/blitter/32bpp_base.cpp b/src/blitter/32bpp_base.cpp index 01b3c7d6e..25f572043 100644 --- a/src/blitter/32bpp_base.cpp +++ b/src/blitter/32bpp_base.cpp @@ -136,7 +136,7 @@ int Blitter_32bppBase::BufferSize(int width, int height) return width * height * sizeof(uint32); } -void Blitter_32bppBase::PaletteAnimate(uint start, uint count) +void Blitter_32bppBase::PaletteAnimate(const Palette &palette) { /* By default, 32bpp doesn't have palette animation */ } diff --git a/src/blitter/32bpp_base.hpp b/src/blitter/32bpp_base.hpp index 5706d39cd..1e7a22aad 100644 --- a/src/blitter/32bpp_base.hpp +++ b/src/blitter/32bpp_base.hpp @@ -28,7 +28,7 @@ public: /* virtual */ void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch); /* 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 */ int GetBytesPerPixel() { return 4; } diff --git a/src/blitter/8bpp_base.cpp b/src/blitter/8bpp_base.cpp index eecf63f02..39960f8e9 100644 --- a/src/blitter/8bpp_base.cpp +++ b/src/blitter/8bpp_base.cpp @@ -141,7 +141,7 @@ int Blitter_8bppBase::BufferSize(int width, int height) return width * height; } -void Blitter_8bppBase::PaletteAnimate(uint start, uint count) +void Blitter_8bppBase::PaletteAnimate(const Palette &palette) { /* Video backend takes care of the palette animation */ } diff --git a/src/blitter/8bpp_base.hpp b/src/blitter/8bpp_base.hpp index f6dbdcc09..2dff78499 100644 --- a/src/blitter/8bpp_base.hpp +++ b/src/blitter/8bpp_base.hpp @@ -27,7 +27,7 @@ public: /* virtual */ void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch); /* 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 */ int GetBytesPerPixel() { return 1; } }; diff --git a/src/blitter/base.hpp b/src/blitter/base.hpp index f52f414f1..0a761a156 100644 --- a/src/blitter/base.hpp +++ b/src/blitter/base.hpp @@ -173,11 +173,10 @@ public: /** * Called when the 8bpp palette is changed; you should redraw all pixels on the screen that - * are equal to the 8bpp palette indexes 'start' to 'start + count'. - * @param start The start index in the 8bpp palette. - * @param count The amount of indexes that are (possible) changed. + * are equal to the 8bpp palette indexes 'first_dirty' to 'first_dirty + count_dirty'. + * @param palette The new palette. */ - virtual void PaletteAnimate(uint start, uint count) = 0; + virtual void PaletteAnimate(const Palette &palette) = 0; /** * Check if the blitter uses palette animation at all. diff --git a/src/blitter/null.hpp b/src/blitter/null.hpp index af49d485e..584afd030 100644 --- a/src/blitter/null.hpp +++ b/src/blitter/null.hpp @@ -30,7 +30,7 @@ public: /* virtual */ void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) {}; /* 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) { return 0; }; - /* virtual */ void PaletteAnimate(uint start, uint count) { }; + /* virtual */ void PaletteAnimate(const Palette &palette) { }; /* virtual */ Blitter::PaletteAnimation UsePaletteAnimation() { return Blitter::PALETTE_ANIMATION_NONE; }; /* virtual */ const char *GetName() { return "null"; } |