- use a full ClearScreen when drawing fullscreen images.

This removes the FillBorder function which was only used to clear the border around those images - but due to imprecisions can leave garbage behind.
This commit is contained in:
Christoph Oelckers 2020-06-16 00:11:06 +02:00
parent d1cbabff66
commit 9c7bc99201
4 changed files with 2 additions and 52 deletions

View file

@ -1162,55 +1162,6 @@ void VirtualToRealCoordsInt(F2DDrawer *drawer, int &x, int &y, int &w, int &h,
h = int(dy + dh + 0.5) - y;
}
//==========================================================================
//
//
//
//==========================================================================
void FillBorder (F2DDrawer *drawer, FGameTexture *img)
{
auto Width = drawer->GetWidth();
auto Height = drawer->GetHeight();
float myratio = ActiveRatio (Width, Height);
if (myratio >= 1.3f && myratio <= 1.4f)
{ // This is a 4:3 display, so no border to show
return;
}
int bordtop, bordbottom, bordleft, bordright, bord;
if (AspectTallerThanWide(myratio))
{ // Screen is taller than it is wide
bordleft = bordright = 0;
bord = Height - Height * AspectMultiplier(myratio) / 48;
bordtop = bord / 2;
bordbottom = bord - bordtop;
}
else
{ // Screen is wider than it is tall
bordtop = bordbottom = 0;
bord = Width - Width * AspectMultiplier(myratio) / 48;
bordleft = bord / 2;
bordright = bord - bordleft;
}
if (img != NULL)
{
int filltype = (ui_screenborder_classic_scaling) ? -1 : 0;
drawer->AddFlatFill(0, 0, Width, bordtop, img, filltype); // Top
drawer->AddFlatFill(0, bordtop, bordleft, Height - bordbottom, img, filltype); // Left
drawer->AddFlatFill(Width - bordright, bordtop, Width, Height - bordbottom, img, filltype); // Right
drawer->AddFlatFill(0, Height - bordbottom, Width, Height, img, filltype); // Bottom
}
else
{
ClearRect(drawer, 0, 0, Width, bordtop, GPalette.BlackIndex, 0); // Top
ClearRect(drawer, 0, bordtop, bordleft, Height - bordbottom, GPalette.BlackIndex, 0); // Left
ClearRect(drawer, Width - bordright, bordtop, Width, Height - bordbottom, GPalette.BlackIndex, 0); // Right
ClearRect(drawer, 0, Height - bordbottom, Width, Height, GPalette.BlackIndex, 0); // Bottom
}
}
//==========================================================================
//
// Draw a line

View file

@ -219,7 +219,6 @@ void DrawTexture(F2DDrawer* drawer, FGameTexture* img, double x, double y, int t
void DoDim(F2DDrawer* drawer, PalEntry color, float amount, int x1, int y1, int w, int h, FRenderStyle* style = nullptr);
void Dim(F2DDrawer* drawer, PalEntry color, float damount, int x1, int y1, int w, int h, FRenderStyle* style = nullptr);
void FillBorder(F2DDrawer *drawer, FGameTexture* img); // Fills the border around a 4:3 part of the screen on non-4:3 displays
void DrawBorder(F2DDrawer* drawer, FTextureID, int x1, int y1, int x2, int y2);
void DrawFrame(F2DDrawer* twod, PalEntry color, int left, int top, int width, int height, int thickness);

View file

@ -922,7 +922,7 @@ void DIntermissionController::Drawer ()
{
if (mScreen != NULL)
{
FillBorder(twod, nullptr);
twod->ClearScreen();
mScreen->Drawer();
}
}

View file

@ -726,8 +726,8 @@ void WI_Drawer()
ScaleOverrider s(twod);
IFVIRTUALPTRNAME(WI_Screen, "StatusScreen", Drawer)
{
FillBorder(twod, nullptr);
twod->ClearClipRect();
twod->ClearScreen();
VMValue self = WI_Screen;
VMCall(func, &self, 1, nullptr, 0);
twod->ClearClipRect(); // make sure the scripts don't leave a valid clipping rect behind.