OpenTTD Source  20241121-master-g67a0fccfad
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 * Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override
Convert a sprite from the loader to our own format.
Definition: null.cpp:18
Factory for the blitter that does nothing.
Definition: null.hpp:38
Interface for something that can allocate memory for a sprite.
T * Allocate(size_t size)
Allocate memory for a sprite.
std::array< Sprite, ZOOM_LVL_END > SpriteCollection
Type defining a collection of sprites, one for each zoom level.
static FBlitter_Null iFBlitter_Null
Instantiation of the null blitter factory.
Definition: null.cpp:16
The blitter that doesn't blit.
Data structure describing a sprite.
Definition: spritecache.h:17
uint16_t width
Width of the sprite.
Definition: spritecache.h:19
uint16_t height
Height of the sprite.
Definition: spritecache.h:18
int16_t y_offs
Number of pixels to shift the sprite downwards.
Definition: spritecache.h:21
int16_t x_offs
Number of pixels to shift the sprite to the right.
Definition: spritecache.h:20
@ ZOOM_LVL_MIN
Minimum zoom level.
Definition: zoom_type.h:41