From 70022bf456a3b5b969bacc70121552c872068d4d Mon Sep 17 00:00:00 2001 From: disinvite Date: Sun, 15 Oct 2023 17:53:38 -0400 Subject: [PATCH] for ramen2x --- LEGO1/mxtransitionmanager.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/LEGO1/mxtransitionmanager.cpp b/LEGO1/mxtransitionmanager.cpp index 0b62039a..0c48543f 100644 --- a/LEGO1/mxtransitionmanager.cpp +++ b/LEGO1/mxtransitionmanager.cpp @@ -369,23 +369,21 @@ void MxTransitionManager::Transition_Windows() if (res == DD_OK) { SubmitCopyRect(&ddsd); - MxS32 widthInPixels = ddsd.lPitch / 8; + MxS32 bytesPerPixel = ddsd.ddpfPixelFormat.dwRGBBitCount / 8; + MxS32 bytesPerLine = bytesPerPixel * 640; MxU8 *line = (MxU8 *) ddsd.lpSurface + m_animationTimer * ddsd.lPitch; - memset(line, 0, widthInPixels * 640); + memset(line, 0, bytesPerLine); - MxS32 count = m_animationTimer + 1; - while (count < 480 - m_animationTimer) { + for (MxS32 i = m_animationTimer + 1; i < 480 - m_animationTimer; i++) { line += ddsd.lPitch; - memset(line + m_animationTimer * widthInPixels, 0, ddsd.lPitch / 8); - memset(line + (640 - 1 - m_animationTimer) * widthInPixels, 0, ddsd.lPitch / 8); - - count++; + memset(line + m_animationTimer * bytesPerPixel, 0, bytesPerLine); + memset(line + 640 + (-1 - m_animationTimer) * bytesPerPixel, 0, bytesPerLine); } line += ddsd.lPitch; - memset(line, 0, widthInPixels * 640); + memset(line, 0, bytesPerLine); SetupCopyRect(&ddsd); m_ddSurface->Unlock(ddsd.lpSurface);