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. */
| 207 | rowsize is the size in bytes of one row of memory. |
| 208 | */ |
| 209 | bool 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 | |
| 233 | bool ddgr_dx_surf_Unlock(ddgr_surface *sf, void *ptr) { |
| 234 | HRESULT hres; |
no test coverage detected