MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / OnPaint

Method OnPaint

editor/GrFontDialog.cpp:220–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void CGrFontDialog::OnPaint() {
221 CPaintDC dc(this); // device context for painting
222 CWnd *fontwnd;
223 RECT rect;
224 int w, h;
225
226 if (m_FontPicBm > -1) {
227 grHardwareSurface surf(bm_w(m_FontPicBm, 0), bm_h(m_FontPicBm, 0), bm_bpp(m_FontPicBm));
228
229 fontwnd = GetDlgItem(IDC_STATIC_FONTVIEW);
230 fontwnd->GetWindowRect(&rect);
231 ScreenToClient(&rect);
232
233 w = rect.right - rect.left - 4;
234 h = rect.bottom - rect.top - 4;
235
236 if (w > (surf.width() - 4))
237 w = surf.width() - 4;
238 if (h > (surf.height() - 4))
239 h = surf.height() - 4;
240
241 // load bitmap, convert transparency to pure black and then blt
242 surf.load(m_FontPicBm);
243 surf.replace_color(TRANSPARENT_COLOR32, 0);
244
245 Desktop_surf->attach_to_window((unsigned)m_hWnd);
246 Desktop_surf->blt(rect.left + 2, rect.top + 2, &surf, 0, 0, w, h);
247 Desktop_surf->attach_to_window((unsigned)NULL);
248 }
249}
250
251int CGrFontDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) {
252 if (CDialog::OnCreate(lpCreateStruct) == -1)

Callers

nothing calls this directly

Calls 9

bm_wFunction · 0.85
bm_hFunction · 0.85
bm_bppFunction · 0.85
replace_colorMethod · 0.80
attach_to_windowMethod · 0.80
widthMethod · 0.45
heightMethod · 0.45
loadMethod · 0.45
bltMethod · 0.45

Tested by

no test coverage detected