Fix negative-size rects being returned by Rect::operator &
Which make some sense in theory but they're prone to mishandling on usage sites, such as RasterDrawMethodsImpl.h:171.
This commit is contained in:
parent
2bc2acc00e
commit
56004348c3
@ -368,10 +368,17 @@ public:
|
||||
// Return the intersection of two rectangles (possibly empty)
|
||||
Rect<T> operator&(Rect<T> other) const
|
||||
{
|
||||
return Rect<T>(
|
||||
auto rect = Rect<T>(
|
||||
Vec2<T>(std::max(TopLeft.X, other.TopLeft.X), std::max(TopLeft.Y, other.TopLeft.Y)),
|
||||
Vec2<T>(std::min(BottomRight.X, other.BottomRight.X), std::min(BottomRight.Y, other.BottomRight.Y))
|
||||
);
|
||||
return Rect<T>(
|
||||
rect.TopLeft,
|
||||
Vec2<T>(
|
||||
std::max(rect.TopLeft.X - 1, rect.BottomRight.X),
|
||||
std::max(rect.TopLeft.Y - 1, rect.BottomRight.Y)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
inline Rect<T> &operator|=(Rect<T> other)
|
||||
|
Reference in New Issue
Block a user