Changeset 6950 for trunk/src/ddraw/OS2SURFACE.CPP
- Timestamp:
- Oct 5, 2001, 2:33:10 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/OS2SURFACE.CPP
r6935 r6950 1 /* $Id: OS2SURFACE.CPP,v 1.3 4 2001-10-03 13:49:40sandervl Exp $ */1 /* $Id: OS2SURFACE.CPP,v 1.35 2001-10-05 12:33:09 sandervl Exp $ */ 2 2 3 3 /* … … 566 566 OS2IDirectDrawSurface *MipMapSurface; 567 567 568 memset(&sBlt, 0, sizeof(sBlt)); 569 568 570 lpVtbl = &Vtbl2; 569 571 lpVtbl2 = &Vtbl2; … … 706 708 memcpy((char *)&DDSurfaceDesc, (char *)lpDDSurfaceDesc, sizeof(DDSURFACEDESC2)); 707 709 710 #ifdef DEBUG 711 dprintf(("Pixel format:")); 712 _dump_pixelformat(&lpDDSurfaceDesc->ddpfPixelFormat); 713 dprintf(("Capabilities")); 714 _dump_DDSCAPS(lpDDSurfaceDesc->ddsCaps.dwCaps); 715 _dump_DDSCAPS2(lpDDSurfaceDesc->ddsCaps.dwCaps2); 716 #endif 717 708 718 if(lpDraw->dCaps.ulDepth != 15) 709 719 { … … 1293 1303 } 1294 1304 1295 if(Mainchain)1296 {1297 diveBufNr = 0;1298 rc = DiveAllocImageBuffer( hDive,1305 // if(Mainchain) 1306 // { 1307 diveBufNr = 0; 1308 rc = DiveAllocImageBuffer( hDive, 1299 1309 &diveBufNr, 1300 1310 lpDraw->dCaps.fccColorEncoding, … … 1303 1313 dwPitchDB, 1304 1314 (PBYTE)pDiveBuffer); 1305 dprintf(("DDRAW: rc = 0x%08X\n",rc));1306 }1315 dprintf(("DDRAW: DiveAllocImageBuffer %x -> %d (rc=%d)",pDiveBuffer, diveBufNr, rc)); 1316 // } 1307 1317 1308 1318 } // end of 3rd case … … 2376 2386 delete pIRectSrc; 2377 2387 2388 if(dest->diveBufNr == DIVE_BUFFER_SCREEN && 2389 !(dwFlags & (DDBLT_COLORFILL|DDBLT_DEPTHFILL|DDBLT_ROP) ) ) 2390 { 2391 int rc, temp, fChanged = FALSE; 2392 int destheight = RECT_HEIGHT(&DestRect); 2393 int destwidth = RECT_WIDTH(&DestRect); 2394 int srcheight = RECT_HEIGHT(&SrcRect); 2395 int srcwidth = RECT_WIDTH(&SrcRect); 2396 2397 //if full surface blit or stretching blit, then use Dive 2398 if( (src->DDSurfaceDesc.dwHeight == srcheight && 2399 src->DDSurfaceDesc.dwWidth == srcwidth) || 2400 (srcwidth != destwidth && srcheight != destheight) ) 2401 { 2402 SETUP_BLITTER sBlt = {0}; 2403 2404 sBlt.ulStructLen = sizeof(sBlt); 2405 sBlt.fInvert = 0; 2406 sBlt.fccSrcColorFormat = src->DDSurfaceDesc.ddpfPixelFormat.dwFourCC; 2407 sBlt.ulSrcWidth = srcwidth; 2408 sBlt.ulSrcHeight = srcheight; 2409 sBlt.ulSrcPosX = SrcRect.left; 2410 sBlt.ulSrcPosY = src->DDSurfaceDesc.dwHeight-SrcRect.bottom; 2411 sBlt.ulDitherType = 0; 2412 sBlt.fccDstColorFormat = dest->DDSurfaceDesc.ddpfPixelFormat.dwFourCC; 2413 sBlt.ulDstWidth = destwidth; 2414 sBlt.ulDstHeight = destheight; 2415 sBlt.lDstPosX = 0; 2416 sBlt.lDstPosY = 0; 2417 sBlt.lScreenPosX = DestRect.left; 2418 sBlt.lScreenPosY = dest->DDSurfaceDesc.dwHeight-DestRect.bottom; 2419 sBlt.ulNumDstRects = DIVE_FULLY_VISIBLE; 2420 sBlt.pVisDstRects = NULL; 2421 2422 if(dest->lpClipper && dest->lpClipper->IsClipListChangedInt()) 2423 { 2424 DWORD rgnsize; 2425 if(ClipGetClipList((IDirectDrawClipper*)dest->lpClipper, NULL, NULL, &rgnsize) == DD_OK) 2426 { 2427 LPRGNDATA lpRgnData = (LPRGNDATA)alloca(rgnsize); 2428 if(lpRgnData == NULL) { 2429 DebugInt3(); 2430 goto dodiveblit; 2431 } 2432 if(ClipGetClipList((IDirectDrawClipper*)dest->lpClipper, NULL, lpRgnData, &rgnsize) == DD_OK) 2433 { 2434 OS2RECTL *pRectl = (OS2RECTL *)&lpRgnData->Buffer; 2435 2436 if(sBlt.ulNumDstRects == 0) { 2437 dprintf(("empty cliplist, return")); 2438 return DD_OK; 2439 } 2440 for(i=0;i<lpRgnData->rdh.nCount;i++) 2441 { 2442 temp = pRectl[i].yTop; 2443 pRectl[i].yTop = dest->DDSurfaceDesc.dwHeight - pRectl[i].yBottom; 2444 pRectl[i].yBottom = dest->DDSurfaceDesc.dwHeight - temp; 2445 //clip rectangle must be relative to lScreenPos 2446 pRectl[i].xLeft -= sBlt.lScreenPosX; 2447 pRectl[i].xRight -= sBlt.lScreenPosX; 2448 pRectl[i].yTop -= sBlt.lScreenPosY; 2449 pRectl[i].yBottom -= sBlt.lScreenPosY; 2450 } 2451 fChanged = TRUE; 2452 sBlt.ulNumDstRects = lpRgnData->rdh.nCount; 2453 sBlt.pVisDstRects = (PRECTL)&lpRgnData->Buffer; 2454 } 2455 } 2456 } 2457 dodiveblit: 2458 if(fChanged || memcmp(&sBlt, &dest->sBlt, sizeof(sBlt)-sizeof(PRECTL)-sizeof(ULONG))) 2459 { 2460 dprintf(("Setting up blitter: src (%d,%d)(%d,%d)", sBlt.ulSrcPosX, sBlt.ulSrcPosY, sBlt.ulSrcWidth, sBlt.ulSrcHeight)); 2461 dprintf(("Setting up blitter: dest (%d,%d)(%d,%d)", sBlt.lScreenPosX, sBlt.lScreenPosY, sBlt.ulDstWidth, sBlt.ulDstHeight)); 2462 rc = DiveSetupBlitter(dest->hDive, &sBlt); 2463 if(rc) { 2464 dprintf(("DiveSetupBlitter returned %d", rc)); 2465 return(DD_OK); 2466 } 2467 sBlt.ulNumDstRects = DIVE_FULLY_VISIBLE; 2468 sBlt.pVisDstRects = NULL; 2469 memcpy(&dest->sBlt, &sBlt, sizeof(sBlt)); 2470 } 2471 dprintf(("DiveBlitImage %x %d->%d", dest->hDive, src->diveBufNr, dest->diveBufNr)); 2472 rc = DiveBlitImage(dest->hDive, src->diveBufNr, dest->diveBufNr); 2473 if(rc) { 2474 dprintf(("DiveBlitImage returned %d", rc)); 2475 return(DD_OK); 2476 } 2477 return DD_OK; 2478 } 2479 } 2480 2378 2481 //TODO: do we need to check the source for clipping information in case 2379 2482 // the app wants to copy from the frame buffer? … … 2403 2506 newsrc.bottom = newsrc.top + RECT_HEIGHT(&newdest); 2404 2507 2508 // DDSURFACEDESC2 surfdesc = {0}; 2509 // SurfLock4(dest, &newdest, &surfdesc, 0, 0); 2510 2405 2511 ret = SurfDoBlt(This, &newdest, lpDDSrcSurface, &newsrc, dwFlags, lpDDBltFx); 2406 2512 if(ret != DD_OK) { 2407 2513 break; 2408 2514 } 2515 // SurfUnlock(dest, surfdesc.lpSurface); 2409 2516 } 2410 2517 } … … 4487 4594 return DDERR_INVALIDPARAMS; 4488 4595 4596 #ifdef DEBUG 4597 _dump_pixelformat(&me->DDSurfaceDesc.ddpfPixelFormat); 4598 #endif 4599 4489 4600 memcpy( (char*)lpPixelFormat, 4490 4601 (char*)&(me->DDSurfaceDesc.ddpfPixelFormat), … … 4703 4814 pIRectNew); 4704 4815 4816 if(me->diveBufNr == DIVE_BUFFER_SCREEN) 4817 { 4818 OS2RECTL rectOS2; 4819 4820 rectOS2.xLeft = pIRectNew->Left(); 4821 rectOS2.yBottom = me->DDSurfaceDesc.dwHeight - pIRectNew->Bottom(); 4822 rectOS2.xRight = pIRectNew->Right(); 4823 rectOS2.yTop = me->DDSurfaceDesc.dwHeight - pIRectNew->Top(); 4824 dprintf(("DiveAcquireFrameBuffer (%d,%d)(%d,%d)", rectOS2.xLeft, rectOS2.yBottom, rectOS2.xRight, rectOS2.yTop)); 4825 int ret = DiveAcquireFrameBuffer(me->hDive, (PRECTL)&rectOS2); 4826 if(ret) { 4827 dprintf(("ERROR: DiveAcquireFrameBuffer failed with %d", ret)); 4828 } 4829 } 4705 4830 me->fLocked = TRUE; 4706 4831 } … … 5124 5249 else 5125 5250 dprintf( ("No ColorConversion Needed")); 5251 5252 5253 if(me->diveBufNr == DIVE_BUFFER_SCREEN) 5254 { 5255 OS2RECTL rectOS2; 5256 5257 rectOS2.xLeft = pIRectEnum->Left(); 5258 rectOS2.yBottom = me->DDSurfaceDesc.dwHeight - pIRectEnum->Bottom(); 5259 rectOS2.xRight = pIRectEnum->Right(); 5260 rectOS2.yTop = me->DDSurfaceDesc.dwHeight - pIRectEnum->Top(); 5261 dprintf(("DiveDeacquireFrameBuffer (%d,%d)(%d,%d)", rectOS2.xLeft, rectOS2.yBottom, rectOS2.xRight, rectOS2.yTop)); 5262 int ret = DiveDeacquireFrameBuffer(me->hDive); 5263 if(ret) { 5264 dprintf(("ERROR: DiveDeacquireFrameBuffer failed with %d", ret)); 5265 } 5266 } 5126 5267 5127 5268 // delete tne DDRectobject of the found rectangle
Note:
See TracChangeset
for help on using the changeset viewer.