mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-23 16:21:15 +00:00
More accurate SetupCopyRect
This commit is contained in:
parent
0ce5e79069
commit
4496905736
@ -291,7 +291,7 @@ void MxTransitionManager::SubmitCopyRect(DDSURFACEDESC &ddsc)
|
|||||||
m_copyBuffer = NULL;
|
m_copyBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1004c580 STUB
|
// OFFSET: LEGO1 0x1004c580
|
||||||
void MxTransitionManager::SetupCopyRect(DDSURFACEDESC &ddsc)
|
void MxTransitionManager::SetupCopyRect(DDSURFACEDESC &ddsc)
|
||||||
{
|
{
|
||||||
// Check if the copy rect is setup
|
// Check if the copy rect is setup
|
||||||
@ -304,39 +304,38 @@ void MxTransitionManager::SetupCopyRect(DDSURFACEDESC &ddsc)
|
|||||||
|
|
||||||
// Check if wait indicator has started
|
// Check if wait indicator has started
|
||||||
if (m_waitIndicator->GetCurrentTickleState() >= MxPresenter::TickleState_Streaming) {
|
if (m_waitIndicator->GetCurrentTickleState() >= MxPresenter::TickleState_Streaming) {
|
||||||
MxS32 left = m_waitIndicator->GetLocation().m_x;
|
// Setup the copy rect
|
||||||
MxS32 top = m_waitIndicator->GetLocation().m_y;
|
DWORD copyPitch = (ddsc.ddpfPixelFormat.dwRGBBitCount / 8) * (m_copyRect.right - m_copyRect.left + 1); // This uses m_copyRect, seemingly erroneously
|
||||||
|
|
||||||
DWORD bytesPerPixel = ddsc.ddpfPixelFormat.dwRGBBitCount / 8;
|
DWORD bytesPerPixel = ddsc.ddpfPixelFormat.dwRGBBitCount / 8;
|
||||||
DWORD copyPitch = bytesPerPixel * (m_copyRect.right - m_copyRect.left + 1);
|
|
||||||
|
|
||||||
m_copyRect.left = left;
|
m_copyRect.left = m_waitIndicator->GetLocation().m_x;
|
||||||
m_copyRect.top = top;
|
m_copyRect.top = m_waitIndicator->GetLocation().m_y;
|
||||||
|
|
||||||
MxS32 height = m_waitIndicator->GetHeight();
|
MxS32 height = m_waitIndicator->GetHeight();
|
||||||
MxS32 width = m_waitIndicator->GetWidth();
|
MxS32 width = m_waitIndicator->GetWidth();
|
||||||
|
|
||||||
m_copyRect.right = left + width - 1;
|
m_copyRect.right = m_copyRect.left + width - 1;
|
||||||
m_copyRect.bottom = top + height - 1;
|
m_copyRect.bottom = m_copyRect.top + height - 1;
|
||||||
|
|
||||||
const char *src;
|
// Allocate the copy buffer
|
||||||
char *copyBuffer;
|
const char *src = (const char*)ddsc.lpSurface + m_copyRect.top * ddsc.lPitch + bytesPerPixel * m_copyRect.left;
|
||||||
|
|
||||||
src = (const char*)ddsc.lpSurface + m_copyRect.top * ddsc.lPitch + bytesPerPixel * m_copyRect.left;
|
m_copyBuffer = malloc(bytesPerPixel * width * height);
|
||||||
copyBuffer = (char*)malloc(bytesPerPixel * (m_copyRect.right - m_copyRect.left + 1) * (m_copyRect.bottom - m_copyRect.top + 1));
|
if (!m_copyBuffer)
|
||||||
|
|
||||||
this->m_copyBuffer = copyBuffer;
|
|
||||||
if (!copyBuffer)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (LONG i = 0; i < (m_copyRect.bottom - m_copyRect.top + 1); i++)
|
// Copy into the copy buffer
|
||||||
|
char *dst = (char*)m_copyBuffer;
|
||||||
|
|
||||||
|
for (MxS32 i = 0; i < (m_copyRect.bottom - m_copyRect.top + 1); i++)
|
||||||
{
|
{
|
||||||
memcpy(copyBuffer, src, copyPitch);
|
memcpy(dst, src, copyPitch);
|
||||||
copyBuffer += copyPitch;
|
|
||||||
src += ddsc.lPitch;
|
src += ddsc.lPitch;
|
||||||
|
dst += copyPitch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup display surface
|
||||||
if ((m_waitIndicator->GetAction()->GetFlags() & 0x10) != 0)
|
if ((m_waitIndicator->GetAction()->GetFlags() & 0x10) != 0)
|
||||||
{
|
{
|
||||||
MxDisplaySurface *displaySurface = VideoManager()->GetDisplaySurface();
|
MxDisplaySurface *displaySurface = VideoManager()->GetDisplaySurface();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user