_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;
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;
}
}