Improve macOS Retina UI clarity and bundle HD assets

This commit is contained in:
shen
2026-09-30 16:13:31 -07:00
parent 905f23f135
commit d1f8d3dddd
26 changed files with 505 additions and 134 deletions
@@ -0,0 +1,35 @@
# macOS UI clarity evidence
The 40250 UI layout, item data, UVs and hit testing remain unchanged. Host rendering
snaps axis-aligned image origins to physical pixels and selects nearest sampling only
when sampled texels match physical pixels. Scaled images retain linear sampling.
Font atlases rebuild between script frames on display-density changes, preserving
cached character-info node addresses and logical metrics. HiDPI pages use 8-bit alpha.
The HD pipeline completed all 2406 images without skips (1898 icon, 384 UI and 124
Chinese locale images). The resulting 135.1 MiB archive is validated and embedded in
`dist/Metin2.app/Contents/Resources/hd_ui.pak`. Generated game assets remain private
build artifacts. The package includes SDL3, Vulkan loader and MoltenVK, uses bundled
rpaths and passes `codesign --verify --deep --strict` with local ad-hoc signatures.
Validation on 2026-09-30:
- Full native CTest: 29 passed, 2 skipped (codepage data absent and no live server).
- `host.ui_quality`: physical snapping, sampling decisions, font-density rounding,
valid archive lookup and malformed/truncated archive rejection.
- `port.text`: transitions 1→2→3→1→2 preserve character pointers, logical text
dimensions and advances; HiDPI page sizes and non-4-bit alpha are checked.
Linking this test with the previous font implementation fails 9 new assertions.
- Desktop and mobile-mode login flow pass. Native release renderer and Android debug
APK builds pass.
- Packaged launcher run from `/` loads 2406 bundled textures and reports 2× glyphs
at density 2.000. A two-frame local-server inventory fixture inserts weapon,
armor, jewelry and consumables, then opens and refreshes the inventory.
- Before and after images are `build/mac-ui-items-before.png` and
`build/mac-ui-items-after.png`, both 2560×1600. Visual inspection confirms sharper
inventory icon contours, slot borders and bottom toolbar detail.
This is macOS clarity evidence, not Windows pixel parity. Actual movement between
physical monitors of different density remains unverified. Original low-resolution
art still limits recoverable detail; `MT_HD_UI=0` retains an original-art comparison.
The HUD aggregate contract remains PARTIAL.
+2
View File
@@ -644,3 +644,5 @@
{"date": "2026-09-30", "unit": "ScriptLib/Resource.cpp", "action": "port", "evidence": "verbatim 40250 (was a rewrite that also registered .png); ctest 29/29, screenshot unchanged"}
{"date": "2026-09-30", "unit": "EterGrnLib/ModelInstanceUpdate.cpp", "action": "fix-platform-adapter", "evidence": "2026-09-30: native Granny adapter now selects the model-named track group, preserving all group metadata and limiting bone binding to that group. Real packed bear walk/run (auxiliary Hedra before Bip01) fail with the previous runtime and pass in tests/port/port_granny_root_motion_test.cpp. See audit/evidence/2026-09-30-bear-root-motion.md."}
{"date": "2026-09-30", "unit": "EffectLib/ParticleSystemInstance.cpp", "action": "fix-platform-adapter", "evidence": "XRGB destination alpha semantics fixed in Vulkan pipeline; focused mapping + GPU pixel regression; original particle logic unchanged; desktop/mobile login regressions and Android build pass."}
{"date": "2026-09-30", "unit": "EterLib/GrpFontTexture.cpp", "action": "improve-platform-rendering", "evidence": "Retina UI clarity: dynamic font atlas rebuild preserving cached pointers and logical metrics, 8-bit HiDPI glyph alpha, physical pixel alignment and 1:1 sampling; 2406 bundled HD textures. Full native suite 29 passed, 2 skipped, macOS packaged inventory screenshots and strict signature verification. See audit/evidence/2026-09-30-mac-ui-clarity.md."}
{"date": "2026-09-30", "unit": "EterLib/GrpImageInstance.cpp", "action": "improve-platform-rendering", "evidence": "Retina UI clarity: dynamic font atlas rebuild preserving cached pointers and logical metrics, 8-bit HiDPI glyph alpha, physical pixel alignment and 1:1 sampling; 2406 bundled HD textures. Full native suite 29 passed, 2 skipped, macOS packaged inventory screenshots and strict signature verification. See audit/evidence/2026-09-30-mac-ui-clarity.md."}
+7 -2
View File
@@ -4261,9 +4261,14 @@
"project/name_show_test.gd",
"project/char_status_ui_test.gd",
"project/test_taskbar_quickslot_parity.gd",
"project/taskbar_dock_test.gd"
"project/taskbar_dock_test.gd",
"tests/host/ui_quality_test.cpp",
"tests/port/port_text_test.cpp"
],
"last_test_result": "PARTIAL"
"last_test_result": "PARTIAL",
"commands": [
"2026-09-30: native UI HiDPI font refresh and sampling checks PASS; previous font runtime fails 9 new assertions. Full native CTest: 29 pass, codepage and live login skipped. Actual mac app HD archive/launch/screenshot checks recorded in audit/evidence/2026-09-30-mac-ui-clarity.md. Aggregate HUD parity remains PARTIAL."
]
},
"remaining": [
"在正式 GameScene 创建并注入唯一 TargetUI,移除/隐藏简化目标条并补生产链回归",
@@ -48,7 +48,7 @@
"test": [
"tests/port/port_text_test.cpp"
],
"note": "40250: deletes each HFONT of the font map. Port: also deletes its oversampled twin. Invariant: 40250 teardown; no leaked GDI fonts."
"note": "40250 deletes fonts/pages. PORT also unregisters the live raster atlas and deletes oversampled twins; rebuilding preserves cached character-info node addresses. See docs/MAC-UI-CLARITY.md and audit/evidence/2026-09-30-mac-ui-clarity.md."
},
"CGraphicFontTexture::CreateDeviceObjects": {
"status": "PORTED",
@@ -76,7 +76,7 @@
"test": [
"tests/port/port_text_test.cpp"
],
"note": "40250: the page DIB is width x height. Port: width*s x height*s for oversample s (1 by default = 40250). Invariant: logical page size, metrics and UVs unchanged."
"note": "40250 retains logical font metrics and atlas dimensions. PORT allocates 1–4x raster pages and registers successful atlases for monitor-density refresh; port.text verifies unchanged width/height/advance and stable glyph pointers. See docs/MAC-UI-CLARITY.md and audit/evidence/2026-09-30-mac-ui-clarity.md."
},
"CGraphicFontTexture::GetFont": {
"status": "ADAPTED",
@@ -89,22 +89,24 @@
"note": "40250: CreateFontIndirect per code page. Port: with s > 1 also creates an s-times-height twin for drawing. Invariant: the measuring font is the 40250 one."
},
"CGraphicFontTexture::AppendTexture": {
"status": "PORTED",
"status": "ADAPTED",
"impl": [
"src/platform/EterLib/GrpFontTexture.cpp:CGraphicFontTexture::AppendTexture"
],
"test": [
"tests/port/port_text_test.cpp"
]
],
"note": "40250 creates A4R4G4B4 pages. PORT uses A8R8G8B8 for HiDPI pages to retain 256 coverage levels; 1x still uses A4R4G4B4. tests/port/port_text_test.cpp checks alpha finer than 4-bit. See docs/MAC-UI-CLARITY.md and audit/evidence/2026-09-30-mac-ui-clarity.md."
},
"CGraphicFontTexture::UpdateTexture": {
"status": "PORTED",
"status": "ADAPTED",
"impl": [
"src/platform/EterLib/GrpFontTexture.cpp:CGraphicFontTexture::UpdateTexture"
],
"test": [
"tests/port/port_text_test.cpp"
]
],
"note": "40250 copies DIB cells into 16-bit pages. PORT copies 32-bit ARGB rows for HiDPI pages; 1x retains the original conversion. Tests check actual published memory textures. See docs/MAC-UI-CLARITY.md and audit/evidence/2026-09-30-mac-ui-clarity.md."
},
"CGraphicFontTexture::GetCharacterInfomation": {
"status": "PORTED",
@@ -123,7 +125,7 @@
"test": [
"tests/port/port_text_test.cpp"
],
"note": "40250: TextOutW with the 1x font, bilevel threshold into A4R4G4B4. Port: with s > 1 draws the glyph with the twin into the s-scaled cell keeping coverage alpha; s == 1 is the 40250 path. Invariant: width/height/advance and packing are the logical 1x values."
"note": "40250 measures the logical font and caches metrics/UVs. PORT draws oversampled white glyphs with 8-bit coverage and preserves logical metrics. Monitor changes rebuild map values in place without invalidating text-instance pointers; port.text tests 1→2→3→1→2 scales. See docs/MAC-UI-CLARITY.md and audit/evidence/2026-09-30-mac-ui-clarity.md."
},
"CGraphicFontTexture::CheckTextureIndex": {
"status": "PORTED",
@@ -57,7 +57,7 @@
"test": [
"tests/port/port_grp_resource_test.cpp"
],
"note": "40250: SetPDTStream + DEFAULT_IB_FILL_RECT + stage-0 texture, DrawIndexedPrimitive. Port: the same four TPDTVertex corners/UVs/diffuse go to UIRenderAddImage. Invariant: quad = image rect at m_v2Position-0.5, UVs = rect/texture size."
"note": "40250: SetPDTStream + DEFAULT_IB_FILL_RECT + stage-0 texture, DrawIndexedPrimitive. Port: the same four TPDTVertex corners/UVs/diffuse go to UIRenderAddImage. Invariant: quad = image rect at m_v2Position-0.5, UVs = rect/texture size. 2026-09-30: native host snaps axis-aligned quad origins by at most half a physical pixel and uses point sampling only at 1:1 texel/pixel density; source layout/UVs and rotated quads unchanged. host.ui_quality + mac UI screenshots. See docs/MAC-UI-CLARITY.md."
},
"CGraphicImageInstance::GetTextureReference": {
"status": "PORTED",