Snapshot before max-resize threshold diagnosis

This commit is contained in:
Codex
2026-04-09 03:23:10 +08:00
parent 77a8fe568a
commit f567369300
25 changed files with 1489 additions and 36 deletions
+27 -1
View File
@@ -760,8 +760,10 @@ void Dialog::requestRepaint(Control* parent)
{
if (shouldDeferManagedRepaint())
{
// 非模态 Dialog 在 Window 主循环中也走托管提交;
// 这样底层控件和对话框的绘制顺序由 Window 统一收口控制。
if (auto* host = getHostWindow())
host->requestManagedRepaint();
host->requestManagedRepaint(this);
return;
}
@@ -774,3 +776,27 @@ void Dialog::requestRepaint(Control* parent)
else
onRequestRepaintAsRoot();
}
bool Dialog::canCommitManagedPartialRepaint() const
{
// Dialog 只有在“自身底板不脏 + 仍持有有效背景快照”时,
// 才能安全地只更新内部按钮,而不重画整个对话框底板。
return show && !dirty && hasValidBackgroundSnapshot();
}
void Dialog::commitManagedRepaint()
{
if (!show)
return;
if (canCommitManagedPartialRepaint())
{
// 背景快照完好:沿用 Dialog 自己已有的局部重绘路径。
requestRepaint(this);
return;
}
// 对话框底板本身已脏,或快照失效:必须整 Dialog 重画。
this->dirty = true;
onRequestRepaintAsRoot();
}