Add a Blitter::SetPixel32 function
This commit is contained in:
@@ -399,6 +399,15 @@ void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8 colour)
|
|||||||
this->anim_buf[this->ScreenToAnimOffset((uint32 *)video) + x + y * this->anim_buf_pitch] = colour | (DEFAULT_BRIGHTNESS << 8);
|
this->anim_buf[this->ScreenToAnimOffset((uint32 *)video) + x + y * this->anim_buf_pitch] = colour | (DEFAULT_BRIGHTNESS << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Blitter_32bppAnim::SetPixel32(void *video, int x, int y, uint8 colour, uint32 colour32)
|
||||||
|
{
|
||||||
|
*((Colour *)video + x + y * _screen.pitch) = colour32;
|
||||||
|
|
||||||
|
/* Set the colour in the anim-buffer too, if we are rendering to the screen */
|
||||||
|
if (_screen_disable_anim) return;
|
||||||
|
this->anim_buf[this->ScreenToAnimOffset((uint32 *)video) + x + y * this->anim_buf_pitch] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Blitter_32bppAnim::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
|
void Blitter_32bppAnim::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
|
||||||
{
|
{
|
||||||
const Colour c = LookupColourInPalette(colour);
|
const Colour c = LookupColourInPalette(colour);
|
||||||
|
@@ -38,6 +38,7 @@ public:
|
|||||||
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
|
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
|
||||||
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
|
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
|
||||||
void SetPixel(void *video, int x, int y, uint8 colour) override;
|
void SetPixel(void *video, int x, int y, uint8 colour) override;
|
||||||
|
void SetPixel32(void *video, int x, int y, uint8 colour, uint32 colour32) override;
|
||||||
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override;
|
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override;
|
||||||
void SetRect(void *video, int x, int y, const uint8 *colours, uint lines, uint width, uint pitch) override;
|
void SetRect(void *video, int x, int y, const uint8 *colours, uint lines, uint width, uint pitch) override;
|
||||||
void SetRect32(void *video, int x, int y, const uint32 *colours, uint lines, uint width, uint pitch) override;
|
void SetRect32(void *video, int x, int y, const uint32 *colours, uint lines, uint width, uint pitch) override;
|
||||||
|
@@ -23,6 +23,11 @@ void Blitter_32bppBase::SetPixel(void *video, int x, int y, uint8 colour)
|
|||||||
*((Colour *)video + x + y * _screen.pitch) = LookupColourInPalette(colour);
|
*((Colour *)video + x + y * _screen.pitch) = LookupColourInPalette(colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Blitter_32bppBase::SetPixel32(void *video, int x, int y, uint8 colour, uint32 colour32)
|
||||||
|
{
|
||||||
|
*((Colour *)video + x + y * _screen.pitch) = colour32;
|
||||||
|
}
|
||||||
|
|
||||||
void Blitter_32bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
|
void Blitter_32bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
|
||||||
{
|
{
|
||||||
const Colour c = LookupColourInPalette(colour);
|
const Colour c = LookupColourInPalette(colour);
|
||||||
|
@@ -21,6 +21,7 @@ public:
|
|||||||
uint8 GetScreenDepth() override { return 32; }
|
uint8 GetScreenDepth() override { return 32; }
|
||||||
void *MoveTo(void *video, int x, int y) override;
|
void *MoveTo(void *video, int x, int y) override;
|
||||||
void SetPixel(void *video, int x, int y, uint8 colour) override;
|
void SetPixel(void *video, int x, int y, uint8 colour) override;
|
||||||
|
void SetPixel32(void *video, int x, int y, uint8 colour, uint32 colour32) override;
|
||||||
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override;
|
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override;
|
||||||
void SetRect(void *video, int x, int y, const uint8 *colours, uint lines, uint width, uint pitch) override;
|
void SetRect(void *video, int x, int y, const uint8 *colours, uint lines, uint width, uint pitch) override;
|
||||||
void SetRect32(void *video, int x, int y, const uint32 *colours, uint lines, uint width, uint pitch) override;
|
void SetRect32(void *video, int x, int y, const uint32 *colours, uint lines, uint width, uint pitch) override;
|
||||||
|
@@ -39,6 +39,17 @@ void Blitter_40bppAnim::SetPixel(void *video, int x, int y, uint8 colour)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Blitter_40bppAnim::SetPixel32(void *video, int x, int y, uint8 colour, uint32 colour32)
|
||||||
|
{
|
||||||
|
if (_screen_disable_anim) {
|
||||||
|
Blitter_32bppOptimized::SetPixel32(video, x, y, colour, colour32);
|
||||||
|
} else {
|
||||||
|
*((Colour *)video + x + y * _screen.pitch) = colour32;
|
||||||
|
|
||||||
|
VideoDriver::GetInstance()->GetAnimBuffer()[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * _screen.pitch] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Blitter_40bppAnim::SetRect(void *video, int x, int y, const uint8 *colours, uint lines, uint width, uint pitch)
|
void Blitter_40bppAnim::SetRect(void *video, int x, int y, const uint8 *colours, uint lines, uint width, uint pitch)
|
||||||
{
|
{
|
||||||
if (_screen_disable_anim) {
|
if (_screen_disable_anim) {
|
||||||
|
@@ -22,6 +22,7 @@ public:
|
|||||||
|
|
||||||
// void *MoveTo(void *video, int x, int y) override;
|
// void *MoveTo(void *video, int x, int y) override;
|
||||||
void SetPixel(void *video, int x, int y, uint8 colour) override;
|
void SetPixel(void *video, int x, int y, uint8 colour) override;
|
||||||
|
void SetPixel32(void *video, int x, int y, uint8 colour, uint32 colour32) override;
|
||||||
void SetRect(void *video, int x, int y, const uint8 *colours, uint lines, uint width, uint pitch) override;
|
void SetRect(void *video, int x, int y, const uint8 *colours, uint lines, uint width, uint pitch) override;
|
||||||
void SetRect32(void *video, int x, int y, const uint32 *colours, uint lines, uint width, uint pitch) override;
|
void SetRect32(void *video, int x, int y, const uint32 *colours, uint lines, uint width, uint pitch) override;
|
||||||
void DrawRect(void *video, int width, int height, uint8 colour) override;
|
void DrawRect(void *video, int width, int height, uint8 colour) override;
|
||||||
|
@@ -34,6 +34,11 @@ void Blitter_8bppBase::SetPixel(void *video, int x, int y, uint8 colour)
|
|||||||
*((uint8 *)video + x + y * _screen.pitch) = colour;
|
*((uint8 *)video + x + y * _screen.pitch) = colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Blitter_8bppBase::SetPixel32(void *video, int x, int y, uint8 colour, uint32 colour32)
|
||||||
|
{
|
||||||
|
this->Blitter_8bppBase::SetPixel(video, x, y, colour);
|
||||||
|
}
|
||||||
|
|
||||||
void Blitter_8bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
|
void Blitter_8bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
|
||||||
{
|
{
|
||||||
this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [=](int x, int y) {
|
this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [=](int x, int y) {
|
||||||
|
@@ -19,6 +19,7 @@ public:
|
|||||||
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
|
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
|
||||||
void *MoveTo(void *video, int x, int y) override;
|
void *MoveTo(void *video, int x, int y) override;
|
||||||
void SetPixel(void *video, int x, int y, uint8 colour) override;
|
void SetPixel(void *video, int x, int y, uint8 colour) override;
|
||||||
|
void SetPixel32(void *video, int x, int y, uint8 colour, uint32 colour32) override;
|
||||||
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override;
|
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override;
|
||||||
void SetRect(void *video, int x, int y, const uint8 *colours, uint lines, uint width, uint pitch) override;
|
void SetRect(void *video, int x, int y, const uint8 *colours, uint lines, uint width, uint pitch) override;
|
||||||
void DrawRect(void *video, int width, int height, uint8 colour) override;
|
void DrawRect(void *video, int width, int height, uint8 colour) override;
|
||||||
|
@@ -117,6 +117,17 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual void SetPixel(void *video, int x, int y, uint8 colour) = 0;
|
virtual void SetPixel(void *video, int x, int y, uint8 colour) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a pixel with a given 32bpp colour on the video-buffer.
|
||||||
|
* Fall back to an 8bpp colour if 32bpp colour is not available.
|
||||||
|
* @param video The destination pointer (video-buffer).
|
||||||
|
* @param x The x position within video-buffer.
|
||||||
|
* @param y The y position within video-buffer.
|
||||||
|
* @param colour A 8bpp mapping colour.
|
||||||
|
* @param colour32 A 32bpp colour.
|
||||||
|
*/
|
||||||
|
virtual void SetPixel32(void *video, int x, int y, uint8 colour, uint32 colour32) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw a rectangle of pixels on the video-buffer.
|
* Draw a rectangle of pixels on the video-buffer.
|
||||||
* @param video The destination pointer (video-buffer).
|
* @param video The destination pointer (video-buffer).
|
||||||
|
@@ -21,6 +21,7 @@ public:
|
|||||||
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
|
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
|
||||||
void *MoveTo(void *video, int x, int y) override { return nullptr; };
|
void *MoveTo(void *video, int x, int y) override { return nullptr; };
|
||||||
void SetPixel(void *video, int x, int y, uint8 colour) override {};
|
void SetPixel(void *video, int x, int y, uint8 colour) override {};
|
||||||
|
void SetPixel32(void *video, int x, int y, uint8 colour, uint32 colour32) override {};
|
||||||
void DrawRect(void *video, int width, int height, uint8 colour) override {};
|
void DrawRect(void *video, int width, int height, uint8 colour) override {};
|
||||||
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override {};
|
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override {};
|
||||||
void SetRect(void *video, int x, int y, const uint8 *colours, uint lines, uint width, uint pitch) override {};
|
void SetRect(void *video, int x, int y, const uint8 *colours, uint lines, uint width, uint pitch) override {};
|
||||||
|
Reference in New Issue
Block a user