mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 18:51:16 +00:00
Fixes
This commit is contained in:
parent
f80e3dc3f7
commit
459420bfcb
@ -599,21 +599,18 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::VTable0x44(
|
|||||||
|
|
||||||
MxU8* bitmapSrcPtr = p_bitmap->GetStart(0, 0);
|
MxU8* bitmapSrcPtr = p_bitmap->GetStart(0, 0);
|
||||||
MxU16* surfaceData = (MxU16*) ddsd.lpSurface;
|
MxU16* surfaceData = (MxU16*) ddsd.lpSurface;
|
||||||
MxU32 widthNormal = p_bitmap->GetBmiWidth();
|
MxLong widthNormal = p_bitmap->GetBmiWidth();
|
||||||
MxU32 heightAbs = p_bitmap->GetBmiHeightAbs();
|
MxLong heightAbs = p_bitmap->GetBmiHeightAbs();
|
||||||
|
|
||||||
// How many bytes are there for each row of the bitmap?
|
// TODO: Probably p_bitmap->GetAdjustedStride()
|
||||||
// (i.e. the image stride)
|
|
||||||
// If this is a bottom-up DIB, we will walk it in reverse.
|
|
||||||
// TODO: Same rounding trick as in MxBitmap
|
|
||||||
MxS32 rowSeek = p_bitmap->GetBmiStride();
|
MxS32 rowSeek = p_bitmap->GetBmiStride();
|
||||||
if (p_bitmap->GetBmiHeader()->biCompression != BI_RGB_TOPDOWN && p_bitmap->GetBmiHeight() >= 0)
|
if (p_bitmap->GetBmiHeader()->biCompression != BI_RGB_TOPDOWN && p_bitmap->GetBmiHeight() >= 0)
|
||||||
rowSeek = -rowSeek;
|
rowSeek = -rowSeek;
|
||||||
|
|
||||||
MxU32 newPitch = ddsd.lPitch;
|
MxLong newPitch = ddsd.lPitch;
|
||||||
switch (ddsd.ddpfPixelFormat.dwRGBBitCount) {
|
switch (ddsd.ddpfPixelFormat.dwRGBBitCount) {
|
||||||
case 8: {
|
case 8: {
|
||||||
for (heightAbs > 0; heightAbs--;) {
|
for (MxS32 y = heightAbs; y > 0; y--) {
|
||||||
memcpy(surfaceData, bitmapSrcPtr, p_bitmap->GetBmiHeight());
|
memcpy(surfaceData, bitmapSrcPtr, p_bitmap->GetBmiHeight());
|
||||||
bitmapSrcPtr += rowSeek;
|
bitmapSrcPtr += rowSeek;
|
||||||
surfaceData = (MxU16*) ((MxU8*) surfaceData + newPitch);
|
surfaceData = (MxU16*) ((MxU8*) surfaceData + newPitch);
|
||||||
@ -663,8 +660,8 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::VTable0x44(
|
|||||||
surface->SetColorKey(DDCKEY_SRCBLT, &key);
|
surface->SetColorKey(DDCKEY_SRCBLT, &key);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (int y = heightAbs; y > 0; y--) {
|
for (MxS32 y = heightAbs; y > 0; y--) {
|
||||||
for (int x = widthNormal; x > 0; x--) {
|
for (MxS32 x = widthNormal; x > 0; x--) {
|
||||||
*surfaceData++ = m_16bitPal[*bitmapSrcPtr++];
|
*surfaceData++ = m_16bitPal[*bitmapSrcPtr++];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user