1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Direct2D: Track UpdateRegions in D2DContext rather than the Direct2DHwndContext

This commit is contained in:
reuk 2024-08-13 11:20:29 +01:00
parent c94b8e1712
commit 570fd4b65c
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
3 changed files with 5 additions and 20 deletions

View file

@ -313,7 +313,6 @@ private:
std::unique_ptr<SwapChainThread> swapChainThread;
BackBufferLock presentation;
std::optional<CompositionTree> compositionTree;
UpdateRegion updateRegion;
RectangleList<int> deferredRepaints;
Rectangle<int> frameSize;
std::vector<RECT> dirtyRectangles;
@ -493,18 +492,6 @@ public:
JUCE_TRACE_EVENT_INT_RECT (etw::repaint, etw::paintKeyword, snappedRectangle);
}
void addInvalidWindowRegionToDeferredRepaints()
{
updateRegion.findRECTAndValidate (hwnd);
// Call addDeferredRepaint for each RECT in the update region to make
// sure they are snapped properly for DPI scaling
for (const auto& rect : updateRegion.getRects())
addDeferredRepaint (D2DUtilities::toRectangle (rect));
updateRegion.clear();
}
SavedState* startFrame (float dpiScale) override
{
if (resizing)
@ -721,11 +708,6 @@ void Direct2DHwndContext::addDeferredRepaint (Rectangle<int> deferredRepaint)
pimpl->addDeferredRepaint (deferredRepaint);
}
void Direct2DHwndContext::addInvalidWindowRegionToDeferredRepaints()
{
pimpl->addInvalidWindowRegionToDeferredRepaints();
}
Image Direct2DHwndContext::createSnapshot() const
{
return pimpl->createSnapshot();

View file

@ -50,7 +50,6 @@ public:
void updateSize();
void addDeferredRepaint (Rectangle<int> deferredRepaint);
void addInvalidWindowRegionToDeferredRepaints();
Image createSnapshot() const override;

View file

@ -5033,7 +5033,10 @@ public:
auto paintStartTicks = Time::getHighResolutionTicks();
#endif
direct2DContext->addInvalidWindowRegionToDeferredRepaints();
updateRegion.findRECTAndValidate (peer.getHWND());
for (const auto& rect : updateRegion.getRects())
repaint (D2DUtilities::toRectangle (rect));
#if JUCE_DIRECT2D_METRICS
lastPaintStartTicks = paintStartTicks;
@ -5122,6 +5125,7 @@ private:
HWNDComponentPeer& peer;
std::unique_ptr<Direct2DHwndContext> direct2DContext;
UpdateRegion updateRegion;
#if JUCE_ETW_TRACELOGGING
struct ETWEventProvider