From 17257b9620a78dc115fadbcfa9a891e5392f09ab Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 23 May 2018 09:55:04 +0100 Subject: Add: 32bpp SSE2 blitter palette animator (#6795) Create a new blitter mode: 32bpp-sse2-anim, which is 32bpp-anim + this. 32bpp-sse2-anim is now used by default where 32bpp-anim would have been. Also use this with the 32bpp-sse4-anim blitter. See issue #6469. --- src/blitter/32bpp_anim.hpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/blitter/32bpp_anim.hpp') diff --git a/src/blitter/32bpp_anim.hpp b/src/blitter/32bpp_anim.hpp index 1b35c1766..da33ec95b 100644 --- a/src/blitter/32bpp_anim.hpp +++ b/src/blitter/32bpp_anim.hpp @@ -18,14 +18,16 @@ 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) @@ -58,6 +60,15 @@ public: 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 void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom); }; -- cgit v1.2.3-70-g09d2