No subject


Wed May 12 02:16:52 CEST 2010


do except the standard blit. Most parts of it worked by chance, so I added a
very basic (and common sense) implementation and tested it with plain
non-RLE bitmaps by converting those in ntoskrnl\inbv\logo\ for testing.

At the moment this routine is not even used as it seems, the ntoskrnl
bitmaps are RLE coded by default. Those are processed by the RLEBitBlt
function in the same file. This functions looks a bit better, but could
still require some changes here and there.

Best regards,
Gregor


2010/5/30 Ros Arm <ros.arm at reactos.org>

> Hello!
>
> While the state of the original code is horrendous, and removing it was a
> step in the good direction, this simplified implementation omits many of the
> optimizations and specific VGA tricks that the original "author" of the code
> had intended to duplicate.
>
> If you'd like, I would be open to talking to eVb (we both have some
> experience with VGA programming) to create an efficient 4BitBlt routine
> similar to the original one that has been removed, but one that actually has
> basis in actual fact and isn't of the nature this original implementation
> was.
>
> I can see the original code was converting packed data into per-plane
> (planar) data and had special edge handling, but it looks like the original
> author did not realize this, and most of the modulo-and-shifts appear as
> bitwise ANDs (compiler optimizations), which is just plain confusing.
>
> Since the rest of bootvid is probably the same "quality", we could take a
> good look at it, both from a coding and legal standpoint, if you'd like.
>
> -r
>
> Author: gschneider
> Date: Sun May 30 01:54:47 2010
> New Revision: 47431
>
> URL: http://svn.reactos.org/svn/reactos?rev=47431&view=rev
> Log:
> [BOOTVID] Dramatically simplify 4bpp blitting routine
> See issue #5103 for more details.
>
> Modified:
>   trunk/reactos/drivers/base/bootvid/i386/vga.c
>
> Modified: trunk/reactos/drivers/base/bootvid/i386/vga.c
> URL:
> http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/bootvid/i386/vga.c?rev=47431&r1=47430&r2=47431&view=diff
>
> ==============================================================================
> --- trunk/reactos/drivers/base/bootvid/i386/vga.c [iso-8859-1] (original)
> +++ trunk/reactos/drivers/base/bootvid/i386/vga.c [iso-8859-1] Sun May 30
> 01:54:47 2010
> @@ -402,33 +402,20 @@
>       IN ULONG BitsPerPixel,
>       IN ULONG Delta)
> {
> -    ULONG LeftAnd, LeftShifted, LeftPlusOne, LeftPos;
> -    ULONG lMask, rMask;
> -    UCHAR NotlMask;
> -    ULONG Distance;
> -    ULONG DistanceMinusLeftBpp;
> -    ULONG SomeYesNoFlag, SomeYesNoFlag2;
> -    PUCHAR PixelPosition, m;
> -    PUCHAR i, k;
> -    ULONG j;
> -    ULONG x;
> -    ULONG Plane;
> -    UCHAR LeftArray[84];
> -    PUCHAR CurrentLeft;
> -    PUCHAR l;
> -    ULONG LoopCount;
> -    UCHAR pMask, PlaneShift;
> -    BOOLEAN Odd;
> -    UCHAR Value;
> +    ULONG sx, dx, dy;
> +    UCHAR color;
> +    ULONG offset = 0;
> +    const ULONG Bottom = Top + Height;
> +    const ULONG Right = Left + Width;
>
>    /* Check if the buffer isn't 4bpp */
>    if (BitsPerPixel != 4)
>    {
>        /* FIXME: TODO */
>        DbgPrint("Unhandled BitBlt\n"
> -                 "%lxx%lx @ (%lx,%lx)\n"
> -                 "Bits Per Pixel %lx\n"
> -                 "Buffer: %p. Delta: %lx\n",
> +                 "%lux%lu @ (%lu|%lu)\n"
> +                 "Bits Per Pixel %lu\n"
> +                 "Buffer: %p. Delta: %lu\n",
>                 Width,
>                 Height,
>                 Left,
> @@ -439,181 +426,28 @@
>        return;
>    }
>
> -    /* Get the masks and other values */
> -    LeftAnd = Left & 0x7;
> -    lMask = lMaskTable[LeftAnd];
> -    Distance = Width + Left;
> -    rMask = rMaskTable[(Distance - 1) & 0x7];
> -    Left >>= 3;
> -
> -    /* Set some values */
> -    SomeYesNoFlag = FALSE;
> -    SomeYesNoFlag2 = FALSE;
> -    Distance = (Distance - 1) >> 3;
> -    DistanceMinusLeftBpp = Distance - Left;
> -
> -    /* Check if the distance is equal to the left position and add the
> masks */
> -    if (Left == Distance) lMask += rMask;
> -
> -    /* Check if there's no distance offset */
> -    if (DistanceMinusLeftBpp)
> -    {
> -        /* Set the first flag on */
> -        SomeYesNoFlag = TRUE;
> -
> -        /* Decrease offset and check if we still have one */
> -        if (--DistanceMinusLeftBpp)
> -        {
> -            /* Still have a distance offset */
> -            SomeYesNoFlag2 = TRUE;
> -        }
> -    }
> -
> -    /* Calculate initial pixel position */
> -    PixelPosition = (PUCHAR)VgaBase + (Top * 80) + Left;
> -
> -    /* Set loop buffer variable */
> -    i = Buffer;
> -
> -    /* Switch to mode 0 */
> -    ReadWriteMode(0);
> -
> -    /* Leave now if the height is 0 */
> -    if (Height <= 0) return;
> -
> -    /* Set more weird values */
> -    CurrentLeft = &LeftArray[Left];
> -    NotlMask = ~(UCHAR)lMask;
> -    LeftPlusOne = Left + 1;
> -    LeftShifted = (lMask << 8) | 8;
> -    j = Height;
> -
> -    /* Start the height loop */
> +    /* 4bpp blitting */
> +    dy = Top;
>    do
>    {
> -        /* Start the plane loop */
> -        Plane = 0;
> +        sx = 0;
>        do
>        {
> -            /* Clear the current value */
> -            *CurrentLeft = 0;
> -            LoopCount = 0;
> -
> -            /* Set the buffer loop variable for this loop */
> -            k = i;
> -
> -            /* Calculate plane shift and pixel mask */
> -            PlaneShift = 1 << Plane;
> -            pMask = PixelMask[LeftAnd];
> -
> -            /* Check if we have a width */
> -            if (Width > 0)
> -            {
> -                /* Loop it */
> -                l = CurrentLeft;
> -                x = Width;
> -                do
> -                {
> -                    /* Check if we're odd and increase the loop count */
> -                    Odd = LoopCount & 1 ? TRUE : FALSE;
> -                    LoopCount++;
> -                    if (Odd)
> -                    {
> -                        /* Check for the plane shift */
> -                        if (*k & PlaneShift)
> -                        {
> -                            /* Write the pixel mask */
> -                            *l |= pMask;
> -                        }
> -
> -                        /* Increase buffer position */
> -                        k++;
> -                    }
> -                    else
> -                    {
> -                        /* Check for plane shift */
> -                        if ((*k >> 4) & PlaneShift)
> -                        {
> -                            /* Write the pixel mask */
> -                            *l |= pMask;
> -                        }
> -                    }
> -
> -                    /* Shift the pixel mask */
> -                    pMask >>= 1;
> -                    if (!pMask)
> -                    {
> -                        /* Move to the next current left position and
> clear it */
> -                        l++;
> -                        *l = 0;
> -
> -                        /* Set the pixel mask to 0x80 */
> -                        pMask = 0x80;
> -                    }
> -                } while (--x);
> -            }
> -
> -            /* Set the plane value */
> -            __outpw(0x3C4, (1 << (Plane + 8) | 2));
> -
> -            /* Select the bitmask register and write the mask */
> -            __outpw(0x3CE, (USHORT)LeftShifted);
> -
> -            /* Read the current Pixel value */
> -            Value = READ_REGISTER_UCHAR(PixelPosition);
> -
> -            /* Add our mask */
> -            Value = (Value & NotlMask) | *CurrentLeft;
> -
> -            /* Set current left for the loop, and write new pixel value */
> -            LeftPos = LeftPlusOne;
> -            WRITE_REGISTER_UCHAR(PixelPosition, Value);
> -
> -            /* Set loop pixel position and check if we should loop */
> -            m = PixelPosition + 1;
> -            if (SomeYesNoFlag2)
> -            {
> -                /* Set the bitmask to 0xFF for all 4 planes */
> -                __outpw(0x3CE, 0xFF08);
> -
> -                /* Check if we have any distance left */
> -                if (DistanceMinusLeftBpp > 0)
> -                {
> -                    /* Start looping it */
> -                    x = DistanceMinusLeftBpp;
> -                    do
> -                    {
> -                        /* Write the value */
> -                        WRITE_REGISTER_UCHAR(m, LeftArray[LeftPos]);
> -
> -                        /* Go to the next position */
> -                        m++;
> -                        LeftPos++;
> -                    } while (--x);
> -                }
> -            }
> -
> -            /* Check if the first flag is on */
> -            if (SomeYesNoFlag)
> -            {
> -                /* Set the mask value */
> -                __outpw(0x3CE, (rMask << 8) | 8);
> -
> -                /* Read the current Pixel value */
> -                Value = READ_REGISTER_UCHAR(m);
> -
> -                /* Add our mask */
> -                Value = (Value & ~(UCHAR)rMask) | LeftArray[LeftPos];
> -
> -                /* Set current left for the loop, and write new pixel
> value */
> -                WRITE_REGISTER_UCHAR(m, Value);
> -            }
> -        } while (++Plane < 4);
> -
> -        /* Update pixel position, buffer and height */
> -        PixelPosition += 80;
> -        i += Delta;
> -    } while (--j);
> +            /* Extract color */
> +            color = Buffer[offset + sx];
> +
> +            /* Calc destination x */
> +            dx = Left + (sx << 1);
> +
> +            /* Set two pixels */
> +            SetPixel(dx, dy, color >> 4);
> +            SetPixel(dx + 1, dy, color & 0x0F);
> +
> +            sx++;
> +        } while (dx < Right);
> +        offset += Delta;
> +        dy++;
> +    } while (dy < Bottom);
> }
>
> VOID
>
>
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev
>

--001485f7764ab7caf90487cd52d9
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hey Ros Arm,<br><br>if you feel like extending and optimizing that code, pl=
ease feel free to do so.<br>From the old code and the comments I could only=
 guess what it was trying to do except the standard blit. Most parts of it =
worked by chance, so I added a very basic (and common sense) implementation=
 and tested it with plain non-RLE bitmaps by converting those in ntoskrnl\i=
nbv\logo\ for testing.<br>
<br>At the moment this routine is not even used as it seems, the ntoskrnl b=
itmaps are RLE coded by default. Those are processed by the RLEBitBlt funct=
ion in the same file. This functions looks a bit better, but could still re=
quire some changes here and there.<br>
<br>Best regards,<br>Gregor<br><br><br><div class=3D"gmail_quote">2010/5/30=
 Ros Arm <span dir=3D"ltr">&lt;<a href=3D"mailto:ros.arm at reactos.org">ros.a=
rm at reactos.org</a>&gt;</span><br><blockquote class=3D"gmail_quote" style=3D=
"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padd=
ing-left: 1ex;">
Hello!<br>
<br>
While the state of the original code is horrendous, and removing it was a s=
tep in the good direction, this simplified implementation omits many of the=
 optimizations and specific VGA tricks that the original &quot;author&quot;=
 of the code had intended to duplicate.<br>

<br>
If you&#39;d like, I would be open to talking to eVb (we both have some exp=
erience with VGA programming) to create an efficient 4BitBlt routine simila=
r to the original one that has been removed, but one that actually has basi=
s in actual fact and isn&#39;t of the nature this original implementation w=
as.<br>

<br>
I can see the original code was converting packed data into per-plane (plan=
ar) data and had special edge handling, but it looks like the original auth=
or did not realize this, and most of the modulo-and-shifts appear as bitwis=
e ANDs (compiler optimizations), which is just plain confusing.<br>

<br>
Since the rest of bootvid is probably the same &quot;quality&quot;, we coul=
d take a good look at it, both from a coding and legal standpoint, if you&#=
39;d like.<br>
<br>
-r<br>
<br>
Author: gschneider<br>
Date: Sun May 30 01:54:47 2010<br>
New Revision: 47431<br>
<br>
URL: <a href=3D"http://svn.reactos.org/svn/reactos?rev=3D47431&amp;view=3Dr=
ev" target=3D"_blank">http://svn.reactos.org/svn/reactos?rev=3D47431&amp;vi=
ew=3Drev</a><br>
Log:<br>
[BOOTVID] Dramatically simplify 4bpp blitting routine<br>
See issue #5103 for more details.<br>
<br>
Modified:<br>
 =A0 trunk/reactos/drivers/base/bootvid/i386/vga.c<br>
<br>
Modified: trunk/reactos/drivers/base/bootvid/i386/vga.c<br>
URL: <a href=3D"http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ba=
se/bootvid/i386/vga.c?rev=3D47431&amp;r1=3D47430&amp;r2=3D47431&amp;view=3D=
diff" target=3D"_blank">http://svn.reactos.org/svn/reactos/trunk/reactos/dr=
ivers/base/bootvid/i386/vga.c?rev=3D47431&amp;r1=3D47430&amp;r2=3D47431&amp=
;view=3Ddiff</a><br>

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D<br>
--- trunk/reactos/drivers/base/bootvid/i386/vga.c [iso-8859-1] (original)<b=
r>
+++ trunk/reactos/drivers/base/bootvid/i386/vga.c [iso-8859-1] Sun May 30 0=
1:54:47 2010<br>
@@ -402,33 +402,20 @@<br>
 =A0 =A0 =A0 IN ULONG BitsPerPixel,<br>
 =A0 =A0 =A0 IN ULONG Delta)<br>
{<br>
- =A0 =A0ULONG LeftAnd, LeftShifted, LeftPlusOne, LeftPos;<br>
- =A0 =A0ULONG lMask, rMask;<br>
- =A0 =A0UCHAR NotlMask;<br>
- =A0 =A0ULONG Distance;<br>
- =A0 =A0ULONG DistanceMinusLeftBpp;<br>
- =A0 =A0ULONG SomeYesNoFlag, SomeYesNoFlag2;<br>
- =A0 =A0PUCHAR PixelPosition, m;<br>
- =A0 =A0PUCHAR i, k;<br>
- =A0 =A0ULONG j;<br>
- =A0 =A0ULONG x;<br>
- =A0 =A0ULONG Plane;<br>
- =A0 =A0UCHAR LeftArray[84];<br>
- =A0 =A0PUCHAR CurrentLeft;<br>
- =A0 =A0PUCHAR l;<br>
- =A0 =A0ULONG LoopCount;<br>
- =A0 =A0UCHAR pMask, PlaneShift;<br>
- =A0 =A0BOOLEAN Odd;<br>
- =A0 =A0UCHAR Value;<br>
+ =A0 =A0ULONG sx, dx, dy;<br>
+ =A0 =A0UCHAR color;<br>
+ =A0 =A0ULONG offset =3D 0;<br>
+ =A0 =A0const ULONG Bottom =3D Top + Height;<br>
+ =A0 =A0const ULONG Right =3D Left + Width;<br>
<br>
 =A0 =A0/* Check if the buffer isn&#39;t 4bpp */<br>
 =A0 =A0if (BitsPerPixel !=3D 4)<br>
 =A0 =A0{<br>
 =A0 =A0 =A0 =A0/* FIXME: TODO */<br>
 =A0 =A0 =A0 =A0DbgPrint(&quot;Unhandled BitBlt\n&quot;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &quot;%lxx%lx @ (%lx,%lx)\n&quot;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &quot;Bits Per Pixel %lx\n&quot;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &quot;Buffer: %p. Delta: %lx\n&quot;,<br>
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &quot;%lux%lu @ (%lu|%lu)\n&quot;<br>
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &quot;Bits Per Pixel %lu\n&quot;<br>
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &quot;Buffer: %p. Delta: %lu\n&quot;,<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Width,<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Height,<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Left,<br>
@@ -439,181 +426,28 @@<br>
 =A0 =A0 =A0 =A0return;<br>
 =A0 =A0}<br>
<br>
- =A0 =A0/* Get the masks and other values */<br>
- =A0 =A0LeftAnd =3D Left &amp; 0x7;<br>
- =A0 =A0lMask =3D lMaskTable[LeftAnd];<br>
- =A0 =A0Distance =3D Width + Left;<br>
- =A0 =A0rMask =3D rMaskTable[(Distance - 1) &amp; 0x7];<br>
- =A0 =A0Left &gt;&gt;=3D 3;<br>
-<br>
- =A0 =A0/* Set some values */<br>
- =A0 =A0SomeYesNoFlag =3D FALSE;<br>
- =A0 =A0SomeYesNoFlag2 =3D FALSE;<br>
- =A0 =A0Distance =3D (Distance - 1) &gt;&gt; 3;<br>
- =A0 =A0DistanceMinusLeftBpp =3D Distance - Left;<br>
-<br>
- =A0 =A0/* Check if the distance is equal to the left position and add the=
 masks */<br>
- =A0 =A0if (Left =3D=3D Distance) lMask +=3D rMask;<br>
-<br>
- =A0 =A0/* Check if there&#39;s no distance offset */<br>
- =A0 =A0if (DistanceMinusLeftBpp)<br>
- =A0 =A0{<br>
- =A0 =A0 =A0 =A0/* Set the first flag on */<br>
- =A0 =A0 =A0 =A0SomeYesNoFlag =3D TRUE;<br>
-<br>
- =A0 =A0 =A0 =A0/* Decrease offset and check if we still have one */<br>
- =A0 =A0 =A0 =A0if (--DistanceMinusLeftBpp)<br>
- =A0 =A0 =A0 =A0{<br>
- =A0 =A0 =A0 =A0 =A0 =A0/* Still have a distance offset */<br>
- =A0 =A0 =A0 =A0 =A0 =A0SomeYesNoFlag2 =3D TRUE;<br>
- =A0 =A0 =A0 =A0}<br>
- =A0 =A0}<br>
-<br>
- =A0 =A0/* Calculate initial pixel position */<br>
- =A0 =A0PixelPosition =3D (PUCHAR)VgaBase + (Top * 80) + Left;<br>
-<br>
- =A0 =A0/* Set loop buffer variable */<br>
- =A0 =A0i =3D Buffer;<br>
-<br>
- =A0 =A0/* Switch to mode 0 */<br>
- =A0 =A0ReadWriteMode(0);<br>
-<br>
- =A0 =A0/* Leave now if the height is 0 */<br>
- =A0 =A0if (Height &lt;=3D 0) return;<br>
-<br>
- =A0 =A0/* Set more weird values */<br>
- =A0 =A0CurrentLeft =3D &amp;LeftArray[Left];<br>
- =A0 =A0NotlMask =3D ~(UCHAR)lMask;<br>
- =A0 =A0LeftPlusOne =3D Left + 1;<br>
- =A0 =A0LeftShifted =3D (lMask &lt;&lt; 8) | 8;<br>
- =A0 =A0j =3D Height;<br>
-<br>
- =A0 =A0/* Start the height loop */<br>
+ =A0 =A0/* 4bpp blitting */<br>
+ =A0 =A0dy =3D Top;<br>
 =A0 =A0do<br>
 =A0 =A0{<br>
- =A0 =A0 =A0 =A0/* Start the plane loop */<br>
- =A0 =A0 =A0 =A0Plane =3D 0;<br>
+ =A0 =A0 =A0 =A0sx =3D 0;<br>
 =A0 =A0 =A0 =A0do<br>
 =A0 =A0 =A0 =A0{<br>
- =A0 =A0 =A0 =A0 =A0 =A0/* Clear the current value */<br>
- =A0 =A0 =A0 =A0 =A0 =A0*CurrentLeft =3D 0;<br>
- =A0 =A0 =A0 =A0 =A0 =A0LoopCount =3D 0;<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0/* Set the buffer loop variable for this loop */<b=
r>
- =A0 =A0 =A0 =A0 =A0 =A0k =3D i;<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0/* Calculate plane shift and pixel mask */<br>
- =A0 =A0 =A0 =A0 =A0 =A0PlaneShift =3D 1 &lt;&lt; Plane;<br>
- =A0 =A0 =A0 =A0 =A0 =A0pMask =3D PixelMask[LeftAnd];<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0/* Check if we have a width */<br>
- =A0 =A0 =A0 =A0 =A0 =A0if (Width &gt; 0)<br>
- =A0 =A0 =A0 =A0 =A0 =A0{<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Loop it */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0l =3D CurrentLeft;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0x =3D Width;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0do<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Check if we&#39;re odd and incr=
ease the loop count */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Odd =3D LoopCount &amp; 1 ? TRUE :=
 FALSE;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0LoopCount++;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (Odd)<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Check for the plane shi=
ft */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (*k &amp; PlaneShift)<b=
r>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Write the pixel=
 mask */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*l |=3D pMask;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Increase buffer positio=
n */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0k++;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0else<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Check for plane shift *=
/<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if ((*k &gt;&gt; 4) &amp; =
PlaneShift)<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Write the pixel=
 mask */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*l |=3D pMask;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Shift the pixel mask */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0pMask &gt;&gt;=3D 1;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (!pMask)<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Move to the next curren=
t left position and clear it */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0l++;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*l =3D 0;<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Set the pixel mask to 0=
x80 */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0pMask =3D 0x80;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} while (--x);<br>
- =A0 =A0 =A0 =A0 =A0 =A0}<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0/* Set the plane value */<br>
- =A0 =A0 =A0 =A0 =A0 =A0__outpw(0x3C4, (1 &lt;&lt; (Plane + 8) | 2));<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0/* Select the bitmask register and write the mask =
*/<br>
- =A0 =A0 =A0 =A0 =A0 =A0__outpw(0x3CE, (USHORT)LeftShifted);<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0/* Read the current Pixel value */<br>
- =A0 =A0 =A0 =A0 =A0 =A0Value =3D READ_REGISTER_UCHAR(PixelPosition);<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0/* Add our mask */<br>
- =A0 =A0 =A0 =A0 =A0 =A0Value =3D (Value &amp; NotlMask) | *CurrentLeft;<b=
r>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0/* Set current left for the loop, and write new pi=
xel value */<br>
- =A0 =A0 =A0 =A0 =A0 =A0LeftPos =3D LeftPlusOne;<br>
- =A0 =A0 =A0 =A0 =A0 =A0WRITE_REGISTER_UCHAR(PixelPosition, Value);<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0/* Set loop pixel position and check if we should =
loop */<br>
- =A0 =A0 =A0 =A0 =A0 =A0m =3D PixelPosition + 1;<br>
- =A0 =A0 =A0 =A0 =A0 =A0if (SomeYesNoFlag2)<br>
- =A0 =A0 =A0 =A0 =A0 =A0{<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Set the bitmask to 0xFF for all 4 plane=
s */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0__outpw(0x3CE, 0xFF08);<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Check if we have any distance left */<b=
r>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (DistanceMinusLeftBpp &gt; 0)<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Start looping it */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0x =3D DistanceMinusLeftBpp;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0do<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Write the value */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0WRITE_REGISTER_UCHAR(m, Le=
ftArray[LeftPos]);<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Go to the next position=
 */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0m++;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0LeftPos++;<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} while (--x);<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
- =A0 =A0 =A0 =A0 =A0 =A0}<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0/* Check if the first flag is on */<br>
- =A0 =A0 =A0 =A0 =A0 =A0if (SomeYesNoFlag)<br>
- =A0 =A0 =A0 =A0 =A0 =A0{<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Set the mask value */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0__outpw(0x3CE, (rMask &lt;&lt; 8) | 8);<br=
>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Read the current Pixel value */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Value =3D READ_REGISTER_UCHAR(m);<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Add our mask */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Value =3D (Value &amp; ~(UCHAR)rMask) | Le=
ftArray[LeftPos];<br>
-<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Set current left for the loop, and writ=
e new pixel value */<br>
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0WRITE_REGISTER_UCHAR(m, Value);<br>
- =A0 =A0 =A0 =A0 =A0 =A0}<br>
- =A0 =A0 =A0 =A0} while (++Plane &lt; 4);<br>
-<br>
- =A0 =A0 =A0 =A0/* Update pixel position, buffer and height */<br>
- =A0 =A0 =A0 =A0PixelPosition +=3D 80;<br>
- =A0 =A0 =A0 =A0i +=3D Delta;<br>
- =A0 =A0} while (--j);<br>
+ =A0 =A0 =A0 =A0 =A0 =A0/* Extract color */<br>
+ =A0 =A0 =A0 =A0 =A0 =A0color =3D Buffer[offset + sx];<br>
+<br>
+ =A0 =A0 =A0 =A0 =A0 =A0/* Calc destination x */<br>
+ =A0 =A0 =A0 =A0 =A0 =A0dx =3D Left + (sx &lt;&lt; 1);<br>
+<br>
+ =A0 =A0 =A0 =A0 =A0 =A0/* Set two pixels */<br>
+ =A0 =A0 =A0 =A0 =A0 =A0SetPixel(dx, dy, color &gt;&gt; 4);<br>
+ =A0 =A0 =A0 =A0 =A0 =A0SetPixel(dx + 1, dy, color &amp; 0x0F);<br>
+<br>
+ =A0 =A0 =A0 =A0 =A0 =A0sx++;<br>
+ =A0 =A0 =A0 =A0} while (dx &lt; Right);<br>
+ =A0 =A0 =A0 =A0offset +=3D Delta;<br>
+ =A0 =A0 =A0 =A0dy++;<br>
+ =A0 =A0} while (dy &lt; Bottom);<br>
}<br>
<br>
VOID<br>
<br>
<br>
_______________________________________________<br>
Ros-dev mailing list<br>
<a href=3D"mailto:Ros-dev at reactos.org">Ros-dev at reactos.org</a><br>
<a href=3D"http://www.reactos.org/mailman/listinfo/ros-dev" target=3D"_blan=
k">http://www.reactos.org/mailman/listinfo/ros-dev</a><br>
</blockquote></div><br>

--001485f7764ab7caf90487cd52d9--



More information about the Ros-dev mailing list