aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/detail/win.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-08-03 22:39:24 +0200
committerDavid Robillard <d@drobilla.net>2019-09-03 08:34:39 +0200
commit2d19fe6798a900aec59657bfc5eded66f8f798d5 (patch)
treef8d8d3e04becb108d570601fe989171b649463e9 /pugl/detail/win.c
parent69f38f68879412a9ef157d335d7798917888a261 (diff)
downloadpugl-2d19fe6798a900aec59657bfc5eded66f8f798d5.tar.gz
pugl-2d19fe6798a900aec59657bfc5eded66f8f798d5.tar.bz2
pugl-2d19fe6798a900aec59657bfc5eded66f8f798d5.zip
Windows: Improve puglPostRedisplay() performance
Diffstat (limited to 'pugl/detail/win.c')
-rw-r--r--pugl/detail/win.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/pugl/detail/win.c b/pugl/detail/win.c
index edc8447..1203bca 100644
--- a/pugl/detail/win.c
+++ b/pugl/detail/win.c
@@ -511,7 +511,8 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam)
switch (message) {
case WM_SHOWWINDOW:
rect = handleConfigure(view, &event);
- puglPostRedisplay(view);
+ RedrawWindow(view->impl->hwnd, NULL, NULL,
+ RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_INTERNALPAINT);
break;
case WM_SIZE:
rect = handleConfigure(view, &event);
@@ -688,8 +689,15 @@ puglWaitForEvent(PuglView* PUGL_UNUSED(view))
}
PUGL_API PuglStatus
-puglDispatchEvents(PuglWorld* PUGL_UNUSED(world))
+puglDispatchEvents(PuglWorld* world)
{
+ for (size_t i = 0; i < world->numViews; ++i) {
+ if (world->views[i]->redisplay) {
+ UpdateWindow(world->views[i]->impl->hwnd);
+ world->views[i]->redisplay = false;
+ }
+ }
+
/* Windows has no facility to process only currently queued messages, which
causes the event loop to run forever in cases like mouse movement where
the queue is constantly being filled with new messages. To work around
@@ -756,9 +764,8 @@ puglGetTime(const PuglWorld* world)
void
puglPostRedisplay(PuglView* view)
{
- RedrawWindow(view->impl->hwnd, NULL, NULL,
- RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_INTERNALPAINT);
- UpdateWindow(view->impl->hwnd);
+ InvalidateRect(view->impl->hwnd, NULL, false);
+ view->redisplay = true;
}
PuglNativeWindow