- fixed: The scissor rectangle must be clipped to the upper left edge of the screen.

Negative coordinates are treated as "disable scissor", so if some transformation results in something off-screen it needs to be handled before passing it to the backend.
This commit is contained in:
Christoph Oelckers 2020-06-11 12:40:11 +02:00
parent 3e7061036a
commit 95c232d31a
2 changed files with 3 additions and 1 deletions

View file

@ -150,6 +150,9 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
sciY = screen->ScreenToWindowY(cmd.mScissor[3]);
sciW = screen->ScreenToWindowX(cmd.mScissor[2]) - sciX;
sciH = screen->ScreenToWindowY(cmd.mScissor[1]) - sciY;
// If coordinates turn out negative, clip to sceen here to avoid undefined behavior.
if (sciX < 0) sciW += sciX, sciX = 0;
if (sciY < 0) sciH += sciY, sciY = 0;
}
else
{

View file

@ -11,7 +11,6 @@ class FxAddSub;
struct BuildInfo;
class FMultipatchTextureBuilder;
class FScanner;
int PalCheck(int tex);
// Texture manager
class FTextureManager