- Timestamp:
- Aug 16, 1999, 2:40:48 AM (26 years ago)
- Location:
- trunk/src/ddraw
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/OS2CLIPPER.CPP
r210 r503 8 8 #include "misc.h" 9 9 #include <winerror.h> 10 #include <odincrt.h> 10 11 11 12 //****************************************************************************** … … 83 84 if(me->Referenced == 0) 84 85 { 85 delete me;86 ODIN_delete( me); 86 87 return(0); 87 88 } -
trunk/src/ddraw/OS2D3D.CPP
r210 r503 11 11 #include <winerror.h> 12 12 #include <builtin.h> 13 #include <odincrt.h> 13 14 #undef THIS 14 15 #define THIS VOID* … … 22 23 23 24 if(IID_IDirect3D != (GUID &)&riid) 24 return E_NOINTERFACE;25 return E_NOINTERFACE; 25 26 26 27 *ppvObj = This; … … 46 47 dprintf(("OS2IDirectDraw::Release %d\n", me->Referenced-1)); 47 48 dprintf(("OS2IDirectDraw::%X \n", me)); 48 if(me->Referenced) { 49 me->Referenced--; 50 if(me->Referenced == 0) { 51 delete me; 49 if(me->Referenced) 50 { 51 me->Referenced--; 52 if(me->Referenced == 0) 53 { 54 ODIN_delete(me); 55 return(0); 56 } 57 else 58 return me->Referenced; 59 } 60 else 52 61 return(0); 53 }54 else return me->Referenced;55 }56 else return(0);57 62 } 58 63 //****************************************************************************** -
trunk/src/ddraw/OS2DDRAW.CPP
r423 r503 21 21 #include "os2ddrawmodes.h" 22 22 #include "os2DDWindow.h" 23 23 #include "os2palset.h" 24 #include <odincrt.h> 24 25 #define KEY_DIRECT2 "\\Software\\Win32OS2\\Direct2" 25 26 #define KEY_DIRECT2DRAW "\\Software\\Win32OS2\\Direct2\\Draw" … … 36 37 HKEY hkDirectDraw2; 37 38 DWORD dwVSize, dwVType; 39 ULONG rc; 38 40 39 41 // Setup table for 3d devices … … 126 128 } 127 129 128 ULONG rc = DiveOpen( &hDive, 129 FALSE, 130 &pFrameBuffer); 130 ODIN_FS_BEGIN 131 rc = DiveOpen( &hDive, 132 FALSE, 133 &pFrameBuffer); 134 ODIN_FS_END 131 135 if(rc) 132 136 { … … 160 164 if(hDive) 161 165 DiveClose(hDive); 166 if(hDiveColorConv) 167 DiveClose(hDiveColorConv); 168 169 // Safty call in case the program did set the pal to all black 170 // so if the destructor gets called we might be able change this back 171 OS2ResetPhysPalette(); 162 172 } 163 173 //****************************************************************************** … … 199 209 *ppvObj = This; 200 210 DrawAddRef(This); 211 201 212 return(DD_OK); 202 213 } … … 218 229 { 219 230 OS2IDirectDraw *me = (OS2IDirectDraw *)This; 231 ULONG rc; 220 232 221 233 #ifdef DEBUG … … 230 242 if(me->Referenced == 0) 231 243 { 232 delete me;233 r eturn(0);244 ODIN_delete(me); 245 rc = 0; 234 246 } 235 247 else 236 r eturnme->Referenced;248 rc = me->Referenced; 237 249 } 238 250 else 239 return(0); 251 rc = 0; 252 253 return rc; 240 254 } 241 255 //****************************************************************************** … … 254 268 { 255 269 OS2IDirectDraw *me = (OS2IDirectDraw *)This; 256 OS2IDirectDrawClipper *newclip = new OS2IDirectDrawClipper(me);270 OS2IDirectDrawClipper *newclip; 257 271 HRESULT rc; 258 272 273 ODIN_FS_BEGIN 274 275 newclip = new OS2IDirectDrawClipper(me); 276 259 277 #ifdef DEBUG 260 278 WriteLog("CreateClipper\n"); … … 262 280 263 281 if(newclip == NULL) 264 return(DDERR_OUTOFMEMORY); 265 266 newclip->Vtbl.AddRef((IDirectDrawClipper *)newclip); 267 rc = newclip->GetLastError(); 268 if(rc != DD_OK) 269 { 270 *lplpDD = NULL; 271 delete newclip; 282 { 283 rc = DDERR_OUTOFMEMORY; 272 284 } 273 285 else 274 *lplpDD = (IDirectDrawClipper *)newclip; 286 { 287 newclip->Vtbl.AddRef((IDirectDrawClipper *)newclip); 288 rc = newclip->GetLastError(); 289 if(rc != DD_OK) 290 { 291 *lplpDD = NULL; 292 delete newclip; 293 } 294 else 295 *lplpDD = (IDirectDrawClipper *)newclip; 296 } 297 298 ODIN_FS_END 275 299 276 300 return(rc); … … 285 309 OS2IDirectDraw *me = (OS2IDirectDraw *)This; 286 310 OS2IDirectDrawPalette *newpal; 287 HRESULT rc ;311 HRESULT rc = DD_OK; 288 312 int palsize = 0; 289 313 314 ODIN_FS_BEGIN 315 290 316 if(dwFlags & DDPCAPS_8BITENTRIES) 291 317 { 292 318 // We Don't support Indexed palettes... 293 319 294 r eturnDDERR_INVALIDPARAMS;320 rc = DDERR_INVALIDPARAMS; 295 321 } 296 322 … … 305 331 306 332 if(palsize == 0) 307 return DDERR_INVALIDPARAMS; 308 309 #ifdef DEBUG 310 WriteLog("CreatePalette with %d colors\n", palsize); 311 #endif 312 313 newpal = new OS2IDirectDrawPalette(me, palsize, lpColorTable, dwFlags); 314 if(newpal == NULL) 315 return(DDERR_OUTOFMEMORY); 316 317 newpal->Vtbl.AddRef((IDirectDrawPalette *)newpal); 318 rc = newpal->GetLastError(); 319 if(rc != DD_OK) 320 { 321 *lplpDD = NULL; 322 delete newpal; 323 } 324 else 325 *lplpDD = (IDirectDrawPalette *)newpal; 333 rc = DDERR_INVALIDPARAMS; 334 335 if(DD_OK == rc) 336 { 337 #ifdef DEBUG 338 WriteLog("CreatePalette with %d colors\n", palsize); 339 #endif 340 341 newpal = new OS2IDirectDrawPalette(me, palsize, lpColorTable, dwFlags); 342 343 if(newpal == NULL) 344 { 345 rc = DDERR_OUTOFMEMORY; 346 } 347 else 348 { 349 newpal->Vtbl.AddRef((IDirectDrawPalette *)newpal); 350 rc = newpal->GetLastError(); 351 352 if(DD_OK != rc) 353 { 354 *lplpDD = NULL; 355 delete newpal; 356 } 357 else 358 *lplpDD = (IDirectDrawPalette *)newpal; 359 } 360 } 361 362 ODIN_FS_END 326 363 327 364 return(rc); … … 336 373 OS2IDirectDrawSurface *newsurf; 337 374 HRESULT rc; 375 376 ODIN_FS_BEGIN 338 377 339 378 #ifdef DEBUG … … 351 390 352 391 newsurf = new OS2IDirectDrawSurface(me, (LPDDSURFACEDESC2)lpDDSurfaceDesc); 353 354 392 if(newsurf == NULL) 355 return(DDERR_OUTOFMEMORY); 356 357 newsurf->Vtbl.AddRef((IDirectDrawSurface *)newsurf); 358 rc = newsurf->GetLastError(); 359 if(rc != DD_OK) 360 { 361 WriteLog("Error createing Surface\n\n"); 362 *lplpDD = NULL; 363 delete newsurf; 393 { 394 rc = DDERR_OUTOFMEMORY; 364 395 } 365 396 else 366 *lplpDD = (IDirectDrawSurface *)newsurf; 367 368 WriteLog("New Surface created at %08X\n\n", newsurf); 397 { 398 newsurf->Vtbl.AddRef((IDirectDrawSurface *)newsurf); 399 rc = newsurf->GetLastError(); 400 if(rc != DD_OK) 401 { 402 WriteLog("Error createing Surface\n\n"); 403 *lplpDD = NULL; 404 delete newsurf; 405 } 406 else 407 *lplpDD = (IDirectDrawSurface *)newsurf; 408 409 WriteLog("New Surface created at %08X\n\n", newsurf); 410 } 411 412 ODIN_FS_END 413 369 414 return(rc); 370 415 } … … 379 424 HRESULT rc; 380 425 381 #ifdef DEBUG 382 WriteLog("CreateSurface4\n"); 383 WriteLog("dwSize %d\n", lpDDSurfaceDesc2->dwSize); 384 WriteLog("dwHeight %d\n", lpDDSurfaceDesc2->dwHeight); 385 WriteLog("dwWidth %d\n", lpDDSurfaceDesc2->dwWidth); 386 WriteLog("lPitch %d\n", lpDDSurfaceDesc2->lPitch); 387 WriteLog("dwBackBufferCount %d\n", lpDDSurfaceDesc2->dwBackBufferCount); 388 WriteLog("dwMipMapCount %d\n", lpDDSurfaceDesc2->dwMipMapCount); 389 WriteLog("dwAlphaBitDepth %d\n", lpDDSurfaceDesc2->dwAlphaBitDepth); 390 WriteLog("ddsCaps.dwCaps %X\n", lpDDSurfaceDesc2->ddsCaps.dwCaps); 391 #endif 426 ODIN_FS_BEGIN 427 428 #ifdef DEBUG 429 WriteLog("CreateSurface4\n"); 430 WriteLog("dwSize %d\n", lpDDSurfaceDesc2->dwSize); 431 WriteLog("dwHeight %d\n", lpDDSurfaceDesc2->dwHeight); 432 WriteLog("dwWidth %d\n", lpDDSurfaceDesc2->dwWidth); 433 WriteLog("lPitch %d\n", lpDDSurfaceDesc2->lPitch); 434 WriteLog("dwBackBufferCount %d\n", lpDDSurfaceDesc2->dwBackBufferCount); 435 WriteLog("dwMipMapCount %d\n", lpDDSurfaceDesc2->dwMipMapCount); 436 WriteLog("dwAlphaBitDepth %d\n", lpDDSurfaceDesc2->dwAlphaBitDepth); 437 WriteLog("ddsCaps.dwCaps %X\n", lpDDSurfaceDesc2->ddsCaps.dwCaps); 438 #endif 392 439 393 440 newsurf = new OS2IDirectDrawSurface(me, lpDDSurfaceDesc2); 394 441 395 442 if(newsurf == NULL) 396 return(DDERR_OUTOFMEMORY); 397 398 newsurf->Vtbl.AddRef((IDirectDrawSurface *)newsurf); 399 rc = newsurf->GetLastError(); 400 if(rc != DD_OK) 401 { 402 WriteLog("Error createing Surface\n\n"); 403 *lplpDD = NULL; 404 delete newsurf; 443 { 444 rc =DDERR_OUTOFMEMORY; 405 445 } 406 446 else 407 *lplpDD = (IDirectDrawSurface4 *)newsurf; 408 409 WriteLog("New Surface created at %08X\n\n", newsurf); 447 { 448 newsurf->Vtbl.AddRef((IDirectDrawSurface *)newsurf); 449 rc = newsurf->GetLastError(); 450 if(rc != DD_OK) 451 { 452 WriteLog("Error createing Surface\n\n"); 453 *lplpDD = NULL; 454 455 delete newsurf; 456 } 457 else 458 *lplpDD = (IDirectDrawSurface4 *)newsurf; 459 460 WriteLog("New Surface created at %08X\n\n", newsurf); 461 } 462 463 ODIN_FS_END 410 464 411 465 return(rc); … … 416 470 { 417 471 #ifdef DEBUG 418 WriteLog("DuplicateSurface \n");472 WriteLog("DuplicateSurface NIY\n"); 419 473 #endif 420 474 return(DD_OK); … … 425 479 { 426 480 #ifdef DEBUG 427 WriteLog("DuplicateSurface \n");481 WriteLog("DuplicateSurface4 NIY\n"); 428 482 #endif 429 483 … … 454 508 } 455 509 510 511 ODIN_FS_BEGIN 456 512 457 513 // Setting up the surface … … 481 537 DDSurfAct.ddpfPixelFormat.dwRGBBitCount = ModesDive[0].iBits; 482 538 if(!lpDDEnumModesCallback(&DDSurfAct,lpContext)) 539 { 540 {ODIN_FS_END 483 541 return (DD_OK); 542 } 484 543 } 485 544 // Don't know the flag for Mode X so we skip reporting it … … 550 609 DDSurfAct.ddpfPixelFormat.dwRGBBitCount = ModesDive[0].iBits; 551 610 if(!lpDDEnumModesCallback(&DDSurfAct,lpContext)) 611 { 612 {ODIN_FS_END 552 613 return (DD_OK); 614 } 553 615 } 554 616 // Don't know the flag for Mode X so we skip reporting it … … 619 681 620 682 if (lpDDSurfaceDesc->dwFlags & !(DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT)) 683 { 684 {ODIN_FS_END 621 685 return(DDERR_INVALIDPARAMS); 686 } 622 687 623 688 iMode = 2; … … 652 717 } 653 718 719 ODIN_FS_END 720 654 721 return(DD_OK); 655 722 } … … 665 732 666 733 #ifdef DEBUG 667 WriteLog("EnumDisplayModes4 \n");734 WriteLog("EnumDisplayModes4 NIY\n"); 668 735 #endif 669 736 return(DD_OK); … … 674 741 { 675 742 #ifdef DEBUG 676 WriteLog("EnumSurfaces \n");743 WriteLog("EnumSurfaces NIY\n"); 677 744 #endif 678 745 … … 684 751 { 685 752 #ifdef DEBUG 686 WriteLog("EnumSurfaces4 \n");753 WriteLog("EnumSurfaces4 NIY\n"); 687 754 #endif 688 755 … … 694 761 { 695 762 #ifdef DEBUG 696 WriteLog("FlipToGDISurface \n");763 WriteLog("FlipToGDISurface NIY\n"); 697 764 #endif 698 765 … … 718 785 719 786 // Clear structure so we only have to set the supported flags 787 788 ODIN_FS_BEGIN 720 789 memset(lpDDDriverCaps,0,sizeof(DDCAPS)); 790 ODIN_FS_END 721 791 722 792 // Reset the size … … 1063 1133 { 1064 1134 #ifdef DEBUG 1065 WriteLog("GetGDISurface \n");1135 WriteLog("GetGDISurface NYI\n"); 1066 1136 #endif 1067 1137 … … 1073 1143 { 1074 1144 #ifdef DEBUG 1075 WriteLog("GetGDISurface \n");1145 WriteLog("GetGDISurface NYI\n"); 1076 1146 #endif 1077 1147 … … 1089 1159 if(NULL==lpdwFreq) 1090 1160 return(DDERR_INVALIDPARAMS); 1161 1162 ODIN_FS_BEGIN 1091 1163 1092 1164 if(DD_OK==DrawWaitForVerticalBlank(This, dwFlags, 0)) … … 1110 1182 *lpdwFreq = 70; 1111 1183 } 1184 1185 ODIN_FS_END 1186 1112 1187 return(DD_OK); 1113 1188 } … … 1140 1215 HRESULT __stdcall DrawGetVerticalBlankStatus(THIS , LPBOOL lpbIsInVB) 1141 1216 { 1217 int rc; 1142 1218 #ifdef DEBUG 1143 1219 WriteLog("GetVerticalBlankStatus\n"); … … 1145 1221 if(NULL==lpbIsInVB) 1146 1222 return(DDERR_INVALIDPARAMS); 1147 if(0==io_init1()) // try to get IOPL for the thread 1223 1224 ODIN_FS_BEGIN 1225 rc = io_init1(); 1226 ODIN_FS_END 1227 1228 if(0==rc) // try to get IOPL for the thread 1148 1229 { 1149 1230 *lpbIsInVB = (c_inb1(0x3da)&0x08)!=0; 1150 io_exit1(); // reset IOPL 1231 ODIN_FS_BEGIN 1232 io_exit1(); // reset IOPL 1233 ODIN_FS_END 1151 1234 return(DD_OK); 1152 1235 } … … 1186 1269 me->hwndClient = hwndClient; 1187 1270 #if 0 1188 OS2DDSubclassWindow(hwndClient);1271 OS2DDSubclassWindow(hwndClient); 1189 1272 #endif 1190 1273 return(DD_OK); … … 1200 1283 OS2IDirectDraw *me = (OS2IDirectDraw *)This; 1201 1284 1202 #ifdef DEBUG 1203 WriteLog("SetDisplayMode2 to %dx%d with %d bits colors\n", dwWidth, dwHeight, dwBPP); 1204 #endif 1285 #ifdef DEBUG 1286 WriteLog("SetDisplayMode2 to %dx%d with %d bits colors\n", dwWidth, dwHeight, dwBPP); 1287 #endif 1288 1205 1289 me->screenwidth = dwWidth; 1206 1290 me->screenheight = dwHeight; … … 1247 1331 { 1248 1332 HRESULT rc; 1333 int rci; 1334 1249 1335 #ifdef DEBUG 1250 1336 WriteLog("WaitForVerticalBlank\n"); … … 1254 1340 return (DDERR_UNSUPPORTED); 1255 1341 1256 if(io_init1()) // try to get IOPL for the thread 1342 ODIN_FS_BEGIN 1343 rci = io_init1(); 1344 ODIN_FS_END 1345 1346 if(rci) // try to get IOPL for the thread 1257 1347 return (DDERR_UNSUPPORTED); // we failed so return error that we don't support this 1258 1348 … … 1283 1373 } 1284 1374 1285 io_exit1(); 1375 ODIN_FS_BEGIN 1376 io_exit1(); 1377 ODIN_FS_END 1286 1378 1287 1379 return (rc); … … 1344 1436 { 1345 1437 #ifdef DEBUG 1346 WriteLog("GetSurfaceFromDC Unimplemented Stub\n");1438 WriteLog("GetSurfaceFromDC NYI\n"); 1347 1439 #endif 1348 1440 … … 1379 1471 if(NULL==lpdddi) 1380 1472 return DDERR_INVALIDPARAMS; 1473 1474 ODIN_FS_BEGIN 1381 1475 1382 1476 memset( lpdddi, … … 1388 1482 strcpy( lpdddi->szDescription, 1389 1483 "ODIN DD Emulation Driver"); 1484 1485 ODIN_FS_END 1486 1390 1487 return(DD_OK); 1391 1488 } … … 1396 1493 DWORD dwVType, dwVSize; 1397 1494 HKEY hkDirectDraw2; 1495 1496 ODIN_FS_BEGIN 1398 1497 1399 1498 if (bScale) … … 1410 1509 bScale = FALSE; 1411 1510 } 1412 } 1413 //****************************************************************************** 1414 //****************************************************************************** 1415 1511 1512 ODIN_FS_END 1513 } 1514 //****************************************************************************** 1515 //****************************************************************************** 1516 -
trunk/src/ddraw/OS2PALETTE.CPP
r210 r503 10 10 #include "os2palset.h" 11 11 #include <winerror.h> 12 #include <odincrt.h> 12 13 13 14 //****************************************************************************** … … 96 97 if(me->Referenced == 0) 97 98 { 98 delete me;99 ODIN_delete(me); 99 100 return(0); 100 101 } … … 141 142 return(DDERR_INVALIDPARAMS); 142 143 144 ODIN_FS_BEGIN 145 143 146 memcpy( (char *)lpEntries, 144 147 (char *)(me->os2pal + dwBase), 145 148 dwNumEntries*sizeof(PALETTEENTRY)); 149 150 ODIN_FS_END 151 146 152 return(DD_OK); 147 153 } … … 169 175 if( (NULL== lpNewEntries) ||(0!=dwFlags) ||(dwBase<0) ||((dwBase + dwNumEntries)>me->dwSize) ) 170 176 return(DDERR_INVALIDPARAMS); 177 178 ODIN_FS_BEGIN 179 171 180 memcpy((char *)(me->os2pal + dwBase), 172 181 (char *)lpNewEntries, 173 182 dwNumEntries*sizeof(PALETTEENTRY)); 183 184 ODIN_FS_END 174 185 175 186 if(me->fAttachedToPrimary) -
trunk/src/ddraw/OS2PALSET.CPP
r210 r503 7 7 #include <string.h> 8 8 #include "os2palset.h" 9 #define FAR 10 #include "misc.h" 11 9 #include <odincrt.h> 12 10 //****************************************************************************** 13 11 //****************************************************************************** … … 19 17 RGB2 os2rgb[256]; 20 18 int i; 19 20 ODIN_FS_BEGIN 21 21 22 22 hps = WinGetPS(HWND_DESKTOP); … … 44 44 TRUE); 45 45 WinReleasePS(hps); 46 47 ODIN_FS_END 48 46 49 } 47 50 //****************************************************************************** … … 51 54 HPS hps; 52 55 HDC hdc; 56 57 ODIN_FS_BEGIN 53 58 54 59 hps = WinGetPS( HWND_DESKTOP); … … 65 70 66 71 WinReleasePS(hps); 72 73 ODIN_FS_END 74 67 75 } 68 76 //****************************************************************************** -
trunk/src/ddraw/OS2SURFACE.CPP
r423 r503 13 13 #include "asmutil.h" 14 14 #include <winerror.h> 15 #include <odincrt.h> 16 15 17 #ifndef __WATCOMC__ 16 #include <builtin.h>18 #include <builtin.h> 17 19 #endif 18 20 … … 992 994 pFillPos = pLine + dwPitchDB; 993 995 996 #ifndef USE_ASM 997 ODIN_FS_BEGIN 998 #endif 994 999 for( y=0;y<FillHeight;y++,pFillPos+=dwPitchDB) 995 1000 { … … 1003 1008 #endif 1004 1009 } 1010 #ifndef USE_ASM 1011 ODIN_FS_END 1012 #endif 1005 1013 1006 1014 return(DD_OK); … … 1225 1233 int DestroyRects(LPVOID lpItem, DWORD dwRes) 1226 1234 { 1227 delete (DDRectangle*) lpItem; 1235 DDRectangle *pItem = (DDRectangle*) lpItem; 1236 ODIN_delete(pItem); 1228 1237 return 1; 1229 1238 } … … 1243 1252 OS2IDirectDrawSurface *AttachedSurface; 1244 1253 1254 ODIN_FS_BEGIN 1255 1245 1256 if(DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) 1246 1257 { … … 1317 1328 1318 1329 lpDraw->Vtbl.Release(lpDraw); 1330 1331 ODIN_FS_END 1332 1319 1333 } 1320 1334 //****************************************************************************** … … 1406 1420 if(me->Referenced == 0) 1407 1421 { 1408 delete me;1422 ODIN_delete( me); 1409 1423 #ifndef __WATCOMC__ 1410 1424 //_interrupt(3); … … 1435 1449 OS2IDirectDrawSurface *BBCursor; 1436 1450 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; 1451 int rc; 1452 1437 1453 #ifdef DEBUG 1438 1454 WriteLog("SurfAddAttachedSurface4\n"); … … 1466 1482 if(me->DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_MIPMAP) 1467 1483 { 1468 if( DPA_InsertPtr( me->DPA_SurfaceMipMaps, 1469 DPA_GetPtrCount(me->DPA_SurfaceMipMaps), 1470 AttachedSurface) >=0) 1484 ODIN_FS_BEGIN 1485 rc = DPA_InsertPtr( me->DPA_SurfaceMipMaps, 1486 DPA_GetPtrCount(me->DPA_SurfaceMipMaps), 1487 AttachedSurface); 1488 ODIN_FS_END 1489 1490 if( rc>=0) 1471 1491 { 1472 1492 me->DDSurfaceDesc.dwFlags |= DDSD_MIPMAPCOUNT; … … 1493 1513 else 1494 1514 { 1495 if( DPA_InsertPtr( me->DPA_SurfaceAttached, 1496 DPA_GetPtrCount(me->DPA_SurfaceAttached), 1497 AttachedSurface) >=0) 1515 ODIN_FS_BEGIN 1516 rc = DPA_InsertPtr( me->DPA_SurfaceAttached, 1517 DPA_GetPtrCount(me->DPA_SurfaceAttached), 1518 AttachedSurface); 1519 ODIN_FS_END 1520 1521 if(rc>=0) 1498 1522 { 1499 1523 AttachedSurface->Vtbl.AddRef(AttachedSurface); … … 1687 1711 #endif 1688 1712 1713 ODIN_FS_BEGIN 1714 1689 1715 if (NULL!=lpDestRect) 1690 1716 { … … 1734 1760 WriteLog("Blt: Dest Surface partly locked\n"); 1735 1761 #endif 1762 {ODIN_FS_END 1736 1763 return(DDERR_SURFACEBUSY); 1737 1764 } 1738 1765 } 1766 1767 ODIN_FS_END 1739 1768 1740 1769 DestSurfaceDesc.dwSize = sizeof(DDSURFACEDESC2); … … 1824 1853 } 1825 1854 1855 ODIN_FS_BEGIN 1856 1826 1857 if (NULL!=lpSrcRect) 1827 1858 { … … 1872 1903 WriteLog("Blt: Src Surface partly locked\n"); 1873 1904 #endif 1905 {ODIN_FS_END 1874 1906 return(DDERR_SURFACEBUSY); 1875 1907 } 1876 1908 } 1909 1910 ODIN_FS_END 1877 1911 1878 1912 if( ( (NULL==lpDestRect) && (NULL!=lpSrcRect) ) || … … 1957 1991 #else 1958 1992 // Solid Blit 1993 ODIN_FS_BEGIN 1959 1994 while(1) 1960 1995 { … … 1965 2000 break; 1966 2001 } 2002 ODIN_FS_END 1967 2003 #endif 1968 2004 } … … 1972 2008 if( (dwFlags &DDBLT_KEYSRC) || (dwFlags & DDBLT_KEYSRCOVERRIDE) ) 1973 2009 { 2010 WriteLog("Transparent src blit not done yet for primary!!"); 1974 2011 } 1975 2012 else … … 2018 2055 #else 2019 2056 // Solid Blit 2057 ODIN_FS_BEGIN 2020 2058 while(1) 2021 2059 { … … 2026 2064 break; 2027 2065 } 2066 ODIN_FS_END 2028 2067 #endif 2029 2068 } 2030 2069 else 2031 2070 { 2071 WriteLog("Transblt not done yet"); 2032 2072 if(dwFlags & DDBLT_KEYSRC) 2033 2073 { … … 2088 2128 #else 2089 2129 // Solid Blit 2130 ODIN_FS_BEGIN 2090 2131 while(1) 2091 2132 { … … 2096 2137 break; 2097 2138 } 2139 ODIN_FS_END 2098 2140 #endif 2099 2141 } … … 2502 2544 { 2503 2545 #ifdef DEBUG 2504 WriteLog("SurfBltFast \n");2546 WriteLog("SurfBltFast NIY\n"); 2505 2547 #endif 2506 2548 … … 2534 2576 return DDERR_INVALIDPARAMS; 2535 2577 } 2578 2579 ODIN_FS_BEGIN 2536 2580 2537 2581 if (NULL!=lpSrcRect) … … 2835 2879 dest->lpVtbl->ChangeUniquenessValue(dest); 2836 2880 2881 ODIN_FS_END 2882 2837 2883 return(DD_OK); 2838 2884 } … … 2954 3000 } 2955 3001 3002 ODIN_FS_BEGIN 3003 2956 3004 if ( (!Found) && (AttachedSurface->DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_MIPMAP ) ) 2957 3005 { … … 2992 3040 } 2993 3041 3042 ODIN_FS_END 3043 2994 3044 return(Found?DD_OK:DDERR_SURFACENOTATTACHED); 2995 3045 } … … 3012 3062 OS2IDirectDrawSurface *EnumSurface; 3013 3063 DDSURFACEDESC2 EnumDesc; 3014 int i ;3064 int i,count; 3015 3065 HRESULT rc; 3016 3066 … … 3023 3073 rc = DDENUMRET_OK; 3024 3074 3075 3025 3076 if(me->BackBuffer != NULL) 3026 3077 { 3027 memcpy(&EnumDesc,&(me->DDSurfaceDesc),sizeof(DDSURFACEDESC2)); 3078 ODIN_FS_BEGIN 3079 memcpy(&EnumDesc,&(me->DDSurfaceDesc),sizeof(DDSURFACEDESC2)); 3080 ODIN_FS_END 3028 3081 rc = lpCallBack((LPDIRECTDRAWSURFACE4)me->BackBuffer,&EnumDesc,lpContext); 3029 3082 } 3030 3083 3031 if(DPA_GetPtrCount(me->DPA_SurfaceMipMaps)>0) 3084 ODIN_FS_BEGIN 3085 count = DPA_GetPtrCount(me->DPA_SurfaceMipMaps); 3086 ODIN_FS_END 3087 3088 if(count>0) 3032 3089 { 3033 3090 i=0; 3034 while( (DDENUMRET_OK == rc) && i<DPA_GetPtrCount(me->DPA_SurfaceMipMaps) ) 3035 { 3036 EnumSurface = (OS2IDirectDrawSurface*) DPA_FastGetPtr(me->DPA_SurfaceMipMaps,i); 3037 memcpy(&EnumDesc,&(EnumSurface->DDSurfaceDesc),sizeof(DDSURFACEDESC2)); 3091 while( (DDENUMRET_OK == rc) && i<count ) 3092 { 3093 ODIN_FS_BEGIN 3094 EnumSurface = (OS2IDirectDrawSurface*) DPA_FastGetPtr(me->DPA_SurfaceMipMaps,i); 3095 memcpy( &EnumDesc, 3096 &(EnumSurface->DDSurfaceDesc), 3097 sizeof(DDSURFACEDESC2)); 3098 ODIN_FS_END 3099 // Calling back into WIN32 app so we had to reset FS 3038 3100 rc = lpCallBack((LPDIRECTDRAWSURFACE4)EnumSurface,&EnumDesc,lpContext); 3039 3101 i++; … … 3041 3103 } 3042 3104 3043 if(DPA_GetPtrCount(me->DPA_SurfaceAttached)>0) 3105 ODIN_FS_BEGIN 3106 count = DPA_GetPtrCount(me->DPA_SurfaceAttached); 3107 ODIN_FS_END 3108 3109 if(count>0) 3044 3110 { 3045 3111 i=0; 3046 while( (DDENUMRET_OK == rc) && i<DPA_GetPtrCount(me->DPA_SurfaceAttached) ) 3047 { 3048 EnumSurface = (OS2IDirectDrawSurface*) DPA_FastGetPtr(me->DPA_SurfaceAttached,i); 3049 memcpy(&EnumDesc,&(EnumSurface->DDSurfaceDesc),sizeof(DDSURFACEDESC2)); 3112 while( (DDENUMRET_OK == rc) && i<count ) 3113 { 3114 ODIN_FS_BEGIN 3115 EnumSurface = (OS2IDirectDrawSurface*) DPA_FastGetPtr(me->DPA_SurfaceAttached,i); 3116 memcpy( &EnumDesc, 3117 &(EnumSurface->DDSurfaceDesc), 3118 sizeof(DDSURFACEDESC2)); 3119 ODIN_FS_END 3050 3120 rc = lpCallBack((LPDIRECTDRAWSURFACE4)EnumSurface,&EnumDesc,lpContext); 3051 3121 i++; … … 3220 3290 OS2IDirectDrawSurface *EnumSurface = NULL; 3221 3291 OS2IDirectDrawSurface *AttachedSurface = NULL; 3292 HRESULT rc; 3222 3293 int i; 3223 3294 … … 3234 3305 } 3235 3306 3236 if( (me->BackBuffer!=NULL) && (me->BackBuffer->DDSurfaceDesc.ddsCaps.dwCaps & lpDDCaps->dwCaps) ) 3307 ODIN_FS_BEGIN 3308 3309 rc = DD_OK; 3310 3311 if( (me->BackBuffer!=NULL) && 3312 (me->BackBuffer->DDSurfaceDesc.ddsCaps.dwCaps & lpDDCaps->dwCaps) ) 3237 3313 { 3238 3314 WriteLog("Return Backbuffer\n"); … … 3251 3327 AttachedSurface = EnumSurface; 3252 3328 else 3253 r eturn(DDERR_NOTFOUND); // Not sure if this is the right return value,3329 rc = DDERR_NOTFOUND; // Not sure if this is the right return value, 3254 3330 // but function must fail if more then one surface fits 3255 3331 … … 3270 3346 AttachedSurface = EnumSurface; 3271 3347 else 3272 r eturn(DDERR_NOTFOUND); // Not sure if this is the right return value,3348 rc = DDERR_NOTFOUND; // Not sure if this is the right return value, 3273 3349 // but function must fail if more then one surface fits 3274 3350 … … 3278 3354 } 3279 3355 3280 if(NULL!=AttachedSurface) 3356 if( (DD_OK==rc) && 3357 (NULL!=AttachedSurface) ) 3281 3358 { 3282 3359 *lpDDSurf = (IDirectDrawSurface4*)AttachedSurface; 3283 3360 // not sure but as we returned an reference rains usage count 3284 3361 AttachedSurface->lpVtbl->AddRef(AttachedSurface); 3285 return(DD_OK);3286 3362 } 3287 3363 else 3364 { 3288 3365 *lpDDSurf = NULL; 3289 3290 return(DDERR_NOTFOUND); 3366 rc = DDERR_NOTFOUND; 3367 } 3368 3369 ODIN_FS_END 3370 3371 return rc; 3291 3372 } 3292 3373 //****************************************************************************** … … 3329 3410 return(DDERR_INVALIDPARAMS); 3330 3411 3331 memcpy(lpDDCaps, &(me->DDSurfaceDesc.ddsCaps), sizeof(DDSCAPS2) ); 3412 ODIN_FS_BEGIN 3413 memcpy(lpDDCaps, &(me->DDSurfaceDesc.ddsCaps), sizeof(DDSCAPS2) ); 3414 ODIN_FS_END 3332 3415 3333 3416 return(DD_OK); … … 3372 3455 if(DDCKEY_SRCBLT & dwFlags) 3373 3456 { 3374 memcpy(lpDDColKey,&(me->DDSurfaceDesc.ddckCKSrcBlt),sizeof(DDCOLORKEY) ); 3457 ODIN_FS_BEGIN 3458 memcpy(lpDDColKey,&(me->DDSurfaceDesc.ddckCKSrcBlt),sizeof(DDCOLORKEY) ); 3459 ODIN_FS_END 3375 3460 } 3376 3461 else … … 3388 3473 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; 3389 3474 DDSURFACEDESC2 LockedSurfaceDesc; 3390 3475 HRESULT rc; 3391 3476 struct 3392 3477 { … … 3409 3494 } 3410 3495 3496 ODIN_FS_BEGIN 3497 3498 rc = DD_OK; 3499 3411 3500 if(me->hdcImage == NULL) 3412 3501 { … … 3419 3508 #endif 3420 3509 me->Vtbl.Unlock(me,NULL); 3421 return(DDERR_GENERIC); 3422 } 3423 } 3424 3425 if(me->hbmImage == NULL) 3510 rc = DDERR_GENERIC; 3511 } 3512 } 3513 3514 if( (DD_OK==rc) && 3515 (me->hbmImage == NULL) ) 3426 3516 { 3427 3517 memset(&BitmapInfo, 0, sizeof(BitmapInfo)); … … 3475 3565 me->hdcImage = NULL; 3476 3566 me->Vtbl.Unlock(me,NULL); 3477 r eturn(DDERR_GENERIC);3567 rc = DDERR_GENERIC; 3478 3568 } 3479 3569 } 3480 3570 else 3481 3571 { 3482 if(me->dwLastDCUnique != me->dwUniqueValue) 3572 if( (DD_OK==rc) && 3573 (me->dwLastDCUnique != me->dwUniqueValue) ) 3483 3574 { 3484 3575 #ifdef DEBUG … … 3528 3619 } 3529 3620 3530 // Allways selct the bitmap into the DC! No matter if the old or a new one 3531 3532 if((me->hgdiOld = SelectObject(me->hdcImage, me->hbmImage)) == NULL) 3533 { 3534 #ifdef DEBUG 3535 WriteLog("Can't select bitmap into dc!\n"); 3536 #endif 3537 DeleteDC(me->hdcImage); 3538 me->hdcImage = NULL; 3539 DeleteObject(me->hbmImage); 3540 me->hbmImage = NULL; 3541 me->Vtbl.Unlock(me,NULL); 3542 return(DDERR_GENERIC); 3543 } 3544 3545 *hdc = me->hdcImage; 3546 3547 return(DD_OK); 3621 // Allways select the bitmap into the DC! No matter if the old or a new one 3622 3623 if(DD_OK==rc) 3624 { 3625 if((me->hgdiOld = SelectObject(me->hdcImage, me->hbmImage)) == NULL) 3626 { 3627 #ifdef DEBUG 3628 WriteLog("Can't select bitmap into dc!\n"); 3629 #endif 3630 DeleteDC(me->hdcImage); 3631 me->hdcImage = NULL; 3632 DeleteObject(me->hbmImage); 3633 me->hbmImage = NULL; 3634 me->Vtbl.Unlock(me,NULL); 3635 rc = DDERR_GENERIC; 3636 } 3637 else 3638 { 3639 *hdc = me->hdcImage; 3640 } 3641 } 3642 3643 ODIN_FS_END 3644 3645 return rc; 3548 3646 } 3549 3647 //****************************************************************************** … … 3619 3717 return DDERR_INVALIDPARAMS; 3620 3718 3621 memcpy((char*)lpPixelFormat,(char*)&(me->DDSurfaceDesc.ddpfPixelFormat), sizeof(DDPIXELFORMAT)); 3719 ODIN_FS_BEGIN 3720 memcpy( (char*)lpPixelFormat, 3721 (char*)&(me->DDSurfaceDesc.ddpfPixelFormat), 3722 sizeof(DDPIXELFORMAT)); 3723 ODIN_FS_END 3724 3622 3725 3623 3726 return(DD_OK); … … 3636 3739 return(DDERR_INVALIDPARAMS); 3637 3740 3638 memcpy((char *)lpSurface, (char *)&me->DDSurfaceDesc, sizeof(DDSURFACEDESC)); 3741 ODIN_FS_BEGIN 3742 memcpy( (char *)lpSurface, 3743 (char *)&me->DDSurfaceDesc, 3744 sizeof(DDSURFACEDESC)); 3745 ODIN_FS_END 3639 3746 3640 3747 return(DD_OK); … … 3653 3760 return(DDERR_INVALIDPARAMS); 3654 3761 3655 memcpy((char *)lpSurface, (char *)&me->DDSurfaceDesc, sizeof(DDSURFACEDESC2)); 3762 ODIN_FS_BEGIN 3763 memcpy( (char *)lpSurface, 3764 (char *)&me->DDSurfaceDesc, 3765 sizeof(DDSURFACEDESC2)); 3766 ODIN_FS_END 3656 3767 3657 3768 return(DD_OK); … … 3714 3825 SurfaceDesc4.dwSize = sizeof(DDSURFACEDESC2); 3715 3826 3716 rc = SurfLock4(This, lpRect, &SurfaceDesc4, dwFlags, hEvent); 3827 rc = SurfLock4( This, 3828 lpRect, 3829 &SurfaceDesc4, 3830 dwFlags, 3831 hEvent); 3717 3832 if (DD_OK==rc) 3718 3833 { 3719 memcpy((char*)lpSurfaceDesc,(char*)&SurfaceDesc4, sizeof(DDSURFACEDESC) ); 3834 ODIN_FS_BEGIN 3835 memcpy( (char*)lpSurfaceDesc, 3836 (char*)&SurfaceDesc4, 3837 sizeof(DDSURFACEDESC) ); 3838 ODIN_FS_END 3720 3839 } 3721 3840 … … 3735 3854 3736 3855 BOOL Found; 3737 ULONG nrScanLines , rc;3856 ULONG nrScanLines; 3738 3857 char *pBuffer; 3739 3858 DDRectangle *pIRectCurrent,*pIRectNew; 3740 3859 static int times = 0; 3860 HRESULT rc; 3741 3861 3742 3862 #ifdef DEBUG … … 3748 3868 ) 3749 3869 return DDERR_INVALIDPARAMS; 3870 3871 ODIN_FS_BEGIN 3750 3872 3751 3873 if (NULL!=lpRect) … … 3760 3882 pIRectNew->Bottom(), 3761 3883 pIRectNew->Right() ); 3884 3885 rc = DD_OK; 3762 3886 3763 3887 if(me->fLocked) … … 3799 3923 WriteLog("SurfLock4: Surface already locked\n\n"); 3800 3924 #endif 3801 return(DDERR_SURFACEBUSY); 3802 } 3803 } 3804 3805 memcpy((char *)lpSurfaceDesc, (char *)&me->DDSurfaceDesc, sizeof(DDSURFACEDESC2)); 3806 3807 if(lpRect != NULL) 3808 { 3809 lpSurfaceDesc->lpSurface = (LPVOID)((char*)me->pFrameBuffer + 3810 (lpRect->top * me->dwPitchFB) + 3811 (lpRect->left * (lpSurfaceDesc->ddpfPixelFormat.dwRGBBitCount>>3))); 3812 #ifdef DEBUG 3813 WriteLog("SurfLock4 %08X (x,y) = (%d,%d)\n\n", lpSurfaceDesc->lpSurface, lpRect->top, lpRect->left); 3814 #endif 3815 } 3816 else 3817 { 3818 #ifdef DEBUG 3819 WriteLog("SurfLock4 %08X \n\n", lpSurfaceDesc->lpSurface); 3820 #endif 3821 } 3822 // Add the rectangle to the list of locked rectangles 3823 3824 pIRectNew->SetMemPtr(lpSurfaceDesc->lpSurface); 3825 3826 DPA_InsertPtr( me->DPA_LockedRects, 3827 DPA_GetPtrCount(me->DPA_LockedRects), 3828 pIRectNew); 3829 3830 me->fLocked = TRUE; 3831 3832 return(DD_OK); 3925 rc = DDERR_SURFACEBUSY; 3926 } 3927 3928 } 3929 3930 if(DD_OK == rc) 3931 { 3932 memcpy((char *)lpSurfaceDesc, (char *)&me->DDSurfaceDesc, sizeof(DDSURFACEDESC2)); 3933 3934 if(lpRect != NULL) 3935 { 3936 lpSurfaceDesc->lpSurface = (LPVOID)((char*)me->pFrameBuffer + 3937 (lpRect->top * me->dwPitchFB) + 3938 (lpRect->left * (lpSurfaceDesc->ddpfPixelFormat.dwRGBBitCount>>3))); 3939 #ifdef DEBUG 3940 WriteLog("SurfLock4 %08X (x,y) = (%d,%d)\n\n", lpSurfaceDesc->lpSurface, lpRect->top, lpRect->left); 3941 #endif 3942 } 3943 else 3944 { 3945 #ifdef DEBUG 3946 WriteLog("SurfLock4 %08X \n\n", lpSurfaceDesc->lpSurface); 3947 #endif 3948 } 3949 // Add the rectangle to the list of locked rectangles 3950 3951 pIRectNew->SetMemPtr(lpSurfaceDesc->lpSurface); 3952 3953 DPA_InsertPtr( me->DPA_LockedRects, 3954 DPA_GetPtrCount(me->DPA_LockedRects), 3955 pIRectNew); 3956 3957 me->fLocked = TRUE; 3958 } 3959 3960 ODIN_FS_END 3961 3962 return rc; 3833 3963 } 3834 3964 //****************************************************************************** … … 3850 3980 if(hdc != me->hdcImage) 3851 3981 return(DDERR_INVALIDOBJECT); 3982 3983 ODIN_FS_BEGIN 3852 3984 3853 3985 //unselect our bitmap … … 3897 4029 me->dwLastDCUnique = me->dwUniqueValue; // Store this to see if the surface was locked after we released the DC 3898 4030 4031 ODIN_FS_END 4032 3899 4033 return(DD_OK); 3900 4034 } … … 3951 4085 { 3952 4086 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; 3953 4087 HRESULT rc; 3954 4088 #ifdef DEBUG 3955 4089 WriteLog("SurfSetColorKey\n"); … … 3963 4097 return(DDERR_UNSUPPORTED); 3964 4098 4099 ODIN_FS_BEGIN 4100 3965 4101 if(DDCKEY_SRCBLT & dwFlags) 3966 4102 { … … 3978 4114 me->DDSurfaceDesc.dwFlags &= ~DDCKEY_SRCBLT; 3979 4115 } 4116 rc = DD_OK; 3980 4117 } 3981 4118 else 3982 return (DDERR_INVALIDPARAMS); // some other flags where set => error 3983 3984 return(DD_OK); 4119 rc = DDERR_INVALIDPARAMS; // some other flags where set => error 4120 4121 ODIN_FS_END 4122 4123 return rc; 3985 4124 } 3986 4125 //****************************************************************************** … … 4078 4217 BOOL Found = FALSE; 4079 4218 OS2RECTL CCRect; 4219 HRESULT rc; 4080 4220 4081 4221 #ifdef DEBUG … … 4090 4230 return(DDERR_NOTLOCKED); 4091 4231 } 4232 4233 ODIN_FS_BEGIN 4092 4234 4093 4235 #ifdef DEBUG … … 4172 4314 WriteLog("Rectangle not locked, wrong Rect!\n\n"); 4173 4315 #endif 4174 return(DDERR_INVALIDRECT); 4175 } 4176 4177 #ifdef DEBUG 4178 WriteLog("Remove Rect %d from Seq.\n",i); 4179 #endif 4180 4181 DPA_DeletePtr(me->DPA_LockedRects,i); 4182 4183 #ifdef DEBUG 4184 WriteLog("Test if locked Rects main\n"); 4185 #endif 4186 4187 if(0==DPA_GetPtrCount(me->DPA_LockedRects)) // Do we have unlocked last rectangle 4316 rc = DDERR_INVALIDRECT; 4317 } 4318 else 4188 4319 { 4189 4320 #ifdef DEBUG 4190 WriteLog(" No Locked Rects left for surface\n");4321 WriteLog("Remove Rect %d from Seq.\n",i); 4191 4322 #endif 4192 me->fLocked = FALSE; 4193 } 4194 #ifdef DEBUG 4195 else 4196 WriteLog( "%d Rects in Seq\n", 4197 DPA_GetPtrCount(me->DPA_LockedRects)); 4198 #endif 4199 4200 if(me->pFrameBuffer != me->pDiveBuffer) 4201 { 4323 4324 DPA_DeletePtr(me->DPA_LockedRects,i); 4325 4202 4326 #ifdef DEBUG 4203 WriteLog( "ColorConversion Needed %08X != %08X\n", 4204 me->pFrameBuffer, 4205 me->pDiveBuffer); 4327 WriteLog("Test if locked Rects main\n"); 4206 4328 #endif 4207 if(NULL!=lpSurfaceData) 4208 {4209 CCRect.yTop = pIRectEnum->Top();4210 CCRect.xLeft = pIRectEnum->Left();4211 CCRect.xRight = pIRectEnum->Right();4212 CCRect.yBottom = pIRectEnum->Bottom();4213 4214 me->ColorConversion( (LPRECT)&CCRect);4215 }4329 4330 if(0==DPA_GetPtrCount(me->DPA_LockedRects)) // Do we have unlocked last rectangle 4331 { 4332 #ifdef DEBUG 4333 WriteLog("No Locked Rects left for surface\n"); 4334 #endif 4335 me->fLocked = FALSE; 4336 } 4337 #ifdef DEBUG 4216 4338 else 4217 { 4218 me->ColorConversion(NULL); 4219 } 4220 } 4221 #ifdef DEBUG 4222 else 4223 WriteLog( "No ColorConversion Needed"); 4224 #endif 4225 4226 // delete tne DDRectobject of the found rectangle 4227 delete pIRectEnum; 4228 4229 me->lpVtbl->ChangeUniquenessValue(me); 4230 4231 WriteLog("Unlock OK\n\n"); 4232 4233 return(DD_OK); 4339 WriteLog( "%d Rects in Seq\n", 4340 DPA_GetPtrCount(me->DPA_LockedRects)); 4341 #endif 4342 4343 if(me->pFrameBuffer != me->pDiveBuffer) 4344 { 4345 #ifdef DEBUG 4346 WriteLog( "ColorConversion Needed %08X != %08X\n", 4347 me->pFrameBuffer, 4348 me->pDiveBuffer); 4349 #endif 4350 if(NULL!=lpSurfaceData) 4351 { 4352 CCRect.yTop = pIRectEnum->Top(); 4353 CCRect.xLeft = pIRectEnum->Left(); 4354 CCRect.xRight = pIRectEnum->Right(); 4355 CCRect.yBottom = pIRectEnum->Bottom(); 4356 4357 me->ColorConversion( (LPRECT)&CCRect); 4358 } 4359 else 4360 { 4361 me->ColorConversion(NULL); 4362 } 4363 } 4364 #ifdef DEBUG 4365 else 4366 WriteLog( "No ColorConversion Needed"); 4367 #endif 4368 4369 // delete tne DDRectobject of the found rectangle 4370 delete pIRectEnum; 4371 4372 me->lpVtbl->ChangeUniquenessValue(me); 4373 4374 WriteLog("Unlock OK\n\n"); 4375 4376 rc = DD_OK; 4377 } 4378 4379 ODIN_FS_END 4380 4381 return rc; 4234 4382 } 4235 4383 //****************************************************************************** … … 4249 4397 DDRectangle *pIRectUnlock, *pIRectEnum; 4250 4398 BOOL Found = FALSE; 4399 HRESULT rc; 4251 4400 4252 4401 #ifdef DEBUG … … 4261 4410 return(DDERR_NOTLOCKED); 4262 4411 } 4412 4413 ODIN_FS_BEGIN 4263 4414 4264 4415 if(NULL!=lpSurfaceRect) … … 4323 4474 } 4324 4475 else 4325 return SurfUnlock(This, (LPVOID)lpSurfaceRect); 4326 } 4327 4328 #ifdef DEBUG 4329 WriteLog("Remove Rect from Seq.\n"); 4330 #endif 4331 4332 DPA_DeletePtr(me->DPA_LockedRects,i); 4333 4334 if(0==DPA_GetPtrCount(me->DPA_LockedRects)) // Do we have unlocked last rectangle 4476 rc = SurfUnlock(This, (LPVOID)lpSurfaceRect); 4477 } 4478 else 4335 4479 { 4336 4480 #ifdef DEBUG 4337 WriteLog(" No Locked Rects left for surface\n");4481 WriteLog("Remove Rect from Seq.\n"); 4338 4482 #endif 4339 me->fLocked = FALSE; 4340 } 4341 4342 if(me->pFrameBuffer != me->pDiveBuffer) 4343 { 4344 #ifdef DEBUG 4345 WriteLog( "ColorConversion Needed %08X != %08X\n", 4346 me->pFrameBuffer, 4347 me->pDiveBuffer); 4348 #endif 4349 me->ColorConversion(lpSurfaceRect); 4350 } 4351 4352 me->lpVtbl->ChangeUniquenessValue(me); 4353 4354 WriteLog("Unlock OK\n\n"); 4355 4356 return(DD_OK); 4483 4484 DPA_DeletePtr(me->DPA_LockedRects,i); 4485 4486 if(0==DPA_GetPtrCount(me->DPA_LockedRects)) // Do we have unlocked last rectangle 4487 { 4488 #ifdef DEBUG 4489 WriteLog("No Locked Rects left for surface\n"); 4490 #endif 4491 me->fLocked = FALSE; 4492 } 4493 4494 if(me->pFrameBuffer != me->pDiveBuffer) 4495 { 4496 #ifdef DEBUG 4497 WriteLog( "ColorConversion Needed %08X != %08X\n", 4498 me->pFrameBuffer, 4499 me->pDiveBuffer); 4500 #endif 4501 me->ColorConversion(lpSurfaceRect); 4502 } 4503 4504 me->lpVtbl->ChangeUniquenessValue(me); 4505 4506 WriteLog("Unlock OK\n\n"); 4507 rc = DD_OK; 4508 } 4509 4510 ODIN_FS_END 4511 4512 return rc; 4357 4513 } 4358 4514 //****************************************************************************** … … 4455 4611 return DDERR_INVALIDSURFACETYPE; // only work for system alloced surfaces 4456 4612 4613 ODIN_FS_BEGIN 4614 4457 4615 if (!me->Updated) 4458 4616 { … … 4465 4623 memcpy((char *)&(me->DDSurfaceDesc), (char *)lpSurfDesc, sizeof(DDSURFACEDESC)); 4466 4624 4625 ODIN_FS_END 4467 4626 4468 4627 return DD_OK; … … 4487 4646 return DDERR_INVALIDSURFACETYPE; // only work for system alloced surfaces 4488 4647 4648 ODIN_FS_BEGIN 4649 4489 4650 if (!me->Updated) 4490 4651 { … … 4496 4657 me->lpVtbl->ChangeUniquenessValue(me); 4497 4658 memcpy((char *)&(me->DDSurfaceDesc), (char *)lpSurfDesc, sizeof(DDSURFACEDESC2)); 4659 4660 ODIN_FS_END 4498 4661 4499 4662 return DD_OK; … … 4511 4674 void *pBuffer; 4512 4675 BOOL bFound = FALSE; 4676 HRESULT rc; 4513 4677 4514 4678 #ifdef DEBUG … … 4522 4686 (dwFlags & ~(DDSPD_IUNKNOWNPOINTER|DDSPD_VOLATILE))) 4523 4687 return(DDERR_INVALIDPARAMS); 4688 4689 ODIN_FS_BEGIN 4524 4690 4525 4691 // first check if the refGUID is stored as then the content will be updated … … 4567 4733 { 4568 4734 delete pSData; 4569 r eturn (DDERR_OUTOFMEMORY);4735 rc = DDERR_OUTOFMEMORY; 4570 4736 } 4571 4737 } … … 4600 4766 } 4601 4767 else 4602 r eturn(DDERR_OUTOFMEMORY);4768 rc = DDERR_OUTOFMEMORY; 4603 4769 } 4604 4770 } … … 4631 4797 } 4632 4798 else 4633 r eturn(DDERR_OUTOFMEMORY);4799 rc = DDERR_OUTOFMEMORY; 4634 4800 } 4635 4801 } … … 4662 4828 pSData->dwFlags = dwFlags; 4663 4829 pSData->isValid = TRUE; 4830 4831 if( DPA_InsertPtr( me->DPA_SurfacePrivateData, 4832 DPA_GetPtrCount(me->DPA_SurfacePrivateData), 4833 pSData) <0) 4834 { 4835 delete(pSData); 4836 rc = DDERR_OUTOFMEMORY; 4837 } 4664 4838 } 4665 4839 else 4666 4840 { 4667 delete pSData;4668 r eturn (DDERR_OUTOFMEMORY);4841 delete(pSData); 4842 rc = DDERR_OUTOFMEMORY; 4669 4843 } 4670 4844 } 4671 4845 4672 if( DPA_InsertPtr( me->DPA_SurfacePrivateData,4673 DPA_GetPtrCount(me->DPA_SurfacePrivateData),4674 pSData) <0)4675 {4676 delete pSData;4677 return (DDERR_OUTOFMEMORY);4678 }4679 4680 4846 } 4681 4847 else 4682 return (DDERR_OUTOFMEMORY); 4683 } 4684 return(DD_OK); 4848 rc = DDERR_OUTOFMEMORY; 4849 } 4850 4851 ODIN_FS_END 4852 4853 return rc; 4685 4854 } 4686 4855 //****************************************************************************** 4687 4856 //****************************************************************************** 4688 4857 HRESULT __stdcall SurfGetPrivateData(THIS This, REFGUID refGUID, LPVOID lpData, LPDWORD lpDataSize) 4858 { 4859 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; 4860 int i; 4861 PSURFPRIVATEDATA pSData; 4862 HRESULT rc; 4863 BOOL bFound = FALSE; 4864 4865 #ifdef DEBUG 4866 WriteLog("SurfGetPrivateData\n"); 4867 #endif 4868 4869 if(NULL==me) 4870 return(DDERR_INVALIDOBJECT); 4871 4872 if((NULL==lpData)||(NULL==lpDataSize)) 4873 return(DDERR_INVALIDPARAMS); 4874 4875 ODIN_FS_BEGIN 4876 4877 if(DPA_GetPtrCount(me->DPA_SurfacePrivateData)>0) 4878 { 4879 i=0; 4880 while(i<DPA_GetPtrCount(me->DPA_SurfacePrivateData) && !bFound) 4881 { 4882 pSData = (PSURFPRIVATEDATA) DPA_FastGetPtr(me->DPA_SurfacePrivateData,i); 4883 4884 if (IsEqualGUID(pSData->guidTag,refGUID)) 4885 bFound = TRUE; 4886 4887 i++; 4888 } 4889 } 4890 4891 if(bFound) 4892 { 4893 if(!pSData->isValid) 4894 { 4895 rc =DDERR_EXPIRED; 4896 } 4897 else 4898 { 4899 if(pSData->dwSize > *lpDataSize) 4900 { 4901 // Buffer to small return needed Size 4902 *lpDataSize = pSData->dwSize; 4903 rc = DDERR_MOREDATA; 4904 } 4905 else 4906 { 4907 memcpy(lpData,pSData->pData,pSData->dwSize); 4908 rc = DD_OK; 4909 } 4910 } 4911 } 4912 else 4913 rc = DDERR_NOTFOUND; 4914 4915 ODIN_FS_END 4916 4917 return rc; 4918 } 4919 //****************************************************************************** 4920 //****************************************************************************** 4921 HRESULT __stdcall SurfFreePrivateData(THIS This, REFGUID refGUID) 4689 4922 { 4690 4923 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; … … 4694 4927 4695 4928 #ifdef DEBUG 4696 WriteLog("Surf GetPrivateData\n");4929 WriteLog("SurfFreePrivateData\n"); 4697 4930 #endif 4698 4931 … … 4700 4933 return(DDERR_INVALIDOBJECT); 4701 4934 4702 if((NULL==lpData)||(NULL==lpDataSize)) 4703 return(DDERR_INVALIDPARAMS); 4704 4705 if(DPA_GetPtrCount(me->DPA_SurfacePrivateData)>0) 4706 { 4707 i=0; 4708 while(i<DPA_GetPtrCount(me->DPA_SurfacePrivateData) && !bFound) 4709 { 4710 pSData = (PSURFPRIVATEDATA) DPA_FastGetPtr(me->DPA_SurfacePrivateData,i); 4711 4712 if (IsEqualGUID(pSData->guidTag,refGUID)) 4713 bFound = TRUE; 4714 4715 i++; 4716 } 4717 } 4718 4719 if(bFound) 4720 { 4721 if(!pSData->isValid) 4722 return(DDERR_EXPIRED); 4723 4724 if(pSData->dwSize > *lpDataSize) 4725 { 4726 // Buffer to small return needed Size 4727 *lpDataSize = pSData->dwSize; 4728 return(DDERR_MOREDATA); 4729 } 4730 4731 memcpy(lpData,pSData->pData,pSData->dwSize); 4732 return(DD_OK); 4733 } 4734 4735 return (DDERR_NOTFOUND); 4736 } 4737 //****************************************************************************** 4738 //****************************************************************************** 4739 HRESULT __stdcall SurfFreePrivateData(THIS This, REFGUID refGUID) 4740 { 4741 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; 4742 int i; 4743 PSURFPRIVATEDATA pSData; 4744 BOOL bFound = FALSE; 4745 4746 #ifdef DEBUG 4747 WriteLog("SurfFreePrivateData\n"); 4748 #endif 4749 4750 if(NULL==me) 4751 return(DDERR_INVALIDOBJECT); 4935 ODIN_FS_BEGIN 4752 4936 4753 4937 if(DPA_GetPtrCount(me->DPA_SurfacePrivateData)>0) … … 4782 4966 } 4783 4967 } 4968 4969 ODIN_FS_END 4970 4784 4971 return (bFound?DD_OK:DDERR_NOTFOUND); 4785 4972 } … … 4806 4993 PSURFPRIVATEDATA pSData; 4807 4994 4995 ODIN_FS_BEGIN 4996 4808 4997 #ifdef DEBUG 4809 4998 WriteLog("SurfChangeUniquenessValue\n"); … … 4822 5011 if (pSData->dwFlags & DDSPD_IUNKNOWNPOINTER) 4823 5012 { 4824 // pointer to com stored so call lits release5013 // pointer to com stored so call its release 4825 5014 ((OS2IDirectDrawSurface *) pSData->pData)->lpVtbl->Release(pSData->pData); 4826 5015 } … … 4837 5026 } 4838 5027 5028 ODIN_FS_END 5029 4839 5030 return (DD_OK); 4840 5031 } … … 4848 5039 void __cdecl MoveRects(char* pBuffer, LPRECT lpDestRect, LPRECT lpSrcRect, int bpp, LONG lPitch) 4849 5040 { 5041 4850 5042 char *pBltPos, *pSrcPos; 4851 5043 int BlitWidth,BlitHeight; 4852 5044 static char Scanline[6400]; // sufficient for 1600 at 32 bit 5045 5046 ODIN_FS_BEGIN 5047 4853 5048 // Bridge, we may got a problem ;) 4854 5049 // Check for Overlapping Rects … … 4912 5107 } 4913 5108 5109 ODIN_FS_END 4914 5110 } 4915 5111 -
trunk/src/ddraw/OS2UTIL.CPP
r97 r503 1 /* $Id: OS2UTIL.CPP,v 1. 3 1999-06-10 17:10:57 phallerExp $ */1 /* $Id: OS2UTIL.CPP,v 1.4 1999-08-16 00:40:48 hugh Exp $ */ 2 2 3 3 /* … … 43 43 void OS2MaximizeWindow(HWND hwndClient) 44 44 { 45 ODIN_FS_BEGIN 45 46 WinSetWindowPos(hwndClient, HWND_TOP, 0, 0, 0, 0, SWP_MAXIMIZE); 47 ODIN_FS_END 46 48 } 47 49 -
trunk/src/ddraw/ddraw.CPP
r210 r503 2 2 3 3 #include <builtin.h> 4 #include <odincrt.h> 4 5 #define INITGUID 5 6 #include "os2ddraw.h" … … 18 19 HRESULT rc; 19 20 21 ODIN_FS_BEGIN 22 20 23 WriteLog("DirectDrawCreate %X %X %X\n", lpGUID, lplpDD, pUnkOuter); 24 21 25 newdraw = new OS2IDirectDraw(lpGUID); 22 26 23 27 if(newdraw == NULL) 24 return(DDERR_NODIRECTDRAWHW);25 26 // newdraw->Vtbl.AddRef((IDirectDraw *)newdraw);27 rc = newdraw->GetLastError();28 if(rc != DD_OK)29 28 { 30 *lplpDD = NULL; 31 delete newdraw; 29 rc = DDERR_NODIRECTDRAWHW; 32 30 } 33 31 else 34 *lplpDD = (LPDIRECTDRAW)newdraw; 32 { 33 // newdraw->Vtbl.AddRef((IDirectDraw *)newdraw); 34 rc = newdraw->GetLastError(); 35 if(rc != DD_OK) 36 { 37 *lplpDD = NULL; 38 39 delete newdraw; 40 } 41 else 42 *lplpDD = (LPDIRECTDRAW)newdraw; 43 } 44 ODIN_FS_END 35 45 36 46 return(rc); … … 45 55 //call it twice for the DirectDraw & Direct3D classes 46 56 if(lpCallback(NULL, "DIVE DirectDraw for OS/2", 47 "DirectDraw/2 v0. 1", lpContext) == DDENUMRET_CANCEL)57 "DirectDraw/2 v0.2", lpContext) == DDENUMRET_CANCEL) 48 58 { 49 59 WriteLog("Cancel Callback\n"); … … 54 64 WriteLog("Callback for 3Dfx Voodoo"); 55 65 if(lpCallback((GUID *)&IID_IDirect3D, "3Dfx Voodoo Direct3D/2", 56 "Direct3D/2 v0. 1", lpContext) == DDENUMRET_CANCEL)66 "Direct3D/2 v0.2", lpContext) == DDENUMRET_CANCEL) 57 67 { 58 68 WriteLog("Cancel Callback\n"); … … 64 74 return(DD_OK); 65 75 } 76 66 77 //****************************************************************************** 67 78 typedef struct -
trunk/src/ddraw/makefile
r450 r503 13 13 ASFLAGS = -Sc -Sv:ALP 14 14 15 CFLAGS = $(CFLAGS) -I$(PDWIN32_INCLUDE);16 CXXFLAGS = $(CXXFLAGS) -I$(PDWIN32_INCLUDE);15 CFLAGS = $(CFLAGS) /Gn+-I$(PDWIN32_INCLUDE); 16 CXXFLAGS = $(CXXFLAGS) /Gn+ -I$(PDWIN32_INCLUDE); 17 17 18 18 TARGET = ddraw … … 20 20 OBJS = ddraw.obj os2ddraw.obj os2clipper.obj os2d3d.obj iccio1.obj asmutil.obj\ 21 21 os2surface.obj os2palette.obj os2palset.obj misc.obj rectangle.obj initterm.obj 22 22 23 23 24 LIBS = ..\..\lib\pmwinx.lib mmpm2.lib ..\..\lib\comctl32.lib $(PDWIN32_LIB)\advapi32.lib $(PDWIN32_LIB)\kernel32.lib $(PDWIN32_LIB)\gdi32.lib $(PDWIN32_LIB)\comctl32.lib $(PDWIN32_LIB)/odincrt.lib OS2386.LIB -
trunk/src/ddraw/os2DDWindow.cpp
r210 r503 1 1 #define INCL_WIN 2 2 #include <os2wrap.h> 3 #include <odincrt.h> 4 #include <odinwrap.h> 3 5 #include "os2DDWindow.h" 4 6 … … 8 10 extern VOID SwitchDisplay(HWND hwnd); 9 11 10 BOOL OS2DdSubClassWindow(HWNDhwndClient)12 ODINFUNCTION1(BOOL , OS2DdSubClassWindow ,HWND, hwndClient) 11 13 { 12 14 HWND hwndParent; … … 35 37 { 36 38 USHORT usFlags; 39 40 ODIN_FS_BEGIN 41 37 42 switch(ulMsg) 38 43 { … … 59 64 break; 60 65 } 66 67 ODIN_FS_END 68 61 69 return pfnOrgClientProc(hwnd, ulMsg, mp1,mp2); 62 70 }
Note:
See TracChangeset
for help on using the changeset viewer.