https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1610367fe2b3ece7fac11cb693e43f68f8f39e41

commit 1610367fe2b3ece7fac11cb693e43f68f8f39e41
Author:     Dmitry Borisov <[email protected]>
AuthorDate: Tue Apr 7 03:48:01 2020 +0600
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Thu Apr 9 15:17:48 2020 +0200

    [BOOTVID][NTOSKRNL][HALX86] Move hardcoded coordinates of bootvid into one 
place. (#2504)
    
    Co-Authored-By: Hermès Bélusca-Maïto <[email protected]>
---
 drivers/base/bootvid/precomp.h                |  6 -----
 hal/halx86/generic/misc.c                     |  6 +++--
 ntoskrnl/inbv/inbv.c                          | 31 +++++++++++++-------------
 ntoskrnl/inbv/logo.h                          | 32 +++++++++++++++++++++++++++
 ntoskrnl/include/internal/inbv.h              |  3 +++
 ntoskrnl/kd/kdio.c                            |  5 +++--
 ntoskrnl/ke/bug.c                             |  5 +++--
 ntoskrnl/po/poshtdwn.c                        | 12 +++++-----
 sdk/include/reactos/drivers/bootvid/bootvid.h | 13 ++++++++++-
 sdk/include/reactos/drivers/bootvid/display.h | 12 ++++++++++
 10 files changed, 92 insertions(+), 33 deletions(-)

diff --git a/drivers/base/bootvid/precomp.h b/drivers/base/bootvid/precomp.h
index 18bc611a99a..8fcc753b662 100644
--- a/drivers/base/bootvid/precomp.h
+++ b/drivers/base/bootvid/precomp.h
@@ -11,12 +11,6 @@
 #define BOOTCHAR_HEIGHT 13
 #define BOOTCHAR_WIDTH  8 // Each character line is encoded in a UCHAR.
 
-/*
- * Screen resolution (for default VGA)
- */
-#define SCREEN_WIDTH    640
-#define SCREEN_HEIGHT   480
-
 #ifndef _M_ARM
 #include "vga.h"
 #endif /* _M_ARM */
diff --git a/hal/halx86/generic/misc.c b/hal/halx86/generic/misc.c
index 866b4591069..407f1e6047a 100644
--- a/hal/halx86/generic/misc.c
+++ b/hal/halx86/generic/misc.c
@@ -9,6 +9,8 @@
 /* INCLUDES 
*******************************************************************/
 
 #include <hal.h>
+#include <drivers/bootvid/display.h>
+
 #define NDEBUG
 #include <debug.h>
 
@@ -255,8 +257,8 @@ HalHandleNMI(IN PVOID NmiInfo)
         //
         // Fill the screen
         //
-        InbvSolidColorFill(0, 0, 639, 479, 1);
-        InbvSetScrollRegion(0, 0, 639, 479);
+        InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, 1);
+        InbvSetScrollRegion(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
 
         //
         // Enable text
diff --git a/ntoskrnl/inbv/inbv.c b/ntoskrnl/inbv/inbv.c
index c93d0e66482..5617e8577e2 100644
--- a/ntoskrnl/inbv/inbv.c
+++ b/ntoskrnl/inbv/inbv.c
@@ -1,9 +1,11 @@
 /* INCLUDES ******************************************************************/
 
 #include <ntoskrnl.h>
+
 #define NDEBUG
 #include <debug.h>
-#include "bootvid/bootvid.h"
+
+#include "inbv/logo.h"
 
 /* See also mm/ARM3/miarm.h */
 #define MM_READONLY     1   // PAGE_READONLY
@@ -53,12 +55,6 @@ typedef enum _ROT_BAR_TYPE
     RB_PROGRESS_BAR
 } ROT_BAR_TYPE;
 
-/*
- * Screen resolution (for default VGA)
- */
-#define SCREEN_WIDTH  640
-#define SCREEN_HEIGHT 480
-
 /*
  * BitBltAligned() alignments
  */
@@ -1126,7 +1122,7 @@ DisplayBootBitmap(IN BOOLEAN TextMode)
             /* Workstation; set colors */
             InbvSetTextColor(15);
             InbvSolidColorFill(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1, 7);
-            InbvSolidColorFill(0, 421, SCREEN_WIDTH-1, SCREEN_HEIGHT-1, 1);
+            InbvSolidColorFill(0, VID_FOOTER_BG_TOP, SCREEN_WIDTH-1, 
SCREEN_HEIGHT-1, 1);
 
             /* Get resources */
             Header = InbvGetResourceAddress(IDB_WKSTA_HEADER);
@@ -1137,7 +1133,7 @@ DisplayBootBitmap(IN BOOLEAN TextMode)
             /* Server; set colors */
             InbvSetTextColor(14);
             InbvSolidColorFill(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1, 6);
-            InbvSolidColorFill(0, 421, SCREEN_WIDTH-1, SCREEN_HEIGHT-1, 1);
+            InbvSolidColorFill(0, VID_FOOTER_BG_TOP, SCREEN_WIDTH-1, 
SCREEN_HEIGHT-1, 1);
 
             /* Get resources */
             Header = InbvGetResourceAddress(IDB_SERVER_HEADER);
@@ -1145,7 +1141,8 @@ DisplayBootBitmap(IN BOOLEAN TextMode)
         }
 
         /* Set the scrolling region */
-        InbvSetScrollRegion(32, 80, 631, 400);
+        InbvSetScrollRegion(VID_SCROLL_AREA_LEFT, VID_SCROLL_AREA_TOP,
+                            VID_SCROLL_AREA_RIGHT, VID_SCROLL_AREA_BOTTOM);
 
         /* Make sure we have resources */
         if (Header && Footer)
@@ -1239,16 +1236,19 @@ DisplayBootBitmap(IN BOOLEAN TextMode)
 #endif
 
             /* Set progress bar coordinates and display it */
-            InbvSetProgressBarCoordinates(259, 352);
+            InbvSetProgressBarCoordinates(VID_PROGRESS_BAR_LEFT, 
VID_PROGRESS_BAR_TOP);
 
 #ifdef REACTOS_SKUS
             /* Check for non-workstation products */
             if (SharedUserData->NtProductType != NtProductWinNt)
             {
                 /* Overwrite part of the logo for a server product */
-                InbvScreenToBufferBlt(Buffer, 413, 237, 7, 7, 8);
-                InbvSolidColorFill(418, 230, 454, 256, 0);
-                InbvBufferToScreenBlt(Buffer, 413, 237, 7, 7, 8);
+                InbvScreenToBufferBlt(Buffer, VID_SKU_SAVE_AREA_LEFT,
+                                      VID_SKU_SAVE_AREA_TOP, 7, 7, 8);
+                InbvSolidColorFill(VID_SKU_AREA_LEFT, VID_SKU_AREA_TOP,
+                                   VID_SKU_AREA_RIGHT, VID_SKU_AREA_BOTTOM, 0);
+                InbvBufferToScreenBlt(Buffer, VID_SKU_SAVE_AREA_LEFT,
+                                      VID_SKU_SAVE_AREA_TOP, 7, 7, 8);
 
                 /* In setup mode, you haven't selected a SKU yet */
                 if (ExpInTextModeSetup) Text = NULL;
@@ -1274,7 +1274,8 @@ DisplayBootBitmap(IN BOOLEAN TextMode)
 
 #ifdef REACTOS_SKUS
         /* Draw the SKU text if it exits */
-        if (Text) BitBltPalette(Text, TRUE, 180, 121);
+        if (Text)
+            BitBltPalette(Text, TRUE, VID_SKU_TEXT_LEFT, VID_SKU_TEXT_TOP);
 #endif
 
 #ifdef INBV_ROTBAR_IMPLEMENTED
diff --git a/ntoskrnl/inbv/logo.h b/ntoskrnl/inbv/logo.h
new file mode 100644
index 00000000000..c18d1efeea7
--- /dev/null
+++ b/ntoskrnl/inbv/logo.h
@@ -0,0 +1,32 @@
+#pragma once
+
+//
+// Positions of areas and images
+//
+
+#define VID_SCROLL_AREA_LEFT       32
+#define VID_SCROLL_AREA_TOP        80
+#define VID_SCROLL_AREA_RIGHT     631
+#define VID_SCROLL_AREA_BOTTOM    400
+
+#define VID_PROGRESS_BAR_LEFT     259
+#define VID_PROGRESS_BAR_TOP      352
+
+/* 16px space between shutdown logo and message */
+#define VID_SHUTDOWN_LOGO_LEFT    225
+#define VID_SHUTDOWN_LOGO_TOP     114
+#define VID_SHUTDOWN_MSG_LEFT     213
+#define VID_SHUTDOWN_MSG_TOP      354
+
+#define VID_SKU_AREA_LEFT         418
+#define VID_SKU_AREA_TOP          230
+#define VID_SKU_AREA_RIGHT        454
+#define VID_SKU_AREA_BOTTOM       256
+
+#define VID_SKU_SAVE_AREA_LEFT    413
+#define VID_SKU_SAVE_AREA_TOP     237
+
+#define VID_SKU_TEXT_LEFT         180
+#define VID_SKU_TEXT_TOP          121
+
+#define VID_FOOTER_BG_TOP        (SCREEN_HEIGHT - 59)
diff --git a/ntoskrnl/include/internal/inbv.h b/ntoskrnl/include/internal/inbv.h
index 80a6c83a481..148c112d367 100644
--- a/ntoskrnl/include/internal/inbv.h
+++ b/ntoskrnl/include/internal/inbv.h
@@ -1,5 +1,8 @@
 #pragma once
 
+// Native definitions from BOOTVID (Boot Video Driver).
+#include "bootvid/bootvid.h"
+
 //
 // Driver Initialization
 //
diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c
index 52dd45b7ccd..89ca1685f74 100644
--- a/ntoskrnl/kd/kdio.c
+++ b/ntoskrnl/kd/kdio.c
@@ -11,6 +11,7 @@
 
 #include <ntoskrnl.h>
 #include <reactos/buildno.h>
+
 #define NDEBUG
 #include <debug.h>
 
@@ -417,11 +418,11 @@ KdpScreenAcquire(VOID)
         /* Acquire ownership and reset the display */
         InbvAcquireDisplayOwnership();
         InbvResetDisplay();
-        InbvSolidColorFill(0, 0, 639, 479, 0);
+        InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, 0);
         InbvSetTextColor(15);
         InbvInstallDisplayStringFilter(NULL);
         InbvEnableDisplayString(TRUE);
-        InbvSetScrollRegion(0, 0, 639, 479);
+        InbvSetScrollRegion(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
     }
 }
 
diff --git a/ntoskrnl/ke/bug.c b/ntoskrnl/ke/bug.c
index 47b1f4b5ca3..0601855d359 100644
--- a/ntoskrnl/ke/bug.c
+++ b/ntoskrnl/ke/bug.c
@@ -9,6 +9,7 @@
 /* INCLUDES ******************************************************************/
 
 #include <ntoskrnl.h>
+
 #define NDEBUG
 #include <debug.h>
 
@@ -625,11 +626,11 @@ KiDisplayBlueScreen(IN ULONG MessageId,
         InbvResetDisplay();
 
         /* Display blue screen */
-        InbvSolidColorFill(0, 0, 639, 479, 4);
+        InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, 4);
         InbvSetTextColor(15);
         InbvInstallDisplayStringFilter(NULL);
         InbvEnableDisplayString(TRUE);
-        InbvSetScrollRegion(0, 0, 639, 479);
+        InbvSetScrollRegion(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
     }
 
     /* Check if this is a hard error */
diff --git a/ntoskrnl/po/poshtdwn.c b/ntoskrnl/po/poshtdwn.c
index 23071faad28..31a1165e33f 100644
--- a/ntoskrnl/po/poshtdwn.c
+++ b/ntoskrnl/po/poshtdwn.c
@@ -12,9 +12,12 @@
 #ifdef NEWCC
 #include <cache/newcc.h>
 #endif
+
 #define NDEBUG
 #include <debug.h>
 
+#include "inbv/logo.h"
+
 /* GLOBALS *******************************************************************/
 
 ULONG PopShutdownPowerOffPolicy;
@@ -159,18 +162,17 @@ PopShutdownHandler(VOID)
         /* Yes we do, cleanup for shutdown screen */
         if (!InbvCheckDisplayOwnership()) InbvAcquireDisplayOwnership();
         InbvResetDisplay();
-        InbvSolidColorFill(0, 0, 639, 479, 0);
+        InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, 0);
         InbvEnableDisplayString(TRUE);
-        InbvSetScrollRegion(0, 0, 639, 479);
+        InbvSetScrollRegion(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
 
         /* Display shutdown logo and message */
         Logo1 = InbvGetResourceAddress(IDB_SHUTDOWN_MSG);
         Logo2 = InbvGetResourceAddress(IDB_LOGO_DEFAULT);
         if ((Logo1) && (Logo2))
         {
-            /* 16px space between logo and message */
-            InbvBitBlt(Logo1, 213, 354);
-            InbvBitBlt(Logo2, 225, 114);
+            InbvBitBlt(Logo1, VID_SHUTDOWN_MSG_LEFT, VID_SHUTDOWN_MSG_TOP);
+            InbvBitBlt(Logo2, VID_SHUTDOWN_LOGO_LEFT, VID_SHUTDOWN_LOGO_TOP);
         }
     }
     else
diff --git a/sdk/include/reactos/drivers/bootvid/bootvid.h 
b/sdk/include/reactos/drivers/bootvid/bootvid.h
index 8e9bd9d8792..80f0a485913 100644
--- a/sdk/include/reactos/drivers/bootvid/bootvid.h
+++ b/sdk/include/reactos/drivers/bootvid/bootvid.h
@@ -1,6 +1,17 @@
+/*
+ * PROJECT:     ReactOS Boot Video Driver
+ * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE:     Main BOOTVID header.
+ * COPYRIGHT:   Copyright 2007-2020 Alex Ionescu ([email protected])
+ */
+
 #ifndef _BOOTVID_
 #define _BOOTVID_
 
+#pragma once
+
+#include "display.h"
+
 BOOLEAN
 NTAPI
 VidInitialize(IN BOOLEAN SetMode);
@@ -67,4 +78,4 @@ VidSolidColorFill(IN ULONG Left,
                   IN ULONG Bottom,
                   IN UCHAR Color);
 
-#endif
+#endif // _BOOTVID_
diff --git a/sdk/include/reactos/drivers/bootvid/display.h 
b/sdk/include/reactos/drivers/bootvid/display.h
new file mode 100644
index 00000000000..af9178153ad
--- /dev/null
+++ b/sdk/include/reactos/drivers/bootvid/display.h
@@ -0,0 +1,12 @@
+/*
+ * PROJECT:     ReactOS Boot Video Driver
+ * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE:     Provides display settings for BOOTVID, HAL and NTOSKRNL.
+ * COPYRIGHT:   Copyright 2020 Dmitry Borisov ([email protected])
+ */
+
+#pragma once
+
+/* For default VGA */
+#define SCREEN_WIDTH    640
+#define SCREEN_HEIGHT   480

Reply via email to