diff options
author | 2017-12-05 10:14:25 -0500 | |
---|---|---|
committer | 2017-12-05 15:39:01 +0000 | |
commit | bb4b20a265a78b561c005aaf80920d4bc9c2e7d0 (patch) | |
tree | 7730a1d63fa29d08be0a3a6bebc751e1c9c29693 /tools/sk_app | |
parent | 1793e7bb46c1f9d430c1a699a1c3d3168159b659 (diff) |
Keep animation running while moving the mouse in viewer (on Windows)
Animated slides (like addarc) would appear to pause while dragging the
mouse around. This was because the message queue was never empty - we
would just alternate handling WM_MOUSEMOVE and WM_PAINT messages. Forcing
an onIdle before each onPaint appears to fix the problem.
Bug: skia:
Change-Id: I1d19f83c2cf480f327420a2682a074213847d062
Reviewed-on: https://skia-review.googlesource.com/80620
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tools/sk_app')
-rw-r--r-- | tools/sk_app/win/main_win.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/sk_app/win/main_win.cpp b/tools/sk_app/win/main_win.cpp index 4765442f96..4913587dd0 100644 --- a/tools/sk_app/win/main_win.cpp +++ b/tools/sk_app/win/main_win.cpp @@ -65,13 +65,25 @@ static int main_common(HINSTANCE hInstance, int show, int argc, char**argv) { MSG msg; memset(&msg, 0, sizeof(msg)); + bool idled = false; + // Main message loop while (WM_QUIT != msg.message) { if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); + + if (WM_PAINT == msg.message) { + // Ensure that call onIdle at least once per WM_PAINT, or mouse events can + // overwhelm the message processing loop, and prevent animation from running. + if (!idled) { + app->onIdle(); + } + idled = false; + } DispatchMessage(&msg); } else { app->onIdle(); + idled = true; } } |