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

Method UpdateMegaSetView

editor/MegacellKeypad.cpp:176–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176void CMegacellKeypad::UpdateMegaSetView() {
177 int n = D3EditState.current_megacell;
178 CWnd *texwnd;
179 RECT rect;
180 int x, y, bm_handle, w, h;
181 int megawidth = Megacells[n].width;
182 int megaheight = Megacells[n].height;
183 int i, t;
184
185 Desktop_surf->attach_to_window((unsigned)m_hWnd);
186
187 texwnd = GetDlgItem(IDC_MEGACELL_SET_VIEW);
188 texwnd->GetWindowRect(&rect);
189 ScreenToClient(&rect);
190 w = rect.right - rect.left;
191 h = rect.bottom - rect.top;
192
193 Desktop_surf->clear(rect.left, rect.top, w, h);
194
195 if (megawidth > 0) {
196 int texwidth = w / megawidth;
197 int texheight = h / megaheight;
198
199 // Don't have to clear if we're overwriting the whole area!
200
201 for (i = 0; i < megaheight; i++) {
202 for (t = 0; t < megawidth; t++) {
203 m_TextureSurf.create(texwidth, texheight, BPP_16);
204
205 bm_handle = GetTextureBitmap(Megacells[n].texture_handles[i * MAX_MEGACELL_WIDTH + t], 0);
206 m_TextureSurf.load(bm_handle);
207
208 x = 1 + rect.left + (t * texwidth);
209 y = 1 + rect.top + (i * texheight);
210
211 Desktop_surf->blt(x, y, &m_TextureSurf);
212
213 m_TextureSurf.free();
214 }
215 }
216 }
217
218 Desktop_surf->attach_to_window((unsigned)NULL);
219}
220
221void CMegacellKeypad::OnFillWithMegacell() { return; }
222

Callers

nothing calls this directly

Calls 7

GetTextureBitmapFunction · 0.85
attach_to_windowMethod · 0.80
clearMethod · 0.45
createMethod · 0.45
loadMethod · 0.45
bltMethod · 0.45
freeMethod · 0.45

Tested by

no test coverage detected