DrawState: disable drawing when clipping to an invalid rect

An invalid rect would mean an empty area to clip to. Its inverse would
be an infinite area with no holes.

Fixes #18395.

Change-Id: I5c739149e539ab63e9aaab6e8716aa73e3ee9d2f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6406
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: John Scipione <jscipione@gmail.com>
This commit is contained in:
Máximo Castañeda 2023-05-03 18:54:17 +02:00 committed by Adrien Destugues
parent 43a8874973
commit 7858871ed4

View File

@ -474,8 +474,15 @@ DrawState::GetCombinedClippingRegion(BRegion* region) const
bool
DrawState::ClipToRect(BRect rect, bool inverse)
{
if (!rect.IsValid())
if (!rect.IsValid()) {
if (!inverse) {
if (!fClippingRegion.IsSet())
fClippingRegion.SetTo(new(nothrow) BRegion());
else
fClippingRegion->MakeEmpty();
}
return false;
}
if (!fCombinedTransform.IsIdentity()) {
if (fCombinedTransform.IsDilation()) {