refactor(new_editor): unify d3d12 text run caching

This commit is contained in:
2026-04-21 21:07:06 +08:00
parent 5d3d52496e
commit 0f84e52c21
6 changed files with 131 additions and 366 deletions

View File

@@ -20,6 +20,14 @@ namespace XCEngine::UI::Editor::Host {
class D3D12UiTextSystem final : public ::XCEngine::UI::Editor::UIEditorTextMeasurer {
public:
struct RasterizedTextRun {
std::vector<std::uint8_t> rgbaPixels = {};
UINT width = 0u;
UINT height = 0u;
float offsetX = 0.0f;
float offsetY = 0.0f;
};
struct ShapedGlyph {
Microsoft::WRL::ComPtr<IDWriteFontFace> fontFace = {};
std::uint16_t glyphIndex = 0u;
@@ -67,9 +75,7 @@ public:
bool RasterizeTextMask(
std::string_view text,
float fontSize,
std::vector<std::uint8_t>& outRgbaPixels,
UINT& outWidth,
UINT& outHeight,
RasterizedTextRun& outRun,
std::string& outError);
private: