12 #include "../stdafx.h" 13 #include "../zoom_func.h" 16 #include "../table/sprites.h" 18 #include "../safeguards.h" 32 for (
int y = 0; y < bp->
height; y++) {
34 dst_line += bp->
pitch;
39 for (
int x = 0; x < bp->
width; x++) {
92 for (
int i = 0; i != width; i++) {
96 udst = udst - width + _screen.pitch;
102 for (
int i = 0; i != width; i++) {
106 udst = udst - width + _screen.pitch;
111 DEBUG(misc, 0,
"32bpp blitter doesn't know how to draw this colour table ('%d')", pal);
117 Sprite *dest_sprite = (
Sprite *)allocator(
sizeof(*dest_sprite) + (size_t)sprite->
height * (
size_t)sprite->
width *
sizeof(*dst));
127 for (
int i = 0; i < sprite->
height * sprite->
width; i++) {
137 uint8 rgb_max =
max(src->r,
max(src->g, src->b));
140 if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
int left
The left offset in the 'dst' in pixels to start drawing.
uint32 PaletteID
The number of the palette.
static const PaletteID PALETTE_TO_TRANSPARENT
This sets the sprite to transparent.
int sprite_width
Real width of the sprite.
int height
The height in pixels that needs to be drawn to dst.
Perform transparency colour remapping.
int skip_top
How much pixels of the source to skip on the top (based on zoom of dst)
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
Draw an image to the screen, given an amount of params defined above.
Data structure describing a sprite.
int width
The width in pixels that needs to be drawn to dst.
static FBlitter_32bppSimple iFBlitter_32bppSimple
Instantiation of the simple 32bpp blitter factory.
static int ScaleByZoom(int value, ZoomLevel zoom)
Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL) When shifting right...
static Colour LookupColourInPalette(uint index)
Look up the colour in the current palette.
int skip_left
How much pixels of the source to skip on the left (based on zoom of dst)
uint8 v
Brightness-channel.
static T max(const T a, const T b)
Returns the maximum of two values.
Definition of a common pixel in OpenTTD's realm.
int16 y_offs
Number of pixels to shift the sprite downwards.
Parameters related to blitting.
int pitch
The pitch of the destination buffer.
int16 x_offs
The x-offset of where the sprite will be drawn.
static const PaletteID PALETTE_NEWSPAPER
Recolour sprite for newspaper-greying.
SpriteLoader::CommonPixel * data
The sprite itself.
Perform a crash remapping.
Structure for passing information from the sprite loader to the blitter.
Perform remapping to a completely blackened sprite.
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal)
Draw a colourtable to the screen.
uint16 height
Height of the sprite.
#define DEBUG(name, level,...)
Output a line of debugging information.
static Colour MakeGrey(Colour colour)
Make a colour grey - based.
uint16 width
Width of the sprite.
ZoomLevel
All zoom levels we know.
uint16 width
Width of the sprite.
int top
The top offset in the 'dst' in pixels to start drawing.
const byte * remap
XXX – Temporary storage for remap array.
const void * sprite
Pointer to the sprite how ever the encoder stored it.
static uint8 MakeDark(uint8 r, uint8 g, uint8 b)
Make a colour dark grey, for specialized 32bpp remapping.
static Colour ComposeColourPA(Colour colour, uint a, Colour current)
Compose a colour based on Pixel value, alpha value, and the current pixel value.
Perform a colour remapping.
uint16 height
Height of the sprite.
int16 x_offs
Number of pixels to shift the sprite to the right.
void * dst
Destination buffer.
Structure to access the alpha, red, green, and blue channels from a 32 bit number.
int16 y_offs
The y-offset of where the sprite will be drawn.
Factory for the simple 32 bpp blitter.
Sprite * Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
Convert a sprite from the loader to our own format.
BlitterMode
The modes of blitting we can do.
static Colour ComposeColourRGBA(uint r, uint g, uint b, uint a, Colour current)
Compose a colour based on RGBA values and the current pixel value.
static Colour MakeTransparent(Colour colour, uint nom, uint denom=256)
Make a pixel looks like it is transparent.