Fix bug in rect::clipAgainst that had caused rects completely outside the rect to be clipped against ending up with one corner outside.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6188 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2021-02-11 13:57:53 +00:00
parent 97ad8388b2
commit 83d011019f
2 changed files with 11 additions and 6 deletions

@ -1,5 +1,6 @@
-------------------------- --------------------------
Changes in 1.9 (not yet released) Changes in 1.9 (not yet released)
- Fix bug in rect::clipAgainst that had caused rects completely outside the rect to be clipped against ending up with one corner outside.
- Add getAlign functions to IGUIElement - Add getAlign functions to IGUIElement
- Add optional multitouch support to X11 (but disabled in IrrCompileConfig by default). Thanks @TheBrokenRail for a patch proposal based on example code from esjeon (patch #322). - Add optional multitouch support to X11 (but disabled in IrrCompileConfig by default). Thanks @TheBrokenRail for a patch proposal based on example code from esjeon (patch #322).
- Slightly changed close window handling on X11 (optimized and avoids problems on some shells). Thanks @TheBrokenRail for a patch (was part of patch #322). - Slightly changed close window handling on X11 (optimized and avoids problems on some shells). Thanks @TheBrokenRail for a patch (was part of patch #322).

@ -135,16 +135,20 @@ namespace core
if (other.LowerRightCorner.Y < LowerRightCorner.Y) if (other.LowerRightCorner.Y < LowerRightCorner.Y)
LowerRightCorner.Y = other.LowerRightCorner.Y; LowerRightCorner.Y = other.LowerRightCorner.Y;
if (other.UpperLeftCorner.X > LowerRightCorner.X)
LowerRightCorner.X = other.UpperLeftCorner.X;
if (other.UpperLeftCorner.Y > LowerRightCorner.Y)
LowerRightCorner.Y = other.UpperLeftCorner.Y;
if (other.LowerRightCorner.X < UpperLeftCorner.X)
UpperLeftCorner.X = other.LowerRightCorner.X;
if (other.LowerRightCorner.Y < UpperLeftCorner.Y)
UpperLeftCorner.Y = other.LowerRightCorner.Y;
if (other.UpperLeftCorner.X > UpperLeftCorner.X) if (other.UpperLeftCorner.X > UpperLeftCorner.X)
UpperLeftCorner.X = other.UpperLeftCorner.X; UpperLeftCorner.X = other.UpperLeftCorner.X;
if (other.UpperLeftCorner.Y > UpperLeftCorner.Y) if (other.UpperLeftCorner.Y > UpperLeftCorner.Y)
UpperLeftCorner.Y = other.UpperLeftCorner.Y; UpperLeftCorner.Y = other.UpperLeftCorner.Y;
// correct possible invalid rect resulting from clipping
if (UpperLeftCorner.Y > LowerRightCorner.Y)
UpperLeftCorner.Y = LowerRightCorner.Y;
if (UpperLeftCorner.X > LowerRightCorner.X)
UpperLeftCorner.X = LowerRightCorner.X;
} }
//! Moves this rectangle to fit inside another one. //! Moves this rectangle to fit inside another one.