mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-30 08:17:58 +00:00
Add GetPixel and DrawRectangle functions to Display class
This commit is contained in:
parent
9925a9e9b4
commit
574c753b77
@ -50,6 +50,39 @@ namespace Video
|
|||||||
// MarkRegionDirty(Y / RegionHeight, X / RegionWidth);
|
// MarkRegionDirty(Y / RegionHeight, X / RegionWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__no_sanitize("undefined") uint32_t Display::GetPixel(uint32_t X,
|
||||||
|
uint32_t Y)
|
||||||
|
{
|
||||||
|
if (unlikely(X >= this->Width))
|
||||||
|
X = this->Width - 1;
|
||||||
|
|
||||||
|
if (unlikely(Y >= this->Height))
|
||||||
|
Y = this->Height - 1;
|
||||||
|
|
||||||
|
uint32_t *Pixel = (uint32_t *)((uintptr_t)this->Buffer + (Y * this->Width + X) * (this->framebuffer.BitsPerPixel / 8));
|
||||||
|
return *Pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
__no_sanitize("undefined") void Display::DrawRectangle(uint32_t X,
|
||||||
|
uint32_t Y,
|
||||||
|
uint32_t Width,
|
||||||
|
uint32_t Height,
|
||||||
|
uint32_t Color)
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0; i < Width; i++)
|
||||||
|
{
|
||||||
|
for (uint32_t j = 0; j < Height; j++)
|
||||||
|
{
|
||||||
|
uint32_t *Pixel =
|
||||||
|
(uint32_t *)((uintptr_t)this->Buffer + ((Y + j) *
|
||||||
|
this->Width +
|
||||||
|
(X + i)) *
|
||||||
|
(this->framebuffer.BitsPerPixel / 8));
|
||||||
|
*Pixel = Color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Display::Scroll(int Lines)
|
void Display::Scroll(int Lines)
|
||||||
{
|
{
|
||||||
if (this->DoNotScroll)
|
if (this->DoNotScroll)
|
||||||
|
@ -214,6 +214,10 @@ namespace Video
|
|||||||
|
|
||||||
void ClearBuffer();
|
void ClearBuffer();
|
||||||
void SetPixel(uint32_t X, uint32_t Y, uint32_t Color);
|
void SetPixel(uint32_t X, uint32_t Y, uint32_t Color);
|
||||||
|
uint32_t GetPixel(uint32_t X, uint32_t Y);
|
||||||
|
void DrawRectangle(uint32_t X, uint32_t Y,
|
||||||
|
uint32_t Width, uint32_t Height,
|
||||||
|
uint32_t Color);
|
||||||
void Scroll(int Lines);
|
void Scroll(int Lines);
|
||||||
|
|
||||||
void SetDoNotScroll(bool Value)
|
void SetDoNotScroll(bool Value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user