Skip to content

Commit

Permalink
- fixed: The scissor rectangle must be clipped to the upper left edge…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
coelckers committed Jun 11, 2020
1 parent 3e70610 commit 95c232d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/common/rendering/hwrenderer/hw_draw2d.cpp
Expand Up @@ -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
{
Expand Down
1 change: 0 additions & 1 deletion src/common/textures/texturemanager.h
Expand Up @@ -11,7 +11,6 @@ class FxAddSub;
struct BuildInfo;
class FMultipatchTextureBuilder;
class FScanner;
int PalCheck(int tex);

// Texture manager
class FTextureManager
Expand Down

0 comments on commit 95c232d

Please sign in to comment.