Refine snapshot invalidation and modal resize behavior

This commit is contained in:
Codex
2026-03-29 20:47:04 +08:00
parent 4a6e153da5
commit 7f8431a18c
8 changed files with 33 additions and 20 deletions
+13 -5
View File
@@ -58,7 +58,7 @@ void Control::setIsVisible(bool show)
if (!show)
{
// 隐藏:擦除自己在屏幕上的内容,并释放快照
this->updateBackground();
discardBackground();
return;
}
@@ -74,7 +74,7 @@ void Control::onWindowResize()
<< SX_T(" -> 丢背景快照 + 标脏", " -> discardSnap + dirty");
// 自己:丢快照 + 标脏
discardBackground();
invalidateBackgroundSnapshot();
setDirty(true);
}
void Control::setLayoutMode(StellarX::LayoutMode layoutMode_)
@@ -200,8 +200,16 @@ void Control::discardBackground()
hasSnap = false; saveWidth = saveHeight = 0;
}
void Control::updateBackground()
void Control::invalidateBackgroundSnapshot()
{
restBackground();
discardBackground();
if (saveBkImage)
{
SX_LOGD("Snap") << SX_T("作废背景快照:id=", "invalidateBackgroundSnapshot: id=") << id
<< " hasSnap=" << (hasSnap ? 1 : 0);
saveBkImage.reset();
}
hasSnap = false;
saveBkX = saveBkY = 0;
saveWidth = saveHeight = 0;
}