mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 18:51:16 +00:00
Improvements
This commit is contained in:
parent
871f59bfa9
commit
7f61562ecd
@ -81,6 +81,13 @@ class MxBitmap : public MxCore {
|
|||||||
MxLong alignedWidth = AlignToFourByte(m_bmiHeader->biWidth);
|
MxLong alignedWidth = AlignToFourByte(m_bmiHeader->biWidth);
|
||||||
return alignedWidth * absHeight;
|
return alignedWidth * absHeight;
|
||||||
}
|
}
|
||||||
|
inline MxLong GetAdjustedStride()
|
||||||
|
{
|
||||||
|
if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN || m_bmiHeader->biHeight < 0)
|
||||||
|
return GetBmiStride();
|
||||||
|
else
|
||||||
|
return -GetBmiStride();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MxResult ImportColorsToPalette(RGBQUAD*, MxPalette*);
|
MxResult ImportColorsToPalette(RGBQUAD*, MxPalette*);
|
||||||
|
|||||||
@ -327,10 +327,9 @@ void MxDisplaySurface::VTable0x28(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hr == DD_OK) {
|
if (hr == DD_OK) {
|
||||||
BITMAPINFOHEADER* biHeader = p_bitmap->GetBmiHeader();
|
|
||||||
MxU8* data;
|
MxU8* data;
|
||||||
|
|
||||||
switch (biHeader->biCompression) {
|
switch (p_bitmap->GetBmiHeader()->biCompression) {
|
||||||
case BI_RGB: {
|
case BI_RGB: {
|
||||||
MxS32 rowsBeforeTop;
|
MxS32 rowsBeforeTop;
|
||||||
if (p_bitmap->GetBmiHeight() < 0)
|
if (p_bitmap->GetBmiHeight() < 0)
|
||||||
@ -360,16 +359,10 @@ void MxDisplaySurface::VTable0x28(
|
|||||||
switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) {
|
switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) {
|
||||||
case 8: {
|
case 8: {
|
||||||
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 = p_bitmap->GetAdjustedStride();
|
||||||
|
|
||||||
if (biHeader->biCompression == BI_RGB_TOPDOWN || p_bitmap->GetBmiHeight() < 0)
|
|
||||||
stride = p_bitmap->GetBmiStride();
|
|
||||||
else
|
|
||||||
stride = -p_bitmap->GetBmiStride();
|
|
||||||
|
|
||||||
MxLong v22 = stride - p_width;
|
MxLong v22 = stride - p_width;
|
||||||
MxLong v55 = ddsd.lPitch - (2 * p_width);
|
MxLong length = ddsd.lPitch - (2 * p_width);
|
||||||
|
|
||||||
while (p_height--) {
|
while (p_height--) {
|
||||||
MxU8* surfaceBefore = surface;
|
MxU8* surfaceBefore = surface;
|
||||||
|
|
||||||
@ -381,7 +374,7 @@ void MxDisplaySurface::VTable0x28(
|
|||||||
}
|
}
|
||||||
|
|
||||||
data += v22;
|
data += v22;
|
||||||
surface += v55;
|
surface += length;
|
||||||
|
|
||||||
memcpy(surface, surfaceBefore, 2 * p_width);
|
memcpy(surface, surfaceBefore, 2 * p_width);
|
||||||
surface += ddsd.lPitch;
|
surface += ddsd.lPitch;
|
||||||
@ -390,12 +383,7 @@ void MxDisplaySurface::VTable0x28(
|
|||||||
}
|
}
|
||||||
case 16: {
|
case 16: {
|
||||||
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 = p_bitmap->GetAdjustedStride();
|
||||||
|
|
||||||
if (biHeader->biCompression == BI_RGB_TOPDOWN || p_bitmap->GetBmiHeight() < 0)
|
|
||||||
stride = p_bitmap->GetBmiStride();
|
|
||||||
else
|
|
||||||
stride = -p_bitmap->GetBmiStride();
|
|
||||||
|
|
||||||
stride -= p_width;
|
stride -= p_width;
|
||||||
MxS32 length = p_width * 4;
|
MxS32 length = p_width * 4;
|
||||||
@ -448,33 +436,22 @@ void MxDisplaySurface::VTable0x28(
|
|||||||
switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) {
|
switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) {
|
||||||
case 8: {
|
case 8: {
|
||||||
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 = p_bitmap->GetAdjustedStride();
|
||||||
|
|
||||||
if (biHeader->biCompression == BI_RGB_TOPDOWN || p_bitmap->GetBmiHeight() < 0)
|
MxLong length = ddsd.lPitch;
|
||||||
stride = p_bitmap->GetBmiStride();
|
|
||||||
else
|
|
||||||
stride = -p_bitmap->GetBmiStride();
|
|
||||||
|
|
||||||
MxLong v57 = ddsd.lPitch;
|
|
||||||
while (p_height--) {
|
while (p_height--) {
|
||||||
memcpy(surface, data, p_width);
|
memcpy(surface, data, p_width);
|
||||||
data += stride;
|
data += stride;
|
||||||
surface += v57;
|
surface += length;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 16: {
|
case 16: {
|
||||||
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 = p_bitmap->GetAdjustedStride();
|
||||||
|
|
||||||
if (biHeader->biCompression == BI_RGB_TOPDOWN || p_bitmap->GetBmiHeight() < 0)
|
|
||||||
stride = p_bitmap->GetBmiStride();
|
|
||||||
else
|
|
||||||
stride = -p_bitmap->GetBmiStride();
|
|
||||||
|
|
||||||
MxLong v50 = stride - p_width;
|
MxLong v50 = stride - p_width;
|
||||||
MxLong length = ddsd.lPitch - (2 * p_width);
|
MxLong length = ddsd.lPitch - (2 * p_width);
|
||||||
|
|
||||||
for (MxS32 i = 0; p_height > i; i++) {
|
for (MxS32 i = 0; p_height > i; i++) {
|
||||||
for (MxS32 j = 0; p_width > j; j++) {
|
for (MxS32 j = 0; p_width > j; j++) {
|
||||||
*(MxU16*) surface = m_16bitPal[*data++];
|
*(MxU16*) surface = m_16bitPal[*data++];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user