2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file 32bpp_optimized.hpp Optimized 32 bpp blitter. */
|
2007-09-09 23:16:01 +00:00
|
|
|
|
|
|
|
#ifndef BLITTER_32BPP_OPTIMIZED_HPP
|
|
|
|
#define BLITTER_32BPP_OPTIMIZED_HPP
|
|
|
|
|
|
|
|
#include "32bpp_simple.hpp"
|
|
|
|
|
2011-05-01 10:15:33 +00:00
|
|
|
/** The optimised 32 bpp blitter (without palette animation). */
|
2007-09-09 23:16:01 +00:00
|
|
|
class Blitter_32bppOptimized : public Blitter_32bppSimple {
|
|
|
|
public:
|
2011-05-01 10:15:33 +00:00
|
|
|
/** Data stored about a (single) sprite. */
|
2008-06-26 15:46:19 +00:00
|
|
|
struct SpriteData {
|
2011-05-01 10:15:33 +00:00
|
|
|
uint32 offset[ZOOM_LVL_COUNT][2]; ///< Offsets (from .data) to streams for different zoom levels, and the normal and remap image information.
|
|
|
|
byte data[]; ///< Data, all zoomlevels.
|
2008-06-26 15:46:19 +00:00
|
|
|
};
|
|
|
|
|
2019-03-03 22:25:13 +00:00
|
|
|
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
|
|
|
|
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
|
2007-09-09 23:16:01 +00:00
|
|
|
|
2019-03-03 22:25:13 +00:00
|
|
|
const char *GetName() override { return "32bpp-optimized"; }
|
2008-06-10 17:28:37 +00:00
|
|
|
|
2021-03-02 19:55:39 +00:00
|
|
|
template <BlitterMode mode, bool Tpal_to_rgb = false> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
|
2021-01-16 15:43:44 +00:00
|
|
|
|
|
|
|
protected:
|
2021-03-02 19:55:39 +00:00
|
|
|
template <bool Tpal_to_rgb> void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
2021-01-16 15:43:44 +00:00
|
|
|
template <bool Tpal_to_rgb> Sprite *EncodeInternal(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
2007-09-09 23:16:01 +00:00
|
|
|
};
|
|
|
|
|
2011-05-01 10:15:33 +00:00
|
|
|
/** Factory for the optimised 32 bpp blitter (without palette animation). */
|
2014-01-02 22:41:58 +00:00
|
|
|
class FBlitter_32bppOptimized : public BlitterFactory {
|
2007-09-09 23:16:01 +00:00
|
|
|
public:
|
2014-01-02 22:41:58 +00:00
|
|
|
FBlitter_32bppOptimized() : BlitterFactory("32bpp-optimized", "32bpp Optimized Blitter (no palette animation)") {}
|
2019-03-03 22:25:13 +00:00
|
|
|
Blitter *CreateInstance() override { return new Blitter_32bppOptimized(); }
|
2007-09-09 23:16:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* BLITTER_32BPP_OPTIMIZED_HPP */
|