isle-portable/LEGO1/lego
Christian Semmler 5d9f92a029
Rescale save-loaded textures to runtime texture dimensions
`LegoTextureInfo::LoadBits` sized its memcpy from the destination
DirectDraw surface and assumed the source bits matched. They don't
when the save was made under a different renderer than the current
one: HW mode squares non-square assets in `LegoImage::Read` (e.g.
128x32 -> 128x128 via row duplication), SW mode keeps the original
dimensions, and `ReadNamedTexture` always loads with `p_square=0`,
so saved bits keep whatever size they had at save time. SW save
loaded under HW caused an OOB read in `LoadBits`; HW save loaded
under SW silently truncated the source and rendered a distorted
texture.

Add `LegoImage::Resize(width, height)` (nearest-neighbor, handles
both up- and down-scale) and call it in `LoadFromNamedTexture` to
match the runtime `LegoTextureInfo` surface dimensions before
binding. Save format unchanged; `LoadBits` signature unchanged.
Square textures and matching-mode loads short-circuit on the
fast-path.
2026-05-14 18:12:36 -07:00
..
legoomni Rescale save-loaded textures to runtime texture dimensions 2026-05-14 18:12:36 -07:00
sources Rescale save-loaded textures to runtime texture dimensions 2026-05-14 18:12:36 -07:00