Snapshot before max-resize threshold diagnosis
This commit is contained in:
+28
-1
@@ -159,6 +159,8 @@ bool Canvas::handleEvent(const ExMessage& msg)
|
||||
|
||||
if (anyDirty)
|
||||
{
|
||||
// 只要任一子控件因本次事件进入 dirty,就把这笔重绘继续向上汇报。
|
||||
// 在托管模式下,这不会立即绘制,而是登记为 Canvas 对应的重绘 root。
|
||||
if (!SxIsNoisyMsg(msg.message))
|
||||
SX_LOGD("Dirty") << SX_T("Canvas检测有控件为脏状态 -> 请求重绘, ","Canvas anyDirty -> requestRepaint, ")<<"id = " << id;
|
||||
requestRepaint(parent);
|
||||
@@ -435,8 +437,9 @@ void Canvas::requestRepaint(Control* parent)
|
||||
{
|
||||
if (shouldDeferManagedRepaint())
|
||||
{
|
||||
// 托管路径:由 Window 统一决定这次是否只重画本 Canvas,还是升级为补画 Dialog / 整体场景。
|
||||
if (auto* host = getHostWindow())
|
||||
host->requestManagedRepaint();
|
||||
host->requestManagedRepaint(this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -474,3 +477,27 @@ void Canvas::requestRepaint(Control* parent)
|
||||
onRequestRepaintAsRoot();
|
||||
}
|
||||
|
||||
bool Canvas::canCommitManagedPartialRepaint() const
|
||||
{
|
||||
// Canvas 只有在“自己本体不脏 + 仍持有有效背景快照”时,
|
||||
// 才能安全地做局部提交(即只更新内部脏子控件)。
|
||||
return show && !dirty && hasValidBackgroundSnapshot();
|
||||
}
|
||||
|
||||
void Canvas::commitManagedRepaint()
|
||||
{
|
||||
if (!show)
|
||||
return;
|
||||
|
||||
if (canCommitManagedPartialRepaint())
|
||||
{
|
||||
// 快照完好:沿用 Canvas 自己已有的局部重绘逻辑。
|
||||
requestRepaint(this);
|
||||
return;
|
||||
}
|
||||
|
||||
// 自身已经脏了,或快照失效:必须升级为整 Canvas 重画。
|
||||
this->dirty = true;
|
||||
onRequestRepaintAsRoot();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user