commit d2e008c
uint
·
2026-06-23 00:17:33 +0000 UTC
parent 12c6db1
Add clearing framebuffer, presenting from back framebuffer
1 files changed,
+7,
-1
+7,
-1
1@@ -251,7 +251,10 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
2
3 void maus_clear(Maus* mw, MausColor col)
4 {
5-
6+ uint32_t col_up = MAUS_UNPACK_COL(col);
7+ uint32_t pxs = mw->height * mw->width;
8+ for (uint32_t i = 0; i < pxs; i++)
9+ mw->bfb[i] = col_up;
10 }
11
12 void maus_clipboard_set_text(Maus* mw, const char* text)
13@@ -381,6 +384,9 @@ void maus_present(Maus* mw)
14 return;
15 HDC wdc = GetDC(be->hwnd);
16
17+ uint32_t bytes = mw->stride * mw->height * sizeof(uint32_t);
18+ memcpy(mw->fb, mw->bfb, bytes);
19+
20 BitBlt(wdc, 0, 0, mw->width, mw->height, be->memdc, 0, 0, SRCCOPY);
21 ReleaseDC(be->hwnd, wdc);
22 }