app_server: Reduce usage of the RegionPool where unnecessary.

BRegions with only 1 rectangle will use inline data and perform
no allocations, so when we create a BRegion and only add
one rect to it, we can just use one inline and avoid using
the pool entirely at no cost (and some savings.)

No functional change (intended).

Change-Id: I10ac6bc7b5cf6b681641e88558a3f1ba770b6f77
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2298
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Augustin Cavalier 2020-02-29 21:19:07 -05:00 committed by waddlesplash
parent ab319eb798
commit 0d312fea71

View File

@ -277,12 +277,10 @@ View::AddChild(View* view)
// trigger redraw
IntRect clippedFrame = view->Frame();
ConvertToVisibleInTopView(&clippedFrame);
BRegion* dirty = fWindow->GetRegion();
if (dirty) {
dirty->Set((clipping_rect)clippedFrame);
fWindow->MarkContentDirtyAsync(*dirty);
fWindow->RecycleRegion(dirty);
}
BRegion dirty;
dirty.Set((clipping_rect)clippedFrame);
fWindow->MarkContentDirtyAsync(dirty);
}
}
}
@ -333,12 +331,10 @@ View::RemoveChild(View* view)
// trigger redraw
IntRect clippedFrame = view->Frame();
ConvertToVisibleInTopView(&clippedFrame);
BRegion* dirty = fWindow->GetRegion();
if (dirty) {
dirty->Set((clipping_rect)clippedFrame);
fWindow->MarkContentDirtyAsync(*dirty);
fWindow->RecycleRegion(dirty);
}
BRegion dirty;
dirty.Set((clipping_rect)clippedFrame);
fWindow->MarkContentDirtyAsync(dirty);
}
}
@ -1282,12 +1278,10 @@ View::SetHidden(bool hidden)
// trigger a redraw
IntRect clippedBounds = Bounds();
ConvertToVisibleInTopView(&clippedBounds);
BRegion* dirty = fWindow->GetRegion();
if (!dirty)
return;
dirty->Set((clipping_rect)clippedBounds);
fWindow->MarkContentDirty(*dirty);
fWindow->RecycleRegion(dirty);
BRegion dirty;
dirty.Set((clipping_rect)clippedBounds);
fWindow->MarkContentDirty(dirty);
}
}
}
@ -1532,12 +1526,9 @@ View::_ScreenClipping(BRegion* windowContentClipping, bool force) const
ConvertToVisibleInTopView(&clippedBounds);
if (clippedBounds.Width() < fScreenClipping.Frame().Width()
|| clippedBounds.Height() < fScreenClipping.Frame().Height()) {
BRegion* temp = fWindow->GetRegion();
if (temp) {
temp->Set((clipping_rect)clippedBounds);
fScreenClipping.IntersectWith(temp);
fWindow->RecycleRegion(temp);
}
BRegion temp;
temp.Set((clipping_rect)clippedBounds);
fScreenClipping.IntersectWith(&temp);
}
fScreenClipping.IntersectWith(windowContentClipping);