/
gfx.c
40 lines (31 loc) · 921 Bytes
/
gfx.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "gfx.h"
#include "vmm.h"
#include "serial.h"
static uint32 gWidth = 0;
static uint32 gHeight = 0;
static uint32 gBytePerPixel = 0;
static uint32* gPixels = NULL;
void Gfx_Initialize(uint32* pixels, uint32 width, uint32 height, uint32 bytePerPixel)
{
gPixels = pixels;
gWidth = width;
gHeight = height;
gBytePerPixel = bytePerPixel;
Serial_PrintF("Gfx_Initialize\n");
char* p_address = (char*)gPixels;
char* v_address = (char*)gPixels;
Serial_PrintF("Gfx_Initialize: %x\n", gPixels);
BOOL success = addPageToPd(gKernelPageDirectory, v_address, p_address, 0);
if (success)
{
Serial_PrintF("Gfx_Initialize: success\n");
for (int y = 0; y < gHeight; ++y)
{
for (int x = 0; x < gWidth; ++x)
{
gPixels[x + y * gWidth] = 255;
}
}
}
Serial_PrintF("Gfx_Initialize: end\n");
}