From a58ceeb85ce9b16bb97afa3052e6f16b8b385f77 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 31 Dec 2023 14:14:04 -0500 Subject: [PATCH] Improvements --- LEGO1/mxdisplaysurface.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/LEGO1/mxdisplaysurface.cpp b/LEGO1/mxdisplaysurface.cpp index 55e5e2f8..3028a6a8 100644 --- a/LEGO1/mxdisplaysurface.cpp +++ b/LEGO1/mxdisplaysurface.cpp @@ -396,17 +396,19 @@ void MxDisplaySurface::VTable0x28( else stride = -p_bitmap->GetBmiStride(); + stride -= p_width; MxS32 length = p_width * 4; MxLong v56 = stride - p_width; MxLong v62 = ddsd.lPitch - length; MxU16* p16BitPal = m_16bitPal; MxS32 height = p_height; + MxS32 width = p_width; - if (stride != p_width || v62) { + if (stride || v62) { while (height--) { MxU8* surfaceBefore = surface; - for (MxS32 i = p_width; i > 0; i--) { + for (MxS32 i = width; i > 0; i--) { MxU16 element = p16BitPal[*data++]; *(MxU16*) surface = element; surface += 2; @@ -426,7 +428,7 @@ void MxDisplaySurface::VTable0x28( while (height--) { MxU8* surfaceBefore = surface; - for (MxS32 i = p_width; i > 0; i--) { + for (MxS32 i = width; i > 0; i--) { MxU16 element = p16BitPal[*data++]; *(MxU16*) surface = element; surface += 2;