2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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 /** @file 32bpp_optimized.hpp Optimized 32 bpp blitter. */
10 #ifndef BLITTER_32BPP_OPTIMIZED_HPP
11 #define BLITTER_32BPP_OPTIMIZED_HPP
13 #include "32bpp_simple.hpp"
15 /** The optimised 32 bpp blitter (without palette animation). */
16 class Blitter_32bppOptimized
: public Blitter_32bppSimple
{
18 /** Data stored about a (single) sprite. */
20 uint32_t offset
[ZOOM_LVL_END
][2]; ///< Offsets (from .data) to streams for different zoom levels, and the normal and remap image information.
21 uint8_t data
[]; ///< Data, all zoomlevels.
24 void Draw(Blitter::BlitterParams
*bp
, BlitterMode mode
, ZoomLevel zoom
) override
;
25 Sprite
*Encode(const SpriteLoader::SpriteCollection
&sprite
, SpriteAllocator
&allocator
) override
;
27 std::string_view
GetName() override
{ return "32bpp-optimized"; }
29 template <BlitterMode mode
, bool Tpal_to_rgb
= false> void Draw(const Blitter::BlitterParams
*bp
, ZoomLevel zoom
);
32 template <bool Tpal_to_rgb
> void Draw(Blitter::BlitterParams
*bp
, BlitterMode mode
, ZoomLevel zoom
);
33 template <bool Tpal_to_rgb
> Sprite
*EncodeInternal(const SpriteLoader::SpriteCollection
&sprite
, SpriteAllocator
&allocator
);
36 /** Factory for the optimised 32 bpp blitter (without palette animation). */
37 class FBlitter_32bppOptimized
: public BlitterFactory
{
39 FBlitter_32bppOptimized() : BlitterFactory("32bpp-optimized", "32bpp Optimized Blitter (no palette animation)") {}
40 Blitter
*CreateInstance() override
{ return new Blitter_32bppOptimized(); }
43 #endif /* BLITTER_32BPP_OPTIMIZED_HPP */