MCPcopy Create free account
hub / github.com/NetHack/NetHack / onWMPaint

Function onWMPaint

win/win32/mhstatus.c:280–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280static LRESULT
281onWMPaint(HWND hWnd, WPARAM wParam UNUSED, LPARAM lParam UNUSED)
282{
283 SIZE sz;
284 WCHAR wbuf[BUFSZ];
285 RECT rt;
286 PAINTSTRUCT ps;
287 PNHStatusWindow data;
288 int width, height;
289 RECT clear_rect;
290 HDC front_buffer_hdc;
291
292 data = (PNHStatusWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA);
293
294 front_buffer_hdc = BeginPaint(hWnd, &ps);
295 GetClientRect(hWnd, &rt);
296
297 width = rt.right - rt.left;
298 height = rt.bottom - rt.top;
299
300 back_buffer_size(&data->back_buffer, width, height);
301
302 HDC hdc = data->back_buffer.hdc;
303
304 SetBkColor(hdc, status_bg_color);
305 SetTextColor(hdc, status_fg_color);
306
307 clear_rect.left = 0;
308 clear_rect.top = 0;
309 clear_rect.right = width;
310 clear_rect.bottom = height;
311
312 FillRect(hdc, &clear_rect, status_bg_brush);
313
314 if (data->status_lines != NULL) {
315
316 data->has_blink_fields = FALSE;
317
318 for (int line = 0; line < NHSW_LINES; line++) {
319 LONG left = rt.left;
320 LONG cy = 0;
321 int vlen;
322
323 mswin_status_line * status_line = &data->status_lines->lines[line];
324
325 for (int i = 0; i < status_line->status_strings.count; i++) {
326 mswin_status_string * status_string = status_line->status_strings.status_strings[i];
327 int clr, atr;
328 int fntatr = ATR_NONE;
329 COLORREF nFg, nBg;
330
331 if (status_string->str == NULL || status_string->str[0] == '\0')
332 continue;
333
334 clr = status_string->color;
335 atr = status_string->attribute;
336
337 const char *str = status_string->str;

Callers 1

StatusWndProcFunction · 0.85

Calls 5

back_buffer_sizeFunction · 0.85
winos_ascii_to_wide_strFunction · 0.85
mswin_get_fontFunction · 0.70
nhcolor_to_RGBFunction · 0.70
RGBClass · 0.50

Tested by

no test coverage detected