10 #include "../stdafx.h"
11 #include "../gfx_func.h"
15 #include "../safeguards.h"
22 for (
int i = 0; i != width; i++) *((uint8_t *)dst + i) = ctab[((uint8_t *)dst)[i]];
23 dst = (uint8_t *)dst + _screen.pitch;
29 return (uint8_t *)video + x + y * _screen.pitch;
34 *((uint8_t *)video + x + y * _screen.pitch) = colour;
37 void Blitter_8bppBase::DrawLine(
void *video,
int x,
int y,
int x2,
int y2,
int screen_width,
int screen_height, uint8_t colour,
int width,
int dash)
39 this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [=](
int x,
int y) {
40 *((uint8_t *)video + x + y * _screen.pitch) = colour;
47 memset(video, colour, width);
48 video = (uint8_t *)video + _screen.pitch;
54 uint8_t *dst = (uint8_t *)video;
55 const uint8_t *usrc = (
const uint8_t *)src;
57 for (; height > 0; height--) {
58 memcpy(dst, usrc, width *
sizeof(uint8_t));
66 uint8_t *udst = (uint8_t *)dst;
67 const uint8_t *src = (
const uint8_t *)video;
69 for (; height > 0; height--) {
70 memcpy(udst, src, width *
sizeof(uint8_t));
78 uint8_t *udst = (uint8_t *)dst;
79 const uint8_t *src = (
const uint8_t *)video;
81 for (; height > 0; height--) {
82 memcpy(udst, src, width *
sizeof(uint8_t));
95 dst = (uint8_t *)video + left + (top + height - 1) * _screen.pitch;
96 src = dst - scroll_y * _screen.pitch;
113 for (
int h = height; h > 0; h--) {
114 memcpy(dst, src, width *
sizeof(uint8_t));
115 src -= _screen.pitch;
116 dst -= _screen.pitch;
120 dst = (uint8_t *)video + left + top * _screen.pitch;
121 src = dst - scroll_y * _screen.pitch;
139 for (
int h = height; h > 0; h--) {
140 memmove(dst, src, width *
sizeof(uint8_t));
141 src += _screen.pitch;
142 dst += _screen.pitch;
149 return static_cast<size_t>(width) * height;
Base for all 8 bpp blitters.
void SetPixel(void *video, int x, int y, uint8_t colour) override
Draw a pixel with a given colour on the video-buffer.
void CopyFromBuffer(void *video, const void *src, int width, int height) override
Copy from a buffer to the screen.
void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override
Scroll the videobuffer some 'x' and 'y' value.
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override
Draw a colourtable to the screen.
void PaletteAnimate(const Palette &palette) override
Called when the 8bpp palette is changed; you should redraw all pixels on the screen that are equal to...
void CopyToBuffer(const void *video, void *dst, int width, int height) override
Copy from the screen to a buffer.
size_t BufferSize(uint width, uint height) override
Calculate how much memory there is needed for an image of this size in the video-buffer.
Blitter::PaletteAnimation UsePaletteAnimation() override
Check if the blitter uses palette animation at all.
void DrawRect(void *video, int width, int height, uint8_t colour) override
Make a single horizontal line in a single colour on the video-buffer.
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override
Copy from the screen to a buffer in a palette format for 8bpp and RGBA format for 32bpp.
void * MoveTo(void *video, int x, int y) override
Move the destination pointer the requested amount x and y, keeping in mind any pitch and bpp of the r...
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8_t colour, int width, int dash) override
Draw a line with a given colour.
PaletteAnimation
Types of palette animation.
@ PALETTE_ANIMATION_VIDEO_BACKEND
Palette animation should be done by video backend (8bpp only!)
Common functionality for all blitter implementations.
@ Recolour
Recolour sprite.
uint32_t PaletteID
The number of the palette.
Information about the currently used palette.