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