OpenTTD Source: src/blitter/null.hpp Source File

OpenTTD Source 13.2.1

null.hpp
Go to the documentation of this file.
1 /*
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/>.
6 */
7
10 #ifndef BLITTER_NULL_HPP
11 #define BLITTER_NULL_HPP
12
13 #include "factory.hpp"
14
16 class Blitter_Null : public Blitter {
17 public:
18 uint8 GetScreenDepth() override { return 0; }
19 void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override {};
20 void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override {};
21 Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
22 void *MoveTo(void *video, int x, int y) override { return nullptr; };
23 void SetPixel(void *video, int x, int y, uint8 colour) override {};
24 void DrawRect(void *video, int width, int height, uint8 colour) override {};
25 void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override {};
26 void CopyFromBuffer(void *video, const void *src, int width, int height) override {};
27 void CopyToBuffer(const void *video, void *dst, int width, int height) override {};
28 void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override {};
29 void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override {};
30 int BufferSize(int width, int height) override { return 0; };
31 void PaletteAnimate(const Palette &palette) override { };
32 Blitter::PaletteAnimation UsePaletteAnimation() override { return Blitter::PALETTE_ANIMATION_NONE; };
33
34 const char *GetName() override { return "null"; }
35 int GetBytesPerPixel() override { return 0; }
36 };
37
39 class FBlitter_Null : public BlitterFactory {
40 public:
41 FBlitter_Null() : BlitterFactory("null", "Null Blitter (does nothing)") {}
42 Blitter *CreateInstance() override { return new Blitter_Null(); }
43 };
44
45 #endif /* BLITTER_NULL_HPP */
Blitter_Null::ScrollBuffer
void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override
Scroll the videobuffer some 'x' and 'y' value.
Definition: null.hpp:29
Blitter_Null::SetPixel
void SetPixel(void *video, int x, int y, uint8 colour) override
Draw a pixel with a given colour on the video-buffer.
Definition: null.hpp:23
factory.hpp
BlitterMode
BlitterMode
The modes of blitting we can do.
Definition: base.hpp:17
Blitter
How all blitters should look like.
Definition: base.hpp:28
BlitterFactory
The base factory, keeping track of all blitters.
Definition: factory.hpp:23
Blitter_Null::DrawRect
void DrawRect(void *video, int width, int height, uint8 colour) override
Make a single horizontal line in a single colour on the video-buffer.
Definition: null.hpp:24
ZoomLevel
ZoomLevel
All zoom levels we know.
Definition: zoom_type.h:19
Blitter_Null::UsePaletteAnimation
Blitter::PaletteAnimation UsePaletteAnimation() override
Check if the blitter uses palette animation at all.
Definition: null.hpp:32
Blitter_Null::MoveTo
void * MoveTo(void *video, int x, int y) override
Move the destination pointer the requested amount x and y, keeping in mind any pitch and bpp of the r...
Definition: null.hpp:22
FBlitter_Null
Factory for the blitter that does nothing.
Definition: null.hpp:39
Blitter_Null::PaletteAnimate
void PaletteAnimate(const Palette &palette) override
Called when the 8bpp palette is changed; you should redraw all pixels on the screen that are equal to...
Definition: null.hpp:31
Blitter_Null::GetBytesPerPixel
int GetBytesPerPixel() override
Get how many bytes are needed to store a pixel.
Definition: null.hpp:35
Blitter_Null::GetScreenDepth
uint8 GetScreenDepth() override
Get the screen depth this blitter works for.
Definition: null.hpp:18
Blitter_Null::CopyFromBuffer
void CopyFromBuffer(void *video, const void *src, int width, int height) override
Copy from a buffer to the screen.
Definition: null.hpp:26
Blitter_Null::Encode
Sprite * Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override
Convert a sprite from the loader to our own format.
Definition: null.cpp:18
Blitter_Null::DrawLine
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override
Draw a line with a given colour.
Definition: null.hpp:25
BlitterFactory::BlitterFactory
BlitterFactory(const char *name, const char *description, bool usable=true)
Construct the blitter, and register it.
Definition: factory.hpp:60
Blitter::PaletteAnimation
PaletteAnimation
Types of palette animation.
Definition: base.hpp:49
Blitter_Null::Draw
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override
Draw an image to the screen, given an amount of params defined above.
Definition: null.hpp:19
Blitter_Null::DrawColourMappingRect
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override
Draw a colourtable to the screen.
Definition: null.hpp:20
Blitter_Null
Blitter that does nothing.
Definition: null.hpp:16
PaletteID
uint32 PaletteID
The number of the palette.
Definition: gfx_type.h:18
Blitter_Null::CopyToBuffer
void CopyToBuffer(const void *video, void *dst, int width, int height) override
Copy from the screen to a buffer.
Definition: null.hpp:27
Blitter::PALETTE_ANIMATION_NONE
@ PALETTE_ANIMATION_NONE
No palette animation.
Definition: base.hpp:50
SpriteLoader::Sprite
Structure for passing information from the sprite loader to the blitter.
Definition: spriteloader.hpp:48
FBlitter_Null::CreateInstance
Blitter * CreateInstance() override
Create an instance of this Blitter-class.
Definition: null.hpp:42
Blitter_Null::GetName
const char * GetName() override
Get the name of the blitter, the same as the Factory-instance returns.
Definition: null.hpp:34
Blitter::BlitterParams
Parameters related to blitting.
Definition: base.hpp:31
Blitter_Null::CopyImageToBuffer
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override
Copy from the screen to a buffer in a palette format for 8bpp and RGBA format for 32bpp.
Definition: null.hpp:28
Palette
Information about the currently used palette.
Definition: gfx_type.h:319
Sprite
Data structure describing a sprite.
Definition: spritecache.h:17
Blitter_Null::BufferSize
int BufferSize(int width, int height) override
Calculate how much memory there is needed for an image of this size in the video-buffer.
Definition: null.hpp:30