[PR #5357] [MERGED] Reject a nine-slice border that leaves no centre #6235

Closed
opened 2026-11-03 06:16:11 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5357
Author: @MSedgeMC
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix/nine-slice-validate


📝 Commits (2)

📊 Changes

1 file changed (+20 additions, -2 deletions)

View changed files

📝 crates/horizon-client-render/src/ui.rs (+20 -2)

📄 Description

GuiSpriteScaling.NineSlice.validate rejects a sprite whose borders meet — left + right >= width, op + bottom >= height — and a sprite without GUI metadata is drawn with the default stretch scaling. Horizon's parse_nine_slice accepted any border and the draw path silently clamped, so such a sprite was nine-sliced instead of stretched.

Five lines: return None, which the existing no-metadata path already handles.

Two things said plainly rather than implied: the 26.3 jar ships 47 nine-slice sprites and none has an invalid border, so this changes nothing for vanilla assets — only a pack with a broken border. And while the stretch fallback is what orElse(GuiMetadataSection.DEFAULT) does, 26.3 decodes this metadata with getOrThrow inside a catch that logs and returns null, so a rejected sprite may end up dropped rather than stretched; I did not trace it further, and the PR should not claim more than that.

Proven: the new test passes on a build box (border 12 on 20 is rejected, border 9 on 20 is accepted), and the existing nine-slice tests still hold.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5357 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/nine-slice-validate` --- ### 📝 Commits (2) - [`b3061d1`](https://github.com/horizon-rust/horizon/commit/b3061d144b7bb63b055ded2a2cf4ded13f180dd5) Reject a nine-slice border that leaves no centre - [`6c1b6d0`](https://github.com/horizon-rust/horizon/commit/6c1b6d0823d244aae25ac0e0860159c057210eab) Merge main into #5357 ### 📊 Changes **1 file changed** (+20 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/ui.rs` (+20 -2) </details> ### 📄 Description GuiSpriteScaling.NineSlice.validate rejects a sprite whose borders meet — left + right >= width, op + bottom >= height — and a sprite without GUI metadata is drawn with the default stretch scaling. Horizon's parse_nine_slice accepted any border and the draw path silently clamped, so such a sprite was nine-sliced instead of stretched. Five lines: return None, which the existing no-metadata path already handles. Two things said plainly rather than implied: the 26.3 jar ships 47 nine-slice sprites and **none** has an invalid border, so this changes nothing for vanilla assets — only a pack with a broken border. And while the stretch fallback is what orElse(GuiMetadataSection.DEFAULT) does, 26.3 decodes this metadata with getOrThrow inside a catch that logs and returns null, so a rejected sprite may end up dropped rather than stretched; I did not trace it further, and the PR should not claim more than that. **Proven:** the new test passes on a build box (border 12 on 20 is rejected, border 9 on 20 is accepted), and the existing nine-slice tests still hold. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:16:11 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6235
No description provided.