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

Function ddgr_dx_surf_Lock

dd_grwin32/ddgrWin32DX.cpp:209–231  ·  view source on GitHub ↗

retrieves a pointer to surface memory. allowed to lock one surface multiple times. ptr is the returned pointer to surface memory. used to unlock surface also rowsize is the size in bytes of one row of memory. */

Source from the content-addressed store, hash-verified

207 rowsize is the size in bytes of one row of memory.
208*/
209bool ddgr_dx_surf_Lock(ddgr_surface *sf, void **ptr, int *rowsize) {
210 HRESULT hres;
211 DDSURFACEDESC ddsd;
212 tDXSurface *bm = (tDXSurface *)sf->obj;
213
214 memset(&ddsd, 0, sizeof(ddsd));
215 ddsd.dwSize = sizeof(ddsd);
216
217 if (bm->backbuffer)
218 hres = bm->lpddsback->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
219 else
220 hres = bm->lpdds->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
221
222 if (hres != DD_OK) {
223 ddgr_PushError("Unable to set lock DirectDraw surface(%d)\n", LOWORD(hres));
224 return false;
225 }
226
227 *rowsize = (int)ddsd.lPitch;
228 *ptr = ddsd.lpSurface;
229
230 return true;
231}
232
233bool ddgr_dx_surf_Unlock(ddgr_surface *sf, void *ptr) {
234 HRESULT hres;

Callers 1

ddgr_surf_LockFunction · 0.85

Calls 2

ddgr_PushErrorFunction · 0.85
LockMethod · 0.45

Tested by

no test coverage detected