OpenTTD Source
20240917-master-g9ab0a47812
|
Go to the documentation of this file.
10 #include "../stdafx.h"
11 #include "../zoom_func.h"
14 #include "../safeguards.h"
21 const uint8_t *src, *src_line;
22 uint8_t *dst, *dst_line;
28 for (
int y = 0; y < bp->
height; y++) {
30 dst_line += bp->
pitch;
35 for (
int x = 0; x < bp->
width; x++) {
41 colour = bp->
remap[*src];
46 if (*src != 0) colour = bp->
remap[*dst];
50 if (*src != 0) *dst = 0;
57 if (colour != 0) *dst = colour;
uint16_t height
Height of the sprite.
Factory for the most trivial 8bpp blitter.
int16_t x_offs
Number of pixels to shift the sprite to the right.
int top
The top offset in the 'dst' in pixels to start drawing.
@ BM_TRANSPARENT
Perform transparency darkening remapping.
int skip_left
How much pixels of the source to skip on the left (based on zoom of dst)
BlitterMode
The modes of blitting we can do.
int width
The width in pixels that needs to be drawn to dst.
const uint8_t * remap
XXX – Temporary storage for remap array.
void * dst
Destination buffer.
int sprite_width
Real width of the sprite.
int pitch
The pitch of the destination buffer.
Interface for something that can allocate memory for a sprite.
std::array< Sprite, ZOOM_LVL_END > SpriteCollection
Type defining a collection of sprites, one for each zoom level.
@ ZOOM_LVL_MIN
Minimum zoom level.
const void * sprite
Pointer to the sprite how ever the encoder stored it.
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override
Draw an image to the screen, given an amount of params defined above.
@ BM_COLOUR_REMAP
Perform a colour remapping.
uint16_t width
Width of the sprite.
static FBlitter_8bppSimple iFBlitter_8bppSimple
Instantiation of the simple 8bpp blitter factory.
@ BM_CRASH_REMAP
Perform a crash remapping.
@ BM_BLACK_REMAP
Perform remapping to a completely blackened sprite.
T * Allocate(size_t size)
Allocate memory for a sprite.
int16_t y_offs
Number of pixels to shift the sprite downwards.
int left
The left offset in the 'dst' in pixels to start drawing.
Parameters related to blitting.
Sprite * Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override
Convert a sprite from the loader to our own format.
int height
The height in pixels that needs to be drawn to dst.
uint8_t data[]
Sprite data.
int skip_top
How much pixels of the source to skip on the top (based on zoom of dst)
int ScaleByZoom(int value, ZoomLevel zoom)
Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_MIN) When shifting right,...
Data structure describing a sprite.
@ BM_TRANSPARENT_REMAP
Perform transparency colour remapping.
ZoomLevel
All zoom levels we know.