OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
10 #include "../stdafx.h"
11 #include "../zoom_func.h"
14 #include "../safeguards.h"
21 const uint8 *src, *src_line;
22 uint8 *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];
45 if (*src != 0) colour = bp->
remap[*dst];
49 if (*src != 0) *dst = 0;
56 if (colour != 0) *dst = colour;
66 dest_sprite = (
Sprite *)allocator(
sizeof(*dest_sprite) + (size_t)sprite->
height * (
size_t)sprite->
width);
74 for (
int i = 0; i < sprite->
height * sprite->
width; i++) {
Factory for the most trivial 8bpp blitter.
int top
The top offset in the 'dst' in pixels to start drawing.
@ BM_TRANSPARENT
Perform transparency colour 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.
void * dst
Destination buffer.
uint16 height
Height of the sprite.
int16 x_offs
Number of pixels to shift the sprite to the right.
int sprite_width
Real width of the sprite.
ZoomLevel
All zoom levels we know.
int pitch
The pitch of the destination buffer.
SpriteLoader::CommonPixel * data
The sprite itself.
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.
static FBlitter_8bppSimple iFBlitter_8bppSimple
Instantiation of the simple 8bpp blitter factory.
@ BM_CRASH_REMAP
Perform a crash remapping.
uint16 width
Width of the sprite.
int16 x_offs
The x-offset of where the sprite will be drawn.
@ BM_BLACK_REMAP
Perform remapping to a completely blackened sprite.
uint16 width
Width of the sprite.
static int ScaleByZoom(int value, ZoomLevel zoom)
Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL) When shifting right,...
int left
The left offset in the 'dst' in pixels to start drawing.
int16 y_offs
Number of pixels to shift the sprite downwards.
Structure for passing information from the sprite loader to the blitter.
Parameters related to blitting.
int height
The height in pixels that needs to be drawn to dst.
int16 y_offs
The y-offset of where the sprite will be drawn.
uint16 height
Height of the sprite.
int skip_top
How much pixels of the source to skip on the top (based on zoom of dst)
Data structure describing a sprite.
const byte * remap
XXX – Temporary storage for remap array.
Sprite * Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override
Convert a sprite from the loader to our own format.