1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-22 01:34:21 +00:00

Direct2D: Avoid applying pending clip list in excludeClipRectangle unless the transform is non-trivial

Frequently, excludeClipRectangle will be called several times in a row,
in order to trim away borders on each side of a rectangle. When this
happens, we want to avoid creating geometric clip layers which exclude
only two or three of the borders, and instead wait until all borders
have been excluded before applying the clip list. This way, it may be
possible to simplify the clip list to a single rectangle, which can be
implemented using the faster axis-aligned clipping layer.
This commit is contained in:
reuk 2024-07-01 15:28:31 +01:00
parent b0bd58c5e6
commit 6402641d49
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -1000,8 +1000,6 @@ void Direct2DGraphicsContext::excludeClipRectangle (const Rectangle<int>& userSp
{
JUCE_SCOPED_TRACE_EVENT_FRAME_RECT_I32 (etw::excludeClipRectangle, etw::direct2dKeyword, getFrameId(), userSpaceExcludedRectangle)
applyPendingClipList();
auto& transform = currentState->currentTransform;
auto& deviceSpaceClipList = currentState->deviceSpaceClipList;
const auto frameSize = getPimpl()->getFrameSize().toFloat();
@ -1030,6 +1028,8 @@ void Direct2DGraphicsContext::excludeClipRectangle (const Rectangle<int>& userSp
}
else
{
applyPendingClipList();
deviceSpaceClipList = frameSize;
pendingClipList.subtract (userSpaceExcludedRectangle.toFloat());
}