Fix type sizes

This commit is contained in:
Alex
2023-05-13 07:40:07 +03:00
parent 06e34ab57f
commit 816e5461c9
85 changed files with 655 additions and 422 deletions

View File

@@ -21,7 +21,7 @@
namespace GraphicalUserInterface
{
Ofast inline void InlineSetPixel(ScreenBitmap *Bitmap, long X, long Y, uint32_t Color)
Ofast inline void InlineSetPixel(ScreenBitmap *Bitmap, int64_t X, int64_t Y, uint32_t Color)
{
if (unlikely(X < 0 || Y < 0 || X >= Bitmap->Width || Y >= Bitmap->Height))
return;
@@ -31,7 +31,7 @@ namespace GraphicalUserInterface
// Bitmap->Data[Y * Bitmap->Width + X] = Color;
}
void SetPixel(ScreenBitmap *Bitmap, long X, long Y, uint32_t Color)
void SetPixel(ScreenBitmap *Bitmap, int64_t X, int64_t Y, uint32_t Color)
{
if (unlikely(!Bitmap))
return;
@@ -42,7 +42,7 @@ namespace GraphicalUserInterface
InlineSetPixel(Bitmap, X, Y, Color);
}
uint32_t GetPixel(ScreenBitmap *Bitmap, long X, long Y)
uint32_t GetPixel(ScreenBitmap *Bitmap, int64_t X, int64_t Y)
{
if (unlikely(!Bitmap))
return 0;
@@ -59,8 +59,8 @@ namespace GraphicalUserInterface
Ofast void DrawOverBitmap(ScreenBitmap *DestinationBitmap,
ScreenBitmap *SourceBitmap,
long Top,
long Left, bool IgnoreZero)
int64_t Top,
int64_t Left, bool IgnoreZero)
{
if (unlikely(!SourceBitmap) || unlikely(!SourceBitmap->Data) ||
unlikely(!DestinationBitmap) || unlikely(!DestinationBitmap->Data))
@@ -89,7 +89,7 @@ namespace GraphicalUserInterface
{
memcpy((void *)((uintptr_t)DestinationBitmap->Data + (Top + j) * DestinationBitmap->Width * (DestinationBitmap->BitsPerPixel / 8) + Left * (DestinationBitmap->BitsPerPixel / 8)),
(void *)((uintptr_t)SourceBitmap->Data + j * SourceBitmap->Width * (SourceBitmap->BitsPerPixel / 8)),
SourceBitmap->Width * (SourceBitmap->BitsPerPixel / 8));
(size_t)(SourceBitmap->Width * (SourceBitmap->BitsPerPixel / 8)));
}
}
}
@@ -160,7 +160,7 @@ namespace GraphicalUserInterface
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-overflow"
void PaintChar(Video::Font *font, ScreenBitmap *Bitmap, char c, uint32_t Color, long *CharCursorX, long *CharCursorY)
void PaintChar(Video::Font *font, ScreenBitmap *Bitmap, char c, uint32_t Color, int64_t *CharCursorX, int64_t *CharCursorY)
{
switch (font->GetInfo().Type)
{

View File

@@ -152,8 +152,8 @@ namespace GraphicalUserInterface
{
if (MouseArray[1].Left)
{
wnd->GetPositionPtr()->Width += Mouse.X - MouseArray[0].X;
wnd->GetPositionPtr()->Height += Mouse.Y - MouseArray[0].Y;
wnd->GetPositionPtr()->Width += (size_t)(Mouse.X - MouseArray[0].X);
wnd->GetPositionPtr()->Height += (size_t)(Mouse.Y - MouseArray[0].Y);
if (wnd->GetPositionPtr()->Width < 200)
{
@@ -398,8 +398,8 @@ namespace GraphicalUserInterface
TopBarTextPos.Top += 4;
// Title bar text
long CharCursorX = TopBarTextPos.Left;
long CharCursorY = TopBarTextPos.Top;
int64_t CharCursorX = TopBarTextPos.Left;
int64_t CharCursorY = TopBarTextPos.Top;
for (uint64_t i = 0; i < strlen(wnd->GetTitle()); i++)
PaintChar(this->CurrentFont, this->OverlayBuffer, wnd->GetTitle()[i], 0xFFFFFF, &CharCursorX, &CharCursorY);
@@ -646,7 +646,7 @@ namespace GraphicalUserInterface
this->CursorBuffer->Height = 25;
this->CursorBuffer->BitsPerPixel = Display->GetBitsPerPixel();
this->CursorBuffer->Pitch = Display->GetPitch();
this->CursorBuffer->Size = this->CursorBuffer->Width * this->CursorBuffer->Height * (this->CursorBuffer->BitsPerPixel / 8);
this->CursorBuffer->Size = (size_t)(this->CursorBuffer->Width * this->CursorBuffer->Height * (this->CursorBuffer->BitsPerPixel / 8));
this->CursorBuffer->Data = (uint8_t *)this->mem->RequestPages(TO_PAGES(this->CursorBuffer->Size + 1));
memset(this->CursorBuffer->Data, 0, this->CursorBuffer->Size);

View File

@@ -66,8 +66,8 @@ namespace GraphicalUserInterface
void WidgetCollection::OnPaint(Event *e)
{
static long LastWidth = 0;
static long LastHeight = 0;
static int64_t LastWidth = 0;
static int64_t LastHeight = 0;
if (LastWidth != ((Window *)this->ParentWindow)->GetPosition().Width ||
LastHeight != ((Window *)this->ParentWindow)->GetPosition().Height)
@@ -84,7 +84,7 @@ namespace GraphicalUserInterface
this->Buffer->Height = LastHeight;
this->Buffer->BitsPerPixel = Display->GetBitsPerPixel();
this->Buffer->Pitch = Display->GetPitch();
this->Buffer->Size = this->Buffer->Pitch * LastHeight;
this->Buffer->Size = this->Buffer->Pitch * (size_t)LastHeight;
this->Buffer->Data = (uint8_t *)this->mem->RequestPages(TO_PAGES(this->Buffer->Size + 1));
memset(this->Buffer->Data, 0, this->Buffer->Size);

View File

@@ -125,7 +125,7 @@ namespace GraphicalUserInterface
this->Buffer->Height = ((Window *)this->ParentWindow)->GetPosition().Height;
this->Buffer->BitsPerPixel = Display->GetBitsPerPixel();
this->Buffer->Pitch = Display->GetPitch();
this->Buffer->Size = this->Buffer->Pitch * ((Window *)this->ParentWindow)->GetPosition().Height;
this->Buffer->Size = (size_t)(this->Buffer->Pitch * ((Window *)this->ParentWindow)->GetPosition().Height);
this->Buffer->Data = (uint8_t *)this->mem->RequestPages(TO_PAGES(this->Buffer->Size + 1));
memset(this->Buffer->Data, 0, this->Buffer->Size);

View File

@@ -79,7 +79,7 @@ namespace GraphicalUserInterface
if (!this->Maximized)
{
char buf[256];
sprintf(buf, "Left:\eAA11FF%ld\eFFFFFF Top:\eAA11FF%ld\eFFFFFF W:\eAA11FF%ld\eFFFFFF H:\eAA11FF%ld\eFFFFFF", this->Position.Left, this->Position.Top, this->Position.Width, this->Position.Height);
sprintf(buf, "Left:\eAA11FF%lld\eFFFFFF Top:\eAA11FF%lld\eFFFFFF W:\eAA11FF%ld\eFFFFFF H:\eAA11FF%ld\eFFFFFF", this->Position.Left, this->Position.Top, this->Position.Width, this->Position.Height);
// Display->DrawString(buf, this->Position.Left + 20, this->Position.Top + 25, 200);
}