| 312 | // --------------------------------------------------------------------------- |
| 313 | |
| 314 | void grSurface::uniblt(int dx, int dy, grSurface *ssf, int sx, int sy, int sw, int sh) { |
| 315 | int rowsize; |
| 316 | |
| 317 | ASSERT(m_SurfInit); |
| 318 | |
| 319 | // mode 11b = dd_to_dd, 01b = mem_to_dd, 10b = dd_to_mem, 00b = mem_to_mem |
| 320 | int mode = 0; |
| 321 | ddgr_surface *dsfs = &ddsfObj, *ssfs = &ssf->ddsfObj; |
| 322 | bool err; |
| 323 | |
| 324 | // setup blitting mode |
| 325 | if (ssfs->type == SURFTYPE_GENERIC || ssfs->type == SURFTYPE_VIDEOSCREEN) |
| 326 | mode = mode | 0x1; |
| 327 | if (dsfs->type == SURFTYPE_GENERIC || dsfs->type == SURFTYPE_VIDEOSCREEN) |
| 328 | mode = mode | 0x2; |
| 329 | |
| 330 | /* case 1: os->os |
| 331 | just invoke os blitter |
| 332 | */ |
| 333 | if (mode == 0x3) { |
| 334 | ASSERT(!surf_Locked); |
| 335 | err = ddgr_surf_Blt(dsfs, dx, dy, ssfs, sx, sy, sw, sh); |
| 336 | return; |
| 337 | } |
| 338 | |
| 339 | /* case 2: mem->mem |
| 340 | just lock both surfaces and do a memory blt. |
| 341 | */ |
| 342 | if (mode == 0) { |
| 343 | err = gr_mem_surf_Blt(dsfs, dx, dy, ssfs, sx, sy, sw, sh); |
| 344 | return; |
| 345 | } |
| 346 | |
| 347 | /* case 3: os->mem |
| 348 | This requires locking both surfaces and performing a memory blt. |
| 349 | This also means tricking the memory blitter into thinking that the OS surface |
| 350 | is a memory surface |
| 351 | */ |
| 352 | if (mode == 0x1) { |
| 353 | char *data = ssf->lock(&rowsize); |
| 354 | |
| 355 | grSurface::scratch_mem_surf->w = ssfs->w; |
| 356 | grSurface::scratch_mem_surf->h = ssfs->h; |
| 357 | grSurface::scratch_mem_surf->bpp = ssfs->bpp; |
| 358 | grSurface::scratch_mem_surf->type = SURFTYPE_MEMORY; |
| 359 | grSurface::scratch_mem_surf->flags = ssfs->flags; |
| 360 | |
| 361 | gr_mem_surf_Init(grSurface::scratch_mem_surf, data, rowsize); |
| 362 | err = gr_mem_surf_Blt(dsfs, dx, dy, grSurface::scratch_mem_surf, sx, sy, sw, sh); |
| 363 | |
| 364 | ssf->unlock(); |
| 365 | return; |
| 366 | } |
| 367 | |
| 368 | /* case 4: mem->os |
| 369 | This requires locking both surfaces and performing a memory blt. |
| 370 | This also means tricking the memory blitter into thinking that the OS surface |
| 371 | is a memory surface |
nothing calls this directly
no test coverage detected