https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5d40981efa6160eac3472…
commit 5d40981efa6160eac3472d815c6bec6464736c27
Author: Dmitry Borisov <di.sean(a)protonmail.com>
AuthorDate: Sun Jun 21 19:21:46 2020 +0600
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Wed Jul 29 19:10:38 2020 +0300
[BOOTVID] Fix BitBlt behavior (#2936)
---
drivers/base/bootvid/common.c | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/drivers/base/bootvid/common.c b/drivers/base/bootvid/common.c
index 87257167ec0..9f4dda4de23 100644
--- a/drivers/base/bootvid/common.c
+++ b/drivers/base/bootvid/common.c
@@ -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
- {
- /* Extract color */
- color = Buffer[offset + sx];
+ InputBuffer = Buffer;
- /* Calc destination x */
- dx = Left + (sx << 1);
+ for (X = Left, Pixel = 0;
+ X < Right;
+ ++X, ++Pixel)
+ {
+ if (Pixel % 2 == 0)
+ {
+ /* Extract colors at every two pixels */
+ Colors = *InputBuffer++;
- /* Set two pixels */
- SetPixel(dx, dy, color >> 4);
- SetPixel(dx + 1, dy, color & 0x0F);
+ SetPixel(X, Y, Colors >> 4);
+ }
+ else
+ {
+ SetPixel(X, Y, Colors & 0x0F);
+ }
+ }
- sx++;
- } while (dx < Right);
- offset += Delta;
+ Buffer += Delta;
}
}