mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Direct2D: Use WM_PAINT and vblank callbacks to drive painting
This commit is contained in:
parent
22ae5baa42
commit
258203706c
1 changed files with 12 additions and 3 deletions
|
|
@ -5082,16 +5082,18 @@ public:
|
||||||
updateRegion.findRECTAndValidate (peer.getHWND());
|
updateRegion.findRECTAndValidate (peer.getHWND());
|
||||||
|
|
||||||
for (const auto& rect : updateRegion.getRects())
|
for (const auto& rect : updateRegion.getRects())
|
||||||
repaint (D2DUtilities::toRectangle (rect));
|
direct2DContext->addDeferredRepaint (D2DUtilities::toRectangle (rect));
|
||||||
|
|
||||||
#if JUCE_DIRECT2D_METRICS
|
#if JUCE_DIRECT2D_METRICS
|
||||||
lastPaintStartTicks = paintStartTicks;
|
lastPaintStartTicks = paintStartTicks;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
handleDirect2DPaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void repaint (const Rectangle<int>& area) override
|
void repaint (const Rectangle<int>& area) override
|
||||||
{
|
{
|
||||||
direct2DContext->addDeferredRepaint (area);
|
deferredRepaints.add (area);
|
||||||
}
|
}
|
||||||
|
|
||||||
void performAnyPendingRepaintsNow() override {}
|
void performAnyPendingRepaintsNow() override {}
|
||||||
|
|
@ -5103,7 +5105,13 @@ public:
|
||||||
|
|
||||||
void onVBlank() override
|
void onVBlank() override
|
||||||
{
|
{
|
||||||
handleDirect2DPaint();
|
for (auto deferredRect : deferredRepaints)
|
||||||
|
{
|
||||||
|
auto r = D2DUtilities::toRECT (deferredRect);
|
||||||
|
InvalidateRect (peer.getHWND(), &r, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
deferredRepaints.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleShowWindow() override
|
void handleShowWindow() override
|
||||||
|
|
@ -5472,6 +5480,7 @@ private:
|
||||||
|
|
||||||
std::unique_ptr<WrappedD2DHwndContextBase> direct2DContext = getContextForPeer (peer);
|
std::unique_ptr<WrappedD2DHwndContextBase> direct2DContext = getContextForPeer (peer);
|
||||||
UpdateRegion updateRegion;
|
UpdateRegion updateRegion;
|
||||||
|
RectangleList<int> deferredRepaints;
|
||||||
|
|
||||||
#if JUCE_ETW_TRACELOGGING
|
#if JUCE_ETW_TRACELOGGING
|
||||||
struct ETWEventProvider
|
struct ETWEventProvider
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue