Commit graph

1 commit

Author SHA1 Message Date
Vadim Peretokin
8a8325a6af
fix: three full-window background bugs - vanishing console, lost border colour, huge cover scaling (#9711)
#### Brief overview of PR changes/additions
- `lowerWindow()` moved the main display below the full-window
background widget, so with a background set the whole console (text,
split, scrollbar, command line) vanished for the rest of the session; it
now keeps the background bottom-most.
- `setBorderColor` lived only in `mpMainFrame`'s palette, which
`changeColors()` rebuilds from constants - a game sending an OSC palette
change wiped it with no user action at all - and `getBorderColor()`
returned `0,0,0` under a full-window background. The colour is now
stored on the console.
- `cover` mode scaled the whole source before cropping, so a 3000x100
image in a 1920x1080 window built a 32400x1080 (~140MB) intermediate on
every resize event; it now crops to the target aspect first. Measured
133.5MB/15ms to 0.1MB/3ms, and 890MB for a 20000x100 source.

#### Motivation for adding to Mudlet
All three are in the 5.0 full-window background feature and the first
one makes an ordinary `lowerWindow()` call blank the entire console.

#### Other info (issues closed, discussion etc)
Finding C10 of the 5.0 QA sweep. Introduced by `ae6b017c8` "add:
full-window background image/gradient support" (#9394).

`raiseWindow("main")` and `lowerWindow("main")` both return false today
(`"main"` is never registered in any of the window maps), so there was
no way to undo the first bug from a script - verified, not changed here.

New `WindowBackgroundTest` (17 cases). Five of its assertions were
confirmed to fail before the fix and pass after; the crop-then-scale
order is pinned by comparing the installed brush against a crop-first
render, which a scale-first implementation fails.

Assisted-by: Claude:claude-opus-5

**Test case:** `setBackgroundImage("main",
getMudletHomeDir().."/bg.png", "cover", true)` then `createLabel("l",
10, 10, 100, 100, 1)` then `lowerWindow("l")` - the console stays
visible.
2026-08-07 10:15:11 +02:00