OpenTTD Source 20250612-master-gb012d9e3dc
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 const auto &root_sprite = sprite.Root();
24 dest_sprite->height = root_sprite.height;
25 dest_sprite->width = root_sprite.width;
26 dest_sprite->x_offs = root_sprite.x_offs;
27 dest_sprite->y_offs = root_sprite.y_offs;
28
29 return dest_sprite;
30}
Sprite * Encode(SpriteType sprite_type, 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.
Map zoom level to data.
SpriteType
Types of sprites that might be loaded.
Definition gfx_type.h:352
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