Author: dgorbachev
Date: Sun Aug  2 23:26:05 2009
New Revision: 42350

URL: http://svn.reactos.org/svn/reactos?rev=42350&view=rev
Log:
Love Nystrom (=lovenystrom=at=hotmail=dot=com=), bug #4727

- Change some 'suspiciously looking' code in bootvid.dll.
- BOOTCHAR_HEIGHT: a new macro to use instead of a plain integer.
- CHAR_GEN_UPSIDE_DOWN: define it for upside down font data.

Modified:
    trunk/reactos/drivers/base/bootvid/i386/bootdata.c
    trunk/reactos/drivers/base/bootvid/i386/vga.c
    trunk/reactos/drivers/base/bootvid/precomp.h

Modified: trunk/reactos/drivers/base/bootvid/i386/bootdata.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/bootvid/i386/bootdata.c?rev=42350&r1=42349&r2=42350&view=diff
==============================================================================
--- trunk/reactos/drivers/base/bootvid/i386/bootdata.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/bootvid/i386/bootdata.c [iso-8859-1] Sun Aug  2 
23:26:05 2009
@@ -48,7 +48,10 @@
     0x0                         // End of command stream
 };
 
-UCHAR FontData[256 * 13] =
+//
+// The character generator is in natural order, top of char is first element.
+//
+UCHAR FontData[256 * BOOTCHAR_HEIGHT] =
 {
     0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 
0x00, // 0
     0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 
0x00, // 13

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=42350&r1=42349&r2=42350&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 Aug  2 
23:26:05 2009
@@ -146,10 +146,10 @@
     ULONG i, j, XOffset;
 
     /* Get the font line for this character */
-    FontChar = &FontData[Character * 13 - Top];
+    FontChar = &FontData[Character * BOOTCHAR_HEIGHT];
 
     /* Loop each pixel height */
-    i = 13;
+    i = BOOTCHAR_HEIGHT;
     do
     {
         /* Loop each pixel width */
@@ -158,15 +158,20 @@
         do
         {
             /* Check if we should draw this pixel */
-            if (FontChar[Top] & (UCHAR)j)
+#ifdef CHAR_GEN_UPSIDE_DOWN
+            if (FontChar[i] & (UCHAR)j)
+#else
+            /* Normal character generator (top of char is first element) */
+            if (FontChar[BOOTCHAR_HEIGHT - i] & (UCHAR)j)
+#endif
             {
                 /* We do, use the given Text Color */
                 SetPixel(XOffset, Top, (UCHAR)TextColor);
             }
             else if (BackTextColor < 16)
             {
-                /* This is a background pixel. We're drawing it unless it's */
-                /* transparent. */
+                /* This is a background pixel. */
+                /* We're drawing it unless it's transparent. */
                 SetPixel(XOffset, Top, (UCHAR)BackTextColor);
             }
 

Modified: trunk/reactos/drivers/base/bootvid/precomp.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/bootvid/precomp.h?rev=42350&r1=42349&r2=42350&view=diff
==============================================================================
--- trunk/reactos/drivers/base/bootvid/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/bootvid/precomp.h [iso-8859-1] Sun Aug  2 
23:26:05 2009
@@ -2,6 +2,11 @@
 #include "arc/arc.h"
 #include "halfuncs.h"
 #include "drivers/bootvid/bootvid.h"
+
+/* Define if FontData has upside down characters */
+#undef CHAR_GEN_UPSIDE_DOWN
+
+#define BOOTCHAR_HEIGHT             13
 
 //
 // Command Stream Definitions
@@ -43,4 +48,4 @@
 extern ULONG curr_y;
 extern ULONG_PTR VgaRegisterBase;
 extern ULONG_PTR VgaBase;
-extern UCHAR FontData[256 * 13];
+extern UCHAR FontData[256 * BOOTCHAR_HEIGHT];


Reply via email to