Skip to content

Commit

Permalink
Fix menu boxes in TD being too small
Browse files Browse the repository at this point in the history
  • Loading branch information
hazelnot committed Apr 5, 2024
1 parent 5e9160e commit 951da89
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions common/graphicsviewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,9 +900,37 @@ void GraphicViewPortClass::Fill_Rect(int sx, int sy, int dx, int dy, unsigned ch
{
if (AllowHardwareBlitFills && IsHardware && ((dx - sx) * (dy - sy) >= (32 * 32))
&& GraphicBuff->Get_DD_Surface()->IsReadyToBlit()) {
Rect dest_rectangle(sx + XPos, sy + YPos, dx - sx, dy - sy);
Rect self_rect(XPos, YPos, Width, Height);
GraphicBuff->Get_DD_Surface()->FillRect(dest_rectangle.Intersect(self_rect), color);
Rect dest_rectangle;

dest_rectangle.X =sx+XPos;
dest_rectangle.Y =sy+YPos;
dest_rectangle.Width =dx+XPos;
dest_rectangle.Height=dy+YPos;

if (dest_rectangle.X<XPos){
dest_rectangle.X=XPos;
}

if (dest_rectangle.Width >= Width + XPos){
dest_rectangle.Width = Width +XPos -1;
}

if (dest_rectangle.Y<YPos){
dest_rectangle.Y=YPos;
}

if (dest_rectangle.Height >= Height + YPos){
dest_rectangle.Height = Height + YPos -1;
}

if (dest_rectangle.X >= dest_rectangle.Width) return;
if (dest_rectangle.Y >= dest_rectangle.Height) return;

dest_rectangle.Width++;
dest_rectangle.Height++;
dest_rectangle.Width -= dest_rectangle.X;
dest_rectangle.Height -= dest_rectangle.Y;
GraphicBuff->Get_DD_Surface()->FillRect(dest_rectangle, color);
} else {
if (Lock()) {
Buffer_Fill_Rect(this, sx, sy, dx, dy, color);
Expand Down

0 comments on commit 951da89

Please sign in to comment.