From 9c7bc99201c12af7361a978d3d26f18342480f9e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 16 Jun 2020 00:11:06 +0200 Subject: [PATCH] - 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. --- src/common/2d/v_draw.cpp | 49 ------------------------------- src/common/2d/v_draw.h | 1 - src/intermission/intermission.cpp | 2 +- src/wi_stuff.cpp | 2 +- 4 files changed, 2 insertions(+), 52 deletions(-) diff --git a/src/common/2d/v_draw.cpp b/src/common/2d/v_draw.cpp index e05fe4f9f..4556eeb03 100644 --- a/src/common/2d/v_draw.cpp +++ b/src/common/2d/v_draw.cpp @@ -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 diff --git a/src/common/2d/v_draw.h b/src/common/2d/v_draw.h index daf7e8568..c48fd417b 100644 --- a/src/common/2d/v_draw.h +++ b/src/common/2d/v_draw.h @@ -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); diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index b35d3fb9f..29429177f 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -922,7 +922,7 @@ void DIntermissionController::Drawer () { if (mScreen != NULL) { - FillBorder(twod, nullptr); + twod->ClearScreen(); mScreen->Drawer(); } } diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index 1581c5b2a..931e523ba 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -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.