Reuse panel frame composition in native XCUI shell

This commit is contained in:
2026-04-05 17:41:31 +08:00
parent 63b5f12b93
commit 3db09ea5d0
10 changed files with 651 additions and 954 deletions

View File

@@ -13,6 +13,29 @@
namespace XCEngine {
namespace NewEditor {
struct XCUILayoutLabFrameCompositionRequest {
::XCEngine::Editor::XCUIBackend::XCUIPanelCanvasSession canvasSession = {};
::XCEngine::Editor::XCUIBackend::XCUIInputBridgeFrameSnapshot inputSnapshot = {};
};
struct XCUILayoutLabFrameComposition {
::XCEngine::Editor::XCUIBackend::XCUIPanelCanvasSession canvasSession = {};
::XCEngine::Editor::XCUIBackend::XCUIInputBridgeFrameSnapshot inputSnapshot = {};
::XCEngine::Editor::XCUIBackend::XCUIInputBridgeFrameDelta inputDelta = {};
::XCEngine::Editor::XCUIBackend::XCUILayoutLabInputState inputState = {};
::XCEngine::Editor::XCUIBackend::XCUIHostedPreviewStats previewStats = {};
::XCEngine::Editor::XCUIBackend::XCUIHostedPreviewSurfaceDescriptor hostedSurfaceDescriptor = {};
::XCEngine::Editor::XCUIBackend::XCUIHostedPreviewSurfaceImage hostedSurfaceImage = {};
const ::XCEngine::Editor::XCUIBackend::XCUILayoutLabFrameResult* frameResult = nullptr;
std::string previewPathLabel = {};
std::string previewStateLabel = {};
std::string previewSourceLabel = {};
bool hostedPreviewEnabled = true;
bool nativeHostedPreview = false;
bool hasHostedSurfaceDescriptor = false;
bool showHostedSurfaceImage = false;
};
class XCUILayoutLabPanel : public Panel {
public:
explicit XCUILayoutLabPanel(
@@ -24,6 +47,8 @@ public:
~XCUILayoutLabPanel() override = default;
void Render() override;
const XCUILayoutLabFrameComposition& ComposeFrame(
const XCUILayoutLabFrameCompositionRequest& request);
void SetHostedPreviewEnabled(bool enabled);
void SetHostedPreviewPresenter(
std::unique_ptr<::XCEngine::Editor::XCUIBackend::IXCUIHostedPreviewPresenter> previewPresenter);
@@ -32,7 +57,9 @@ public:
bool IsHostedPreviewEnabled() const { return m_hostedPreviewEnabled; }
bool IsUsingNativeHostedPreview() const;
const ::XCEngine::Editor::XCUIBackend::XCUILayoutLabFrameResult& GetFrameResult() const;
const XCUILayoutLabFrameComposition& GetLastFrameComposition() const;
const ::XCEngine::Editor::XCUIBackend::XCUIHostedPreviewStats& GetLastPreviewStats() const;
bool GetLastReloadSucceeded() const { return m_lastReloadSucceeded; }
bool TryGetElementRect(const std::string& elementId, ::XCEngine::UI::UIRect& outRect) const;
private:
@@ -44,6 +71,7 @@ private:
std::unique_ptr<::XCEngine::Editor::XCUIBackend::IXCUIHostedPreviewPresenter> m_previewPresenter;
std::unique_ptr<::XCEngine::Editor::XCUIBackend::IXCUIPanelCanvasHost> m_canvasHost;
::XCEngine::Editor::XCUIBackend::XCUIHostedPreviewStats m_lastPreviewStats = {};
XCUILayoutLabFrameComposition m_lastFrameComposition = {};
};
} // namespace NewEditor