mirror of
https://github.com/Blinue/Magpie.git
synced 2026-06-24 02:04:10 +00:00
perf: 避免多个 WM_FRONTEND_RENDER 导致重复渲染
This commit is contained in:
parent
1b637c774b
commit
d3fe8e56bb
1 changed files with 11 additions and 0 deletions
|
|
@ -482,6 +482,17 @@ LRESULT ScalingWindow::_MessageHandler(UINT msg, WPARAM wParam, LPARAM lParam) n
|
|||
{
|
||||
// 调整窗口大小时会进入 OS 的内部循环,我们的消息循环没有机会调用 Render。幸运的是
|
||||
// 内部循环会正常分发消息,因此有必要在窗口过程中执行渲染以避免调整大小时渲染暂停。
|
||||
|
||||
// 删除消息队列中的其他 WM_FRONTEND_RENDER 以避免重复渲染
|
||||
{
|
||||
MSG msg1;
|
||||
while (PeekMessage(&msg1, Handle(), CommonSharedConstants::WM_FRONTEND_RENDER,
|
||||
CommonSharedConstants::WM_FRONTEND_RENDER, PM_REMOVE)
|
||||
) {
|
||||
// 不做处理
|
||||
}
|
||||
}
|
||||
|
||||
Render();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue