xref: /reactos/drivers/base/bootvid/precomp.h (revision 84344399)
1 /*
2  * PROJECT:     ReactOS Boot Video Driver
3  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE:     Precompiled header
5  * COPYRIGHT:   Copyright 2007 Alex Ionescu <alex.ionescu@reactos.org>
6  *              Copyright 2020 Dmitry Borisov <di.sean@protonmail.com>
7  *              Copyright 2020 Stanislav Motylkov <x86corez@gmail.com>
8  */
9 
10 #ifndef _BOOTVID_PCH_
11 #define _BOOTVID_PCH_
12 
13 #include <ntifs.h>
14 #include <ndk/halfuncs.h>
15 #include <drivers/bootvid/bootvid.h>
16 
17 /* Arch specific includes */
18 #if defined(_M_IX86) || defined(_M_AMD64)
19 #if defined(SARCH_PC98)
20 #include "i386/pc98/pc98.h"
21 #elif defined(SARCH_XBOX)
22 #include "i386/xbox/xbox.h"
23 #else
24 #include "i386/pc/vga.h"
25 #include "i386/pc/pc.h"
26 #endif
27 #elif defined(_M_ARM)
28 #include "arm/arm.h"
29 #else
30 #error Unknown architecture
31 #endif
32 
33 /* Define if FontData has upside down characters */
34 #undef CHAR_GEN_UPSIDE_DOWN
35 
36 #define BOOTCHAR_HEIGHT 13
37 #define BOOTCHAR_WIDTH  8 // Each character line is encoded in a UCHAR.
38 
39 /* Bitmap Header */
40 typedef struct tagBITMAPINFOHEADER
41 {
42     ULONG biSize;
43     LONG biWidth;
44     LONG biHeight;
45     USHORT biPlanes;
46     USHORT biBitCount;
47     ULONG biCompression;
48     ULONG biSizeImage;
49     LONG biXPelsPerMeter;
50     LONG biYPelsPerMeter;
51     ULONG biClrUsed;
52     ULONG biClrImportant;
53 } BITMAPINFOHEADER, *PBITMAPINFOHEADER;
54 
55 /* Supported bitmap compression formats */
56 #define BI_RGB  0
57 #define BI_RLE4 2
58 
59 typedef ULONG RGBQUAD;
60 
61 /*
62  * Globals
63  */
64 extern UCHAR VidpTextColor;
65 extern ULONG VidpCurrentX;
66 extern ULONG VidpCurrentY;
67 extern ULONG VidpScrollRegion[4];
68 extern UCHAR VidpFontData[256 * BOOTCHAR_HEIGHT];
69 extern const RGBQUAD VidpDefaultPalette[BV_MAX_COLORS];
70 
71 #define RGB(r, g, b)    ((RGBQUAD)(((UCHAR)(b) | ((USHORT)((UCHAR)(g))<<8)) | (((ULONG)(UCHAR)(r))<<16)))
72 
73 #define GetRValue(quad)     ((UCHAR)(((quad)>>16) & 0xFF))
74 #define GetGValue(quad)     ((UCHAR)(((quad)>>8) & 0xFF))
75 #define GetBValue(quad)     ((UCHAR)((quad) & 0xFF))
76 
77 #define InitializePalette() InitPaletteWithTable((PULONG)VidpDefaultPalette, BV_MAX_COLORS)
78 
79 #ifdef CHAR_GEN_UPSIDE_DOWN
80 # define GetFontPtr(_Char)  (&VidpFontData[(_Char) * BOOTCHAR_HEIGHT] + BOOTCHAR_HEIGHT - 1)
81 # define FONT_PTR_DELTA     (-1)
82 #else
83 # define GetFontPtr(_Char)  (&VidpFontData[(_Char) * BOOTCHAR_HEIGHT])
84 # define FONT_PTR_DELTA     (1)
85 #endif
86 
87 #endif /* _BOOTVID_PCH_ */
88