2007-06-11 11:50:49 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
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 8bpp_optimized.hpp An optimized 8 bpp blitter. */
|
2007-06-11 11:50:49 +00:00
|
|
|
|
|
|
|
#ifndef BLITTER_8BPP_OPTIMIZED_HPP
|
|
|
|
#define BLITTER_8BPP_OPTIMIZED_HPP
|
|
|
|
|
2007-06-17 20:30:28 +00:00
|
|
|
#include "8bpp_base.hpp"
|
|
|
|
#include "factory.hpp"
|
2007-06-11 11:50:49 +00:00
|
|
|
|
2011-05-01 10:15:33 +00:00
|
|
|
/** 8bpp blitter optimised for speed. */
|
2011-12-18 17:17:18 +00:00
|
|
|
class Blitter_8bppOptimized FINAL : public Blitter_8bppBase {
|
2007-06-11 11:50:49 +00:00
|
|
|
public:
|
2011-05-01 10:15:33 +00:00
|
|
|
/** Data stored about a (single) sprite. */
|
2008-06-17 17:25:22 +00:00
|
|
|
struct SpriteData {
|
2011-05-01 10:15:33 +00:00
|
|
|
uint32 offset[ZOOM_LVL_COUNT]; ///< Offsets (from .data) to streams for different zoom levels.
|
|
|
|
byte data[]; ///< Data, all zoomlevels.
|
2008-06-17 17:25:22 +00:00
|
|
|
};
|
|
|
|
|
2007-06-12 20:24:12 +00:00
|
|
|
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
2013-10-06 19:38:36 +00:00
|
|
|
/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
2007-06-21 13:56:59 +00:00
|
|
|
|
|
|
|
/* virtual */ const char *GetName() { return "8bpp-optimized"; }
|
2007-06-11 11:50:49 +00:00
|
|
|
};
|
|
|
|
|
2011-05-01 10:15:33 +00:00
|
|
|
/** Factory for the 8bpp blitter optimised for speed. */
|
2014-01-02 22:41:58 +00:00
|
|
|
class FBlitter_8bppOptimized : public BlitterFactory {
|
2007-06-11 11:50:49 +00:00
|
|
|
public:
|
2014-01-02 22:41:58 +00:00
|
|
|
FBlitter_8bppOptimized() : BlitterFactory("8bpp-optimized", "8bpp Optimized Blitter (compression + all-ZoomLevel cache)") {}
|
2007-06-11 11:50:49 +00:00
|
|
|
/* virtual */ Blitter *CreateInstance() { return new Blitter_8bppOptimized(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* BLITTER_8BPP_OPTIMIZED_HPP */
|