Revert "Update new_editor inspector layout and host rendering"

This reverts commit 5d81a64ef3.
This commit is contained in:
2026-04-21 13:55:30 +08:00
parent 64e778da65
commit 2c9e8dad49
62 changed files with 151 additions and 4417 deletions

View File

@@ -1,6 +1,4 @@
#include "NativeRendererHelpers.h"
#include "Support/EnvironmentFlags.h"
#include <algorithm>
#include <cmath>
#include <limits>
@@ -11,17 +9,6 @@ namespace XCEngine::UI::Editor::Host {
using namespace NativeRendererHelpers;
#ifdef _DEBUG
namespace {
bool ShouldEnableD2DDebugLayer() {
return App::IsEnvironmentFlagEnabled("XCUIEDITOR_ENABLE_GPU_DEBUG") ||
App::IsEnvironmentFlagEnabled("XCUIEDITOR_ENABLE_GPU_VALIDATION");
}
} // namespace
#endif
bool NativeRenderer::Initialize(HWND hwnd) {
Shutdown();
@@ -33,9 +20,7 @@ bool NativeRenderer::Initialize(HWND hwnd) {
m_hwnd = hwnd;
D2D1_FACTORY_OPTIONS factoryOptions = {};
#ifdef _DEBUG
if (ShouldEnableD2DDebugLayer()) {
factoryOptions.debugLevel = D2D1_DEBUG_LEVEL_INFORMATION;
}
factoryOptions.debugLevel = D2D1_DEBUG_LEVEL_INFORMATION;
#endif
HRESULT hr = D2D1CreateFactory(
D2D1_FACTORY_TYPE_SINGLE_THREADED,
@@ -522,16 +507,9 @@ void NativeRenderer::RenderRectOutlineCommand(
ID2D1RenderTarget& renderTarget,
ID2D1SolidColorBrush& solidBrush,
const ::XCEngine::UI::UIDrawCommand& command) {
if (command.thickness <= 0.0f ||
command.color.a <= 0.0f ||
command.rect.width <= 0.0f ||
command.rect.height <= 0.0f) {
return;
}
const float dpiScale = ClampDpiScale(m_dpiScale);
const D2D1_RECT_F rect = ToD2DRect(command.rect, dpiScale);
const float thickness = command.thickness * dpiScale;
const float thickness = (command.thickness > 0.0f ? command.thickness : 1.0f) * dpiScale;
const float rounding = command.rounding > 0.0f ? command.rounding * dpiScale : 0.0f;
if (command.rounding > 0.0f) {
renderTarget.DrawRoundedRectangle(
@@ -1093,30 +1071,6 @@ void NativeRenderer::ReleaseTexture(::XCEngine::UI::UITextureHandle& texture) {
texture = {};
}
bool NativeRenderer::ResolveTexturePixelData(
const ::XCEngine::UI::UITextureHandle& texture,
Ports::TexturePixelDataView& outView) const {
outView = {};
if (!texture.IsValid() ||
texture.kind != ::XCEngine::UI::UITextureHandleKind::DescriptorHandle) {
return false;
}
auto* resource = reinterpret_cast<NativeTextureResource*>(texture.nativeHandle);
if (resource == nullptr ||
m_liveTextures.find(resource) == m_liveTextures.end() ||
resource->pixels.empty() ||
resource->width == 0u ||
resource->height == 0u) {
return false;
}
outView.pixels = resource->pixels.data();
outView.width = resource->width;
outView.height = resource->height;
return true;
}
bool NativeRenderer::ResolveTextureBitmap(
ID2D1RenderTarget& renderTarget,
NativeTextureResource& texture,