OpenTTD Source  20240919-master-gdf0233f4c2
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 
19 {
20  Sprite *dest_sprite;
21  dest_sprite = allocator.Allocate<Sprite>(sizeof(*dest_sprite));
22 
23  dest_sprite->height = sprite[ZOOM_LVL_MIN].height;
24  dest_sprite->width = sprite[ZOOM_LVL_MIN].width;
25  dest_sprite->x_offs = sprite[ZOOM_LVL_MIN].x_offs;
26  dest_sprite->y_offs = sprite[ZOOM_LVL_MIN].y_offs;
27 
28  return dest_sprite;
29 }
Sprite::height
uint16_t height
Height of the sprite.
Definition: spritecache.h:18
iFBlitter_Null
static FBlitter_Null iFBlitter_Null
Instantiation of the null blitter factory.
Definition: null.cpp:16
Sprite::x_offs
int16_t x_offs
Number of pixels to shift the sprite to the right.
Definition: spritecache.h:20
null.hpp
SpriteAllocator
Interface for something that can allocate memory for a sprite.
Definition: spriteloader.hpp:88
SpriteLoader::SpriteCollection
std::array< Sprite, ZOOM_LVL_END > SpriteCollection
Type defining a collection of sprites, one for each zoom level.
Definition: spriteloader.hpp:70
ZOOM_LVL_MIN
@ ZOOM_LVL_MIN
Minimum zoom level.
Definition: zoom_type.h:41
FBlitter_Null
Factory for the blitter that does nothing.
Definition: null.hpp:38
Sprite::width
uint16_t width
Width of the sprite.
Definition: spritecache.h:19
SpriteAllocator::Allocate
T * Allocate(size_t size)
Allocate memory for a sprite.
Definition: spriteloader.hpp:99
Sprite::y_offs
int16_t y_offs
Number of pixels to shift the sprite downwards.
Definition: spritecache.h:21
Blitter_Null::Encode
Sprite * Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override
Convert a sprite from the loader to our own format.
Definition: null.cpp:18
Sprite
Data structure describing a sprite.
Definition: spritecache.h:17