[BOOTVID] Fix BitBlt behavior (#2936)

This commit is contained in:
Dmitry Borisov 2020-06-21 19:21:46 +06:00 committed by Stanislav Motylkov
parent da9384b918
commit 5d40981efa
No known key found for this signature in database
GPG key ID: AFE513258CBA9E92

View file

@ -55,9 +55,9 @@ BitBlt(
_In_ ULONG BitsPerPixel,
_In_ ULONG Delta)
{
ULONG sx, dx, dy;
UCHAR color;
ULONG offset = 0;
ULONG X, Y, Pixel;
UCHAR Colors;
PUCHAR InputBuffer;
const ULONG Bottom = Top + Height;
const ULONG Right = Left + Width;
@ -82,24 +82,28 @@ BitBlt(
PrepareForSetPixel();
/* 4bpp blitting */
for (dy = Top; dy < Bottom; ++dy)
for (Y = Top; Y < Bottom; ++Y)
{
sx = 0;
do
InputBuffer = Buffer;
for (X = Left, Pixel = 0;
X < Right;
++X, ++Pixel)
{
/* Extract color */
color = Buffer[offset + sx];
if (Pixel % 2 == 0)
{
/* Extract colors at every two pixels */
Colors = *InputBuffer++;
/* Calc destination x */
dx = Left + (sx << 1);
SetPixel(X, Y, Colors >> 4);
}
else
{
SetPixel(X, Y, Colors & 0x0F);
}
}
/* Set two pixels */
SetPixel(dx, dy, color >> 4);
SetPixel(dx + 1, dy, color & 0x0F);
sx++;
} while (dx < Right);
offset += Delta;
Buffer += Delta;
}
}