Blitter: Add method to draw rectangle at x, y offset

This commit is contained in:
Jonathan G Rennison
2023-01-17 22:18:02 +00:00
parent 84c80977ca
commit aaf9fcebee
10 changed files with 36 additions and 0 deletions

View File

@@ -508,6 +508,11 @@ void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 colou
} while (--height);
}
void Blitter_32bppAnim::DrawRectAt(void *video, int x, int y, int width, int height, uint8 colour)
{
this->Blitter_32bppAnim::DrawRect((Colour *)video + x + y * _screen.pitch, width, height, colour);
}
void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width, int height)
{
assert(!_screen_disable_anim);

View File

@@ -43,6 +43,7 @@ public:
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 DrawRect(void *video, int width, int height, uint8 colour) override;
void DrawRectAt(void *video, int x, int y, int width, int height, uint8 colour) override;
void CopyFromBuffer(void *video, const void *src, int width, int height) override;
void CopyToBuffer(const void *video, void *dst, int width, int height) override;
void ScrollBuffer(void *video, int left, int top, int width, int height, int scroll_x, int scroll_y) override;

View File

@@ -75,6 +75,11 @@ void Blitter_32bppBase::DrawRect(void *video, int width, int height, uint8 colou
} while (--height);
}
void Blitter_32bppBase::DrawRectAt(void *video, int x, int y, int width, int height, uint8 colour)
{
this->Blitter_32bppBase::DrawRect((Colour *)video + x + y * _screen.pitch, width, height, colour);
}
void Blitter_32bppBase::CopyFromBuffer(void *video, const void *src, int width, int height)
{
uint32 *dst = (uint32 *)video;

View File

@@ -26,6 +26,7 @@ public:
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 DrawRect(void *video, int width, int height, uint8 colour) override;
void DrawRectAt(void *video, int x, int y, int width, int height, uint8 colour) override;
void CopyFromBuffer(void *video, const void *src, int width, int height) override;
void CopyToBuffer(const void *video, void *dst, int width, int height) override;
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override;

View File

@@ -109,6 +109,11 @@ void Blitter_40bppAnim::DrawRect(void *video, int width, int height, uint8 colou
} while (--height);
}
void Blitter_40bppAnim::DrawRectAt(void *video, int x, int y, int width, int height, uint8 colour)
{
this->Blitter_40bppAnim::DrawRect((Colour *)video + x + y * _screen.pitch, width, height, colour);
}
void Blitter_40bppAnim::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
{
if (_screen_disable_anim) {

View File

@@ -24,6 +24,7 @@ public:
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 DrawRect(void *video, int width, int height, uint8 colour) override;
void DrawRectAt(void *video, int x, int y, 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 CopyFromBuffer(void *video, const void *src, int width, int height) override;
void CopyToBuffer(const void *video, void *dst, int width, int height) override;

View File

@@ -64,6 +64,11 @@ void Blitter_8bppBase::DrawRect(void *video, int width, int height, uint8 colour
} while (--height);
}
void Blitter_8bppBase::DrawRectAt(void *video, int x, int y, int width, int height, uint8 colour)
{
this->Blitter_8bppBase::DrawRect((uint8 *)video + x + y * _screen.pitch, width, height, colour);
}
void Blitter_8bppBase::CopyFromBuffer(void *video, const void *src, int width, int height)
{
uint8 *dst = (uint8 *)video;

View File

@@ -23,6 +23,7 @@ public:
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 DrawRect(void *video, int width, int height, uint8 colour) override;
void DrawRectAt(void *video, int x, int y, int width, int height, uint8 colour) override;
void CopyFromBuffer(void *video, const void *src, int width, int height) override;
void CopyToBuffer(const void *video, void *dst, int width, int height) override;
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override;

View File

@@ -161,6 +161,17 @@ public:
*/
virtual void DrawRect(void *video, int width, int height, uint8 colour) = 0;
/**
* Make a single horizontal line in a single colour on the video-buffer.
* @param video The destination pointer (video-buffer).
* @param x The x position within video-buffer.
* @param y The y position within video-buffer.
* @param width The length of the line.
* @param height The height of the line.
* @param colour A 8bpp mapping colour.
*/
virtual void DrawRectAt(void *video, int x, int y, int width, int height, uint8 colour) = 0;
/**
* Draw a line with a given colour.
* @param video The destination pointer (video-buffer).

View File

@@ -23,6 +23,7 @@ public:
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 DrawRectAt(void *video, int x, int y, 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 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 {};