OpenTTD Source  1.11.0-beta2
null.cpp
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 #include "../stdafx.h"
11 #include "null.hpp"
12 
13 #include "../safeguards.h"
14 
17 
18 Sprite *Blitter_Null::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
19 {
20  Sprite *dest_sprite;
21  dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite));
22 
23  dest_sprite->height = sprite->height;
24  dest_sprite->width = sprite->width;
25  dest_sprite->x_offs = sprite->x_offs;
26  dest_sprite->y_offs = sprite->y_offs;
27 
28  return dest_sprite;
29 }
iFBlitter_Null
static FBlitter_Null iFBlitter_Null
Instantiation of the null blitter factory.
Definition: null.cpp:16
Sprite::height
uint16 height
Height of the sprite.
Definition: spritecache.h:18
Sprite::x_offs
int16 x_offs
Number of pixels to shift the sprite to the right.
Definition: spritecache.h:20
null.hpp
FBlitter_Null
Factory for the blitter that does nothing.
Definition: null.hpp:39
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
Sprite::width
uint16 width
Width of the sprite.
Definition: spritecache.h:19
SpriteLoader::Sprite::x_offs
int16 x_offs
The x-offset of where the sprite will be drawn.
Definition: spriteloader.hpp:50
SpriteLoader::Sprite::width
uint16 width
Width of the sprite.
Definition: spriteloader.hpp:49
Sprite::y_offs
int16 y_offs
Number of pixels to shift the sprite downwards.
Definition: spritecache.h:21
SpriteLoader::Sprite
Structure for passing information from the sprite loader to the blitter.
Definition: spriteloader.hpp:47
SpriteLoader::Sprite::y_offs
int16 y_offs
The y-offset of where the sprite will be drawn.
Definition: spriteloader.hpp:51
SpriteLoader::Sprite::height
uint16 height
Height of the sprite.
Definition: spriteloader.hpp:48
Sprite
Data structure describing a sprite.
Definition: spritecache.h:17