refactor(editor): isolate windowing from composition runtime

This commit is contained in:
2026-04-27 23:45:24 +08:00
parent 603d003684
commit 6b488d5eac
34 changed files with 418 additions and 193 deletions

View File

@@ -44,11 +44,11 @@ bool LoadHostPngTexture(
}
EditorWindowRuntimeController::EditorWindowRuntimeController(
EditorContext& editorContext,
EditorFrameServices& frameServices,
Host::EditorHostResourceService& resourceService,
std::unique_ptr<EditorWindowContentController> contentController,
std::unique_ptr<Rendering::Host::EditorWindowRenderRuntime> renderRuntime)
: m_editorContext(editorContext)
: m_frameServices(frameServices)
, m_resourceService(resourceService)
, m_renderRuntime(std::move(renderRuntime))
, m_contentController(std::move(contentController)) {}
@@ -163,12 +163,12 @@ bool EditorWindowRuntimeController::Initialize(
}
assert(m_contentController != nullptr);
m_contentController->PrepareEditorContext(
m_editorContext,
m_contentController->PrepareFrameServices(
m_frameServices,
m_renderRuntime->GetTextMeasurer());
m_contentController->Initialize(EditorWindowContentInitializationContext{
.repoRoot = repoRoot,
.editorContext = m_editorContext,
.frameServices = m_frameServices,
.textureHost = m_renderRuntime->GetTextureHost(),
.resourceService = m_resourceService,
.textMeasurer = m_renderRuntime->GetTextMeasurer(),
@@ -204,7 +204,7 @@ bool EditorWindowRuntimeController::Initialize(
m_resourceService.GetExecutableDirectory());
if (autoCaptureOnStartup) {
m_screenshotController.RequestCapture("startup");
m_contentController->NotifyStartupCaptureRequested(m_editorContext);
m_contentController->NotifyStartupCaptureRequested(m_frameServices);
}
return true;
@@ -261,23 +261,23 @@ bool EditorWindowRuntimeController::ApplyResize(std::uint32_t width, std::uint32
return resizeResult.hasViewportSurfacePresentation;
}
void EditorWindowRuntimeController::PrepareEditorContext() {
void EditorWindowRuntimeController::PrepareFrameServices() {
if (m_contentController != nullptr && m_renderRuntime != nullptr) {
m_contentController->PrepareEditorContext(
m_editorContext,
m_contentController->PrepareFrameServices(
m_frameServices,
m_renderRuntime->GetTextMeasurer());
}
}
bool EditorWindowRuntimeController::IsEditorContextValid() const {
bool EditorWindowRuntimeController::AreFrameServicesValid() const {
return m_contentController != nullptr &&
m_contentController->IsEditorContextValid(m_editorContext);
m_contentController->AreFrameServicesValid(m_frameServices);
}
void EditorWindowRuntimeController::AppendInvalidFrame(
::XCEngine::UI::UIDrawList& drawList) const {
if (m_contentController != nullptr) {
m_contentController->AppendInvalidFrame(m_editorContext, drawList);
m_contentController->AppendInvalidFrame(m_frameServices, drawList);
}
}
@@ -337,7 +337,7 @@ EditorWindowFrameTransferRequests EditorWindowRuntimeController::UpdateAndAppend
assert(m_contentController != nullptr);
return m_contentController->UpdateAndAppend(
EditorWindowContentFrameContext{
.editorContext = m_editorContext,
.frameServices = m_frameServices,
.bounds = bounds,
.inputEvents = inputEvents,
.cursorScreenPoint = cursorScreenPoint,