new_editor: close legacy d2d host path

This commit is contained in:
2026-04-22 02:14:26 +08:00
parent 35e7602eb8
commit 36c4ae414b
19 changed files with 876 additions and 1894 deletions

View File

@@ -75,7 +75,6 @@ void EditorWindowRuntimeController::ClearExternalDockHostDropPreview() {
void EditorWindowRuntimeController::SetDpiScale(float dpiScale) {
m_dpiScale = dpiScale > 0.0f ? dpiScale : 1.0f;
m_renderer.SetDpiScale(dpiScale);
m_textSystem.SetDpiScale(m_dpiScale);
m_uiRenderer.SetDpiScale(m_dpiScale);
}
@@ -199,8 +198,6 @@ void EditorWindowRuntimeController::Shutdown() {
m_textureHost.Shutdown();
LogRuntimeTrace("window-close", "EditorWindowRuntimeController::Shutdown stage=WindowRenderer");
m_windowRenderer.Shutdown();
LogRuntimeTrace("window-close", "EditorWindowRuntimeController::Shutdown stage=NativeRenderer");
m_renderer.Shutdown();
m_dpiScale = 1.0f;
LogRuntimeTrace("window-close", "EditorWindowRuntimeController::Shutdown end");
}
@@ -233,22 +230,35 @@ Host::D3D12WindowRenderLoopFrameContext EditorWindowRuntimeController::BeginFram
}
Host::D3D12WindowRenderLoopPresentResult EditorWindowRuntimeController::Present(
const ::XCEngine::UI::UIDrawData& drawData) const {
return m_windowRenderLoop.Present(drawData);
}
const ::XCEngine::UI::UIDrawData& drawData) {
std::filesystem::path capturePath = {};
const bool captureRequested = m_autoScreenshot.TryBeginCapture(capturePath);
void EditorWindowRuntimeController::CaptureIfRequested(
const ::XCEngine::UI::UIDrawData& drawData,
UINT pixelWidth,
UINT pixelHeight,
bool framePresented) {
m_autoScreenshot.CaptureIfRequested(
m_renderer,
m_windowRenderer,
drawData,
pixelWidth,
pixelHeight,
framePresented);
Host::D3D12WindowRenderLoopPresentResult result =
m_windowRenderLoop.Present(
drawData,
captureRequested ? &capturePath : nullptr);
if (captureRequested) {
const bool captureSucceeded = result.framePresented && result.captureSucceeded;
if (captureSucceeded) {
m_autoScreenshot.CompleteCaptureSuccess(capturePath);
LogRuntimeTrace("capture", "native d3d12 capture succeeded: " + capturePath.string());
} else {
std::string captureError = result.captureError;
if (captureError.empty()) {
captureError = !result.warning.empty()
? result.warning
: "Screenshot capture did not complete.";
}
m_autoScreenshot.CompleteCaptureFailure(std::move(captureError));
LogRuntimeTrace(
"capture",
"native d3d12 capture failed: " + m_autoScreenshot.GetLastCaptureError());
}
}
return result;
}
void EditorWindowRuntimeController::RequestManualScreenshot(std::string reason) {