This commit is contained in:
Christian Semmler 2023-12-30 17:47:01 -05:00
parent 52a753f008
commit 23095c0ce0

View File

@ -334,7 +334,7 @@ void MxDisplaySurface::VTable0x28(
case BI_RGB: { case BI_RGB: {
MxS32 rowsBeforeTop; MxS32 rowsBeforeTop;
if (p_bitmap->GetBmiHeight() < 0) if (p_bitmap->GetBmiHeight() < 0)
rowsBeforeTop = 0; rowsBeforeTop = p_top;
else else
rowsBeforeTop = p_bitmap->GetBmiHeightAbs() - p_top - 1; rowsBeforeTop = p_bitmap->GetBmiHeightAbs() - p_top - 1;
data = p_bitmap->GetBitmapData() + p_left + (p_bitmap->GetBmiStride() * rowsBeforeTop); data = p_bitmap->GetBitmapData() + p_left + (p_bitmap->GetBmiStride() * rowsBeforeTop);
@ -359,7 +359,6 @@ void MxDisplaySurface::VTable0x28(
switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) { switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) {
case 8: { case 8: {
OutputDebugStr("Flag, Case 8bit");
MxU8* surface = (MxU8*) ddsd.lpSurface + p_right + (p_bottom * ddsd.lPitch); MxU8* surface = (MxU8*) ddsd.lpSurface + p_right + (p_bottom * ddsd.lPitch);
MxLong stride; MxLong stride;
@ -382,10 +381,9 @@ void MxDisplaySurface::VTable0x28(
} }
data += v22; data += v22;
MxU8* dest = surface + v55;
memcpy(dest, surfaceBefore, 2 * p_width); memcpy(&surface[v55], surfaceBefore, 2 * p_width);
surface = dest + ddsd.lPitch; surface = &surface[v55] + ddsd.lPitch;
} }
break; break;
} }
@ -398,56 +396,40 @@ void MxDisplaySurface::VTable0x28(
else else
stride = -p_bitmap->GetBmiStride(); stride = -p_bitmap->GetBmiStride();
MxLong v31 = 4 * p_width; MxS32 length = p_width * 4;
MxLong v56 = stride - p_width; MxLong v56 = stride - p_width;
MxS32 v61 = p_width; MxLong v62 = ddsd.lPitch - length;
MxLong v62 = ddsd.lPitch - (4 * p_width);
MxU16* p16BitPal = m_16bitPal; MxU16* p16BitPal = m_16bitPal;
if (stride != p_width || v62) { if (stride != p_width || v62) {
OutputDebugStr("Flag, Case 16bit A");
while (p_height--) { while (p_height--) {
MxU8* surfaceBefore = surface; MxU8* surfaceBefore = surface;
if (v61 > 0) { for (MxS32 i = p_width; i > 0; i--) {
MxS32 v38 = v61; MxU16 element = p16BitPal[*data++];
do { surface += 4;
MxU32 element = *data++; *((MxU16*) surface - 2) = element;
element = p16BitPal[element]; *((MxU16*) surface - 1) = element;
surface += 4;
*((MxU16*) surface - 2) = element;
--v38;
*((MxU16*) surface - 1) = element;
} while (v38);
} }
data += v56; data += v56;
MxU8* dest = &surface[v62];
memcpy(dest, surfaceBefore, 4 * ((MxU32) (4 * p_width) >> 2)); memcpy(&surface[v62], surfaceBefore, length);
surface = dest + ddsd.lPitch; surface = &surface[v62] + ddsd.lPitch;
} }
} }
else { else {
OutputDebugStr("Flag, Case 16bit B");
while (p_height--) { while (p_height--) {
MxU8* surfaceBefore = surface; MxU8* surfaceBefore = surface;
if (v61 > 0) { for (MxS32 i = p_width; i > 0; i--) {
MxS32 v34 = v61; MxU16 element = p16BitPal[*data++];
do { surface += 4;
MxU32 element = *data++; *((MxU16*) surface - 2) = element;
element = p16BitPal[element]; *((MxU16*) surface - 1) = element;
surface += 4;
*((MxU16*) surface - 2) = element;
--v34;
*((MxU16*) surface - 1) = element;
} while (v34);
} }
memcpy(surface, surfaceBefore, v31); memcpy(surface, surfaceBefore, length);
surface += ddsd.lPitch; surface += ddsd.lPitch;
} }
} }
@ -457,7 +439,6 @@ void MxDisplaySurface::VTable0x28(
else { else {
switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) { switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) {
case 8: { case 8: {
OutputDebugStr("No flag, Case 8bit");
MxU8* surface = (MxU8*) ddsd.lpSurface + p_right + (p_bottom * ddsd.lPitch); MxU8* surface = (MxU8*) ddsd.lpSurface + p_right + (p_bottom * ddsd.lPitch);
MxLong stride; MxLong stride;
@ -476,7 +457,6 @@ void MxDisplaySurface::VTable0x28(
break; break;
} }
case 16: { case 16: {
OutputDebugStr("No flag, Case 16bit");
MxU8* surface = (MxU8*) ddsd.lpSurface + (2 * p_right) + (p_bottom * ddsd.lPitch); MxU8* surface = (MxU8*) ddsd.lpSurface + (2 * p_right) + (p_bottom * ddsd.lPitch);
MxLong stride; MxLong stride;