Fix writing default texture (#1602)

This commit is contained in:
Christian Semmler 2025-07-02 17:07:16 -07:00 committed by GitHub
parent 89fe7fa924
commit 4d8ba1986e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -705,14 +705,14 @@ void WriteDefaultTexture(LegoStorage* p_storage, const char* p_name)
if (image != NULL) {
if (desc.dwWidth == desc.lPitch) {
memcpy(desc.lpSurface, image->GetBits(), desc.dwWidth * desc.dwHeight);
memcpy(image->GetBits(), desc.lpSurface, desc.dwWidth * desc.dwHeight);
}
else {
MxU8* surface = (MxU8*) desc.lpSurface;
const LegoU8* bits = image->GetBits();
LegoU8* bits = image->GetBits();
for (MxS32 i = 0; i < desc.dwHeight; i++) {
memcpy(surface, bits, desc.dwWidth);
memcpy(bits, surface, desc.dwWidth);
surface += desc.lPitch;
bits += desc.dwWidth;
}