isle-portable/LEGO1/lego/sources/misc
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
..
legocontainer.cpp Plug memory leaks while moving around in the Information Center (#768) 2026-01-06 04:17:23 +01:00
legocontainer.h Match LegoOmni::Create(), other BETA10 matches (#1651) 2025-07-25 17:13:34 +02:00
legoimage.cpp Rescale save-loaded textures to runtime texture dimensions 2026-05-14 18:12:36 -07:00
legoimage.h Rescale save-loaded textures to runtime texture dimensions 2026-05-14 18:12:36 -07:00
legospline.cpp Merge remote-tracking branch 'isle/master' 2026-01-30 17:06:10 -08:00
legospline.h Clear unknowns in LegoUnknown and rename to LegoSpline (#1711) 2026-01-10 20:00:26 +01:00
legostorage.cpp Let LegoStorage know of memory size (#129) 2025-05-20 02:18:11 +02:00
legostorage.h Let LegoStorage know of memory size (#129) 2025-05-20 02:18:11 +02:00
legotexture.cpp Pad all single-digit hexadecimal values with zero (#504) 2024-01-29 22:17:17 +01:00
legotexture.h Implement misc.lib (#483) 2024-01-24 18:12:57 +01:00
legotree.cpp Use sizeof(type) instead of sizeof(variableName) when (de)serializing data (#1505) 2025-05-18 22:56:28 +02:00
legotree.h Complete LegoCarBuildAnimPresenter (#1114) 2024-10-20 14:00:44 -07:00
legotypes.h Get the game working on 64bit systems (#113) 2025-05-19 17:56:12 +02:00
legoutil.h Integrate SDL Haptic API (#607) 2025-07-15 23:47:37 +02:00
version.h Implement/match LegoModelPresenter::CreateROI (#591) 2024-02-24 17:48:16 +01:00