Changeset 9566 for trunk/src/ddraw/surface.cpp
- Timestamp:
- Dec 30, 2002, 3:05:44 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/surface.cpp
r9560 r9566 1 /* $Id: surface.cpp,v 1. 3 2002-12-29 14:11:02sandervl Exp $ */1 /* $Id: surface.cpp,v 1.4 2002-12-30 14:05:43 sandervl Exp $ */ 2 2 3 3 /* … … 670 670 671 671 dwPitchFB = DDSurfaceDesc.dwWidth * (dwBpp<8?1:dwBpp/8); 672 dwPitchFB = (dwPitchFB +7) & ~7; // Align on QWords 672 //SvL: 673 //align on dword boundary; makes it easier to deal with GetDIBits/SetDIBits (they 674 //expect dword alignment) 675 dwPitchFB = (dwPitchFB + 3) & ~3; // Align on DWords 676 //// dwPitchFB = (dwPitchFB +7) & ~7; // Align on QWords 673 677 DDSurfaceDesc.lPitch = dwPitchFB; 674 678 if(dwBpp<8) … … 2129 2133 //****************************************************************************** 2130 2134 //****************************************************************************** 2135 HRESULT WIN32API SurfGetFlipStatus(THIS This, DWORD dwFlags) 2136 { 2137 dprintf(("DDRAW: SurfGetFlipStatus\n")); 2138 2139 if( (DDGFS_CANFLIP!=dwFlags) && (DDGFS_ISFLIPDONE!=dwFlags) ) 2140 return DDERR_INVALIDPARAMS; 2141 2142 return(DD_OK); 2143 } 2144 //****************************************************************************** 2145 //****************************************************************************** 2146 HRESULT WIN32API SurfGetPalette(THIS This, LPDIRECTDRAWPALETTE FAR *lplpPalette) 2147 { 2148 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; 2149 2150 dprintf(("DDRAW: SurfGetPalette\n")); 2151 2152 if(me->lpPalette) 2153 { 2154 *lplpPalette = (LPDIRECTDRAWPALETTE)me->lpPalette; 2155 return(DD_OK); 2156 } 2157 else 2158 return(DDERR_NOPALETTEATTACHED); 2159 } 2160 //****************************************************************************** 2161 //****************************************************************************** 2162 HRESULT WIN32API SurfGetPixelFormat(THIS This, LPDDPIXELFORMAT lpPixelFormat) 2163 { 2164 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; 2165 2166 dprintf(("DDRAW: SurfGetPixelFormat %x %x", This, lpPixelFormat)); 2167 2168 if(NULL==lpPixelFormat) 2169 return DDERR_INVALIDPARAMS; 2170 2171 _dump_pixelformat(&me->DDSurfaceDesc.ddpfPixelFormat); 2172 2173 memcpy( (char*)lpPixelFormat, 2174 (char*)&(me->DDSurfaceDesc.ddpfPixelFormat), 2175 sizeof(DDPIXELFORMAT)); 2176 2177 return(DD_OK); 2178 } 2179 //****************************************************************************** 2180 //****************************************************************************** 2181 HRESULT WIN32API SurfGetSurfaceDesc(THIS This, LPDDSURFACEDESC lpSurface) 2182 { 2183 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; 2184 2185 dprintf(("DDRAW: SurfGetSurfaceDesc\n")); 2186 2187 if((lpSurface == NULL)||(lpSurface->dwSize != sizeof(DDSURFACEDESC)) ) 2188 return(DDERR_INVALIDPARAMS); 2189 2190 memcpy( (char *)lpSurface, 2191 (char *)&me->DDSurfaceDesc, 2192 sizeof(DDSURFACEDESC)); 2193 2194 return(DD_OK); 2195 } 2196 //****************************************************************************** 2197 //****************************************************************************** 2198 HRESULT WIN32API SurfGetSurfaceDesc4(THIS This, LPDDSURFACEDESC2 lpSurface) 2199 { 2200 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; 2201 2202 dprintf(("DDRAW: SurfGetSurfaceDesc4\n")); 2203 2204 if((lpSurface == NULL)||(lpSurface->dwSize != sizeof(DDSURFACEDESC2)) ) 2205 return(DDERR_INVALIDPARAMS); 2206 2207 memcpy( (char *)lpSurface, 2208 (char *)&me->DDSurfaceDesc, 2209 sizeof(DDSURFACEDESC2)); 2210 2211 return(DD_OK); 2212 } 2213 //****************************************************************************** 2214 //****************************************************************************** 2215 HRESULT WIN32API SurfInitialize(THIS, LPDIRECTDRAW, LPDDSURFACEDESC) 2216 { 2217 dprintf(("DDRAW: SurfInitialize\n")); 2218 2219 return(DDERR_ALREADYINITIALIZED); // Init is done during creation see M$ Doc 2220 } 2221 //****************************************************************************** 2222 //****************************************************************************** 2223 HRESULT WIN32API SurfInitialize4(THIS, LPDIRECTDRAW, LPDDSURFACEDESC2) 2224 { 2225 dprintf(("DDRAW: SurfInitialize\n")); 2226 2227 return(DDERR_ALREADYINITIALIZED); // Init is done during creation see M$ Doc 2228 } 2229 //****************************************************************************** 2230 //****************************************************************************** 2231 HRESULT WIN32API SurfIsLost(THIS) 2232 { 2233 // We don't loose any surface ;) 2234 // But we might shoud check for primary and/or Dive Buffers as I don't know 2235 // if they are preserved if switching to a FS DOS/OS2 session 2236 // 2237 dprintf(("DDRAW: SurfIsLost\n")); 2238 2239 return(DD_OK); 2240 } 2241 //****************************************************************************** 2242 //****************************************************************************** 2243 HRESULT WIN32API SurfLock( THIS This, 2244 LPRECT lpRect, 2245 LPDDSURFACEDESC lpSurfaceDesc, 2246 DWORD dwFlags, 2247 HANDLE hEvent) 2248 { 2249 DDSURFACEDESC2 SurfaceDesc4; 2250 HRESULT rc; 2251 2252 dprintf(("DDRAW: SurfLock %d %08X %d %d\n", (int)lpRect, (int)lpSurfaceDesc, dwFlags, hEvent)); 2253 2254 if((NULL==lpSurfaceDesc)|| ((dwFlags & DDLOCK_EVENT) && NULL != hEvent)) { 2255 dprintf(("Invalid parameters")); 2256 return DDERR_INVALIDPARAMS; 2257 } 2258 2259 if(lpSurfaceDesc->dwSize != sizeof(DDSURFACEDESC) && lpSurfaceDesc->dwSize != sizeof(DDSURFACEDESC2)) { 2260 dprintf(("Invalid parameters")); 2261 return DDERR_INVALIDPARAMS; 2262 } 2263 2264 SurfaceDesc4.dwSize = sizeof(DDSURFACEDESC2); 2265 2266 rc = SurfLock4( This, 2267 lpRect, 2268 &SurfaceDesc4, 2269 dwFlags, 2270 hEvent); 2271 if (DD_OK==rc) 2272 { 2273 memcpy( (char*)lpSurfaceDesc, 2274 (char*)&SurfaceDesc4, 2275 lpSurfaceDesc->dwSize ); 2276 } 2277 2278 return(rc); 2279 } 2280 //****************************************************************************** 2281 //****************************************************************************** 2282 HRESULT WIN32API SurfLock4( THIS This, 2283 LPRECT lpRect, 2284 LPDDSURFACEDESC2 lpSurfaceDesc, 2285 DWORD dwFlags, 2286 HANDLE hEvent) 2287 { 2288 2289 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; 2290 int i; 2291 2292 BOOL Found; 2293 DDRectangle *pIRectCurrent,*pIRectNew; 2294 HRESULT rc; 2295 2296 dprintf( ("SurfLock4 %08X %08X %08X %d %d\n", 2297 me, 2298 (int)lpRect, 2299 (int)lpSurfaceDesc, 2300 dwFlags, 2301 hEvent) ); 2302 2303 if( (NULL==lpSurfaceDesc) || 2304 (NULL!=hEvent) 2305 ) 2306 { 2307 dprintf(("DDERR_INVALIDPARAMS")); 2308 return DDERR_INVALIDPARAMS; 2309 } 2310 2311 if (NULL!=lpRect) 2312 pIRectNew = new DDRectangle( lpRect->left, lpRect->top, lpRect->right, lpRect->bottom ); 2313 else 2314 pIRectNew = new DDRectangle( 0, 0, me->width, me->height); 2315 2316 // ToDo : the lockchecking should be done in a critcal seq. 2317 dprintf( ("Lock Rectangle (%d/%d) x (%d/%d)\n", 2318 pIRectNew->Left(), 2319 pIRectNew->Top(), 2320 pIRectNew->Right(), 2321 pIRectNew->Bottom())); 2322 2323 rc = DD_OK; 2324 2325 if(me->fLocked) 2326 { 2327 if (NULL==lpRect) 2328 { 2329 // If anything is locked we can't lock the complete surface 2330 dprintf(("DDRAW: Surface has locked Rectangles and we want to completely lock it\n")); 2331 Found = TRUE; 2332 } 2333 else 2334 { 2335 // If the new Rectangle intersects with any of the already locked rectangles it can't 2336 // be locked so check for this 2337 2338 dprintf(("DDRAW: Surface has locked Rectangles, check if they overlap\n")); 2339 2340 i=0; 2341 Found = FALSE; 2342 2343 while(i<DPA_GetPtrCount(me->DPA_LockedRects) && !Found) 2344 { 2345 pIRectCurrent = (DDRectangle*) DPA_FastGetPtr(me->DPA_LockedRects,i); 2346 dprintf( ("Test with Rectangle (%d/%d) x (%d/%d)\n", 2347 pIRectCurrent->Top(), 2348 pIRectCurrent->Left(), 2349 pIRectCurrent->Bottom(), 2350 pIRectCurrent->Right() )); 2351 Found = pIRectCurrent->intersects(*pIRectNew); 2352 i++; 2353 } 2354 2355 } 2356 2357 if (Found) 2358 { 2359 delete pIRectNew; 2360 dprintf(("DDRAW: SurfLock4: Surface already locked\n\n")); 2361 rc = DDERR_SURFACEBUSY; 2362 } 2363 2364 } 2365 2366 if(DD_OK == rc) 2367 { 2368 memcpy((char *)lpSurfaceDesc, (char *)&me->DDSurfaceDesc, sizeof(DDSURFACEDESC2)); 2369 2370 if(lpRect != NULL) 2371 { 2372 lpSurfaceDesc->lpSurface = (LPVOID)((char*)me->pFrameBuffer + 2373 (lpRect->top * me->dwPitchFB) + 2374 (lpRect->left * (lpSurfaceDesc->ddpfPixelFormat.dwRGBBitCount>>3))); 2375 dprintf(("DDRAW: SurfLock4 %08X (x,y) = (%d,%d)\n\n", lpSurfaceDesc->lpSurface, lpRect->top, lpRect->left)); 2376 } 2377 else 2378 { 2379 dprintf(("DDRAW: SurfLock4 %08X \n\n", lpSurfaceDesc->lpSurface)); 2380 } 2381 // Add the rectangle to the list of locked rectangles 2382 2383 pIRectNew->SetMemPtr(lpSurfaceDesc->lpSurface); 2384 2385 DPA_InsertPtr( me->DPA_LockedRects, 2386 DPA_GetPtrCount(me->DPA_LockedRects), 2387 pIRectNew); 2388 2389 #if 0 2390 if(me->diveBufNr == DIVE_BUFFER_SCREEN) 2391 { 2392 OS2RECTL rectOS2; 2393 2394 rectOS2.xLeft = pIRectNew->Left(); 2395 rectOS2.yBottom = me->DDSurfaceDesc.dwHeight - pIRectNew->Bottom(); 2396 rectOS2.xRight = pIRectNew->Right(); 2397 rectOS2.yTop = me->DDSurfaceDesc.dwHeight - pIRectNew->Top(); 2398 dprintf(("DiveAcquireFrameBuffer (%d,%d)(%d,%d)", rectOS2.xLeft, rectOS2.yBottom, rectOS2.xRight, rectOS2.yTop)); 2399 int ret = DiveAcquireFrameBuffer(me->hDive, (PRECTL)&rectOS2); 2400 if(ret) { 2401 dprintf(("ERROR: DiveAcquireFrameBuffer failed with %d", ret)); 2402 } 2403 } 2404 #endif 2405 me->fLocked = TRUE; 2406 2407 if(me->diveBufNr == DIVE_BUFFER_SCREEN) 2408 { 2409 //If fHideCursorOnLock is set, then we hide the cursor to prevent 2410 //the app from corruption the mouse cursor (color/animated pointers) 2411 if(fHideCursorOnLock) ShowCursor(FALSE); 2412 } 2413 } 2414 2415 return rc; 2416 } 2417 //****************************************************************************** 2418 //****************************************************************************** 2131 2419 HRESULT WIN32API SurfGetDC(THIS This, HDC FAR *hdc) 2132 2420 { … … 2179 2467 BitmapInfo.bmiHead.biSize = sizeof(BITMAPINFOHEADER); 2180 2468 BitmapInfo.bmiHead.biWidth = LockedSurfaceDesc.dwWidth; 2181 BitmapInfo.bmiHead.biHeight = LockedSurfaceDesc.dwHeight;2469 BitmapInfo.bmiHead.biHeight = -LockedSurfaceDesc.dwHeight; 2182 2470 BitmapInfo.bmiHead.biPlanes = 1; 2183 2471 BitmapInfo.bmiHead.biBitCount = (WORD)LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount; … … 2256 2544 BitmapInfo.bmiHead.biSize = sizeof(BITMAPINFOHEADER); 2257 2545 BitmapInfo.bmiHead.biWidth = LockedSurfaceDesc.dwWidth; 2258 BitmapInfo.bmiHead.biHeight = LockedSurfaceDesc.dwHeight;2546 BitmapInfo.bmiHead.biHeight = -LockedSurfaceDesc.dwHeight; 2259 2547 BitmapInfo.bmiHead.biPlanes = 1; 2260 2548 BitmapInfo.bmiHead.biBitCount = (WORD)LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount; … … 2317 2605 //****************************************************************************** 2318 2606 //****************************************************************************** 2319 HRESULT WIN32API SurfGetFlipStatus(THIS This, DWORD dwFlags)2320 {2321 dprintf(("DDRAW: SurfGetFlipStatus\n"));2322 2323 if( (DDGFS_CANFLIP!=dwFlags) && (DDGFS_ISFLIPDONE!=dwFlags) )2324 return DDERR_INVALIDPARAMS;2325 2326 return(DD_OK);2327 }2328 //******************************************************************************2329 //******************************************************************************2330 HRESULT WIN32API SurfGetPalette(THIS This, LPDIRECTDRAWPALETTE FAR *lplpPalette)2331 {2332 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;2333 2334 dprintf(("DDRAW: SurfGetPalette\n"));2335 2336 if(me->lpPalette)2337 {2338 *lplpPalette = (LPDIRECTDRAWPALETTE)me->lpPalette;2339 return(DD_OK);2340 }2341 else2342 return(DDERR_NOPALETTEATTACHED);2343 }2344 //******************************************************************************2345 //******************************************************************************2346 HRESULT WIN32API SurfGetPixelFormat(THIS This, LPDDPIXELFORMAT lpPixelFormat)2347 {2348 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;2349 2350 dprintf(("DDRAW: SurfGetPixelFormat %x %x", This, lpPixelFormat));2351 2352 if(NULL==lpPixelFormat)2353 return DDERR_INVALIDPARAMS;2354 2355 _dump_pixelformat(&me->DDSurfaceDesc.ddpfPixelFormat);2356 2357 memcpy( (char*)lpPixelFormat,2358 (char*)&(me->DDSurfaceDesc.ddpfPixelFormat),2359 sizeof(DDPIXELFORMAT));2360 2361 return(DD_OK);2362 }2363 //******************************************************************************2364 //******************************************************************************2365 HRESULT WIN32API SurfGetSurfaceDesc(THIS This, LPDDSURFACEDESC lpSurface)2366 {2367 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;2368 2369 dprintf(("DDRAW: SurfGetSurfaceDesc\n"));2370 2371 if((lpSurface == NULL)||(lpSurface->dwSize != sizeof(DDSURFACEDESC)) )2372 return(DDERR_INVALIDPARAMS);2373 2374 memcpy( (char *)lpSurface,2375 (char *)&me->DDSurfaceDesc,2376 sizeof(DDSURFACEDESC));2377 2378 return(DD_OK);2379 }2380 //******************************************************************************2381 //******************************************************************************2382 HRESULT WIN32API SurfGetSurfaceDesc4(THIS This, LPDDSURFACEDESC2 lpSurface)2383 {2384 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;2385 2386 dprintf(("DDRAW: SurfGetSurfaceDesc4\n"));2387 2388 if((lpSurface == NULL)||(lpSurface->dwSize != sizeof(DDSURFACEDESC2)) )2389 return(DDERR_INVALIDPARAMS);2390 2391 memcpy( (char *)lpSurface,2392 (char *)&me->DDSurfaceDesc,2393 sizeof(DDSURFACEDESC2));2394 2395 return(DD_OK);2396 }2397 //******************************************************************************2398 //******************************************************************************2399 HRESULT WIN32API SurfInitialize(THIS, LPDIRECTDRAW, LPDDSURFACEDESC)2400 {2401 dprintf(("DDRAW: SurfInitialize\n"));2402 2403 return(DDERR_ALREADYINITIALIZED); // Init is done during creation see M$ Doc2404 }2405 //******************************************************************************2406 //******************************************************************************2407 HRESULT WIN32API SurfInitialize4(THIS, LPDIRECTDRAW, LPDDSURFACEDESC2)2408 {2409 dprintf(("DDRAW: SurfInitialize\n"));2410 2411 return(DDERR_ALREADYINITIALIZED); // Init is done during creation see M$ Doc2412 }2413 //******************************************************************************2414 //******************************************************************************2415 HRESULT WIN32API SurfIsLost(THIS)2416 {2417 // We don't loose any surface ;)2418 // But we might shoud check for primary and/or Dive Buffers as I don't know2419 // if they are preserved if switching to a FS DOS/OS2 session2420 //2421 dprintf(("DDRAW: SurfIsLost\n"));2422 2423 return(DD_OK);2424 }2425 //******************************************************************************2426 //******************************************************************************2427 HRESULT WIN32API SurfLock( THIS This,2428 LPRECT lpRect,2429 LPDDSURFACEDESC lpSurfaceDesc,2430 DWORD dwFlags,2431 HANDLE hEvent)2432 {2433 DDSURFACEDESC2 SurfaceDesc4;2434 HRESULT rc;2435 2436 dprintf(("DDRAW: SurfLock %d %08X %d %d\n", (int)lpRect, (int)lpSurfaceDesc, dwFlags, hEvent));2437 2438 if((NULL==lpSurfaceDesc)|| ((dwFlags & DDLOCK_EVENT) && NULL != hEvent)) {2439 dprintf(("Invalid parameters"));2440 return DDERR_INVALIDPARAMS;2441 }2442 2443 if(lpSurfaceDesc->dwSize != sizeof(DDSURFACEDESC) && lpSurfaceDesc->dwSize != sizeof(DDSURFACEDESC2)) {2444 dprintf(("Invalid parameters"));2445 return DDERR_INVALIDPARAMS;2446 }2447 2448 SurfaceDesc4.dwSize = sizeof(DDSURFACEDESC2);2449 2450 rc = SurfLock4( This,2451 lpRect,2452 &SurfaceDesc4,2453 dwFlags,2454 hEvent);2455 if (DD_OK==rc)2456 {2457 memcpy( (char*)lpSurfaceDesc,2458 (char*)&SurfaceDesc4,2459 lpSurfaceDesc->dwSize );2460 }2461 2462 return(rc);2463 }2464 //******************************************************************************2465 //******************************************************************************2466 HRESULT WIN32API SurfLock4( THIS This,2467 LPRECT lpRect,2468 LPDDSURFACEDESC2 lpSurfaceDesc,2469 DWORD dwFlags,2470 HANDLE hEvent)2471 {2472 2473 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;2474 int i;2475 2476 BOOL Found;2477 DDRectangle *pIRectCurrent,*pIRectNew;2478 HRESULT rc;2479 2480 dprintf( ("SurfLock4 %08X %08X %08X %d %d\n",2481 me,2482 (int)lpRect,2483 (int)lpSurfaceDesc,2484 dwFlags,2485 hEvent) );2486 2487 if( (NULL==lpSurfaceDesc) ||2488 (NULL!=hEvent)2489 )2490 {2491 dprintf(("DDERR_INVALIDPARAMS"));2492 return DDERR_INVALIDPARAMS;2493 }2494 2495 if (NULL!=lpRect)2496 pIRectNew = new DDRectangle( lpRect->left, lpRect->top, lpRect->right, lpRect->bottom );2497 else2498 pIRectNew = new DDRectangle( 0, 0, me->width, me->height);2499 2500 // ToDo : the lockchecking should be done in a critcal seq.2501 dprintf( ("Lock Rectangle (%d/%d) x (%d/%d)\n",2502 pIRectNew->Left(),2503 pIRectNew->Top(),2504 pIRectNew->Right(),2505 pIRectNew->Bottom()));2506 2507 rc = DD_OK;2508 2509 if(me->fLocked)2510 {2511 if (NULL==lpRect)2512 {2513 // If anything is locked we can't lock the complete surface2514 dprintf(("DDRAW: Surface has locked Rectangles and we want to completely lock it\n"));2515 Found = TRUE;2516 }2517 else2518 {2519 // If the new Rectangle intersects with any of the already locked rectangles it can't2520 // be locked so check for this2521 2522 dprintf(("DDRAW: Surface has locked Rectangles, check if they overlap\n"));2523 2524 i=0;2525 Found = FALSE;2526 2527 while(i<DPA_GetPtrCount(me->DPA_LockedRects) && !Found)2528 {2529 pIRectCurrent = (DDRectangle*) DPA_FastGetPtr(me->DPA_LockedRects,i);2530 dprintf( ("Test with Rectangle (%d/%d) x (%d/%d)\n",2531 pIRectCurrent->Top(),2532 pIRectCurrent->Left(),2533 pIRectCurrent->Bottom(),2534 pIRectCurrent->Right() ));2535 Found = pIRectCurrent->intersects(*pIRectNew);2536 i++;2537 }2538 2539 }2540 2541 if (Found)2542 {2543 delete pIRectNew;2544 dprintf(("DDRAW: SurfLock4: Surface already locked\n\n"));2545 rc = DDERR_SURFACEBUSY;2546 }2547 2548 }2549 2550 if(DD_OK == rc)2551 {2552 memcpy((char *)lpSurfaceDesc, (char *)&me->DDSurfaceDesc, sizeof(DDSURFACEDESC2));2553 2554 if(lpRect != NULL)2555 {2556 lpSurfaceDesc->lpSurface = (LPVOID)((char*)me->pFrameBuffer +2557 (lpRect->top * me->dwPitchFB) +2558 (lpRect->left * (lpSurfaceDesc->ddpfPixelFormat.dwRGBBitCount>>3)));2559 dprintf(("DDRAW: SurfLock4 %08X (x,y) = (%d,%d)\n\n", lpSurfaceDesc->lpSurface, lpRect->top, lpRect->left));2560 }2561 else2562 {2563 dprintf(("DDRAW: SurfLock4 %08X \n\n", lpSurfaceDesc->lpSurface));2564 }2565 // Add the rectangle to the list of locked rectangles2566 2567 pIRectNew->SetMemPtr(lpSurfaceDesc->lpSurface);2568 2569 DPA_InsertPtr( me->DPA_LockedRects,2570 DPA_GetPtrCount(me->DPA_LockedRects),2571 pIRectNew);2572 2573 #if 02574 if(me->diveBufNr == DIVE_BUFFER_SCREEN)2575 {2576 OS2RECTL rectOS2;2577 2578 rectOS2.xLeft = pIRectNew->Left();2579 rectOS2.yBottom = me->DDSurfaceDesc.dwHeight - pIRectNew->Bottom();2580 rectOS2.xRight = pIRectNew->Right();2581 rectOS2.yTop = me->DDSurfaceDesc.dwHeight - pIRectNew->Top();2582 dprintf(("DiveAcquireFrameBuffer (%d,%d)(%d,%d)", rectOS2.xLeft, rectOS2.yBottom, rectOS2.xRight, rectOS2.yTop));2583 int ret = DiveAcquireFrameBuffer(me->hDive, (PRECTL)&rectOS2);2584 if(ret) {2585 dprintf(("ERROR: DiveAcquireFrameBuffer failed with %d", ret));2586 }2587 }2588 #endif2589 me->fLocked = TRUE;2590 2591 if(me->diveBufNr == DIVE_BUFFER_SCREEN)2592 {2593 //If fHideCursorOnLock is set, then we hide the cursor to prevent2594 //the app from corruption the mouse cursor (color/animated pointers)2595 if(fHideCursorOnLock) ShowCursor(FALSE);2596 }2597 }2598 2599 return rc;2600 }2601 //******************************************************************************2602 //******************************************************************************2603 2607 HRESULT WIN32API SurfReleaseDC(THIS This, HDC hdc) 2604 2608 { … … 2624 2628 BitmapInfo.bmiHead.biPlanes = 1; 2625 2629 BitmapInfo.bmiHead.biWidth = me->DDSurfaceDesc.dwWidth; /// (me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount>>3); 2626 BitmapInfo.bmiHead.biHeight = me->DDSurfaceDesc.dwHeight;2630 BitmapInfo.bmiHead.biHeight = -me->DDSurfaceDesc.dwHeight; 2627 2631 2628 2632 switch(me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount) … … 2640 2644 (PBITMAPINFO)&BitmapInfo, 2641 2645 DIB_RGB_COLORS); 2642 //BitmapInfo.bmiHead.biHeight = -BitmapInfo.bmiHead.biHeight;2646 BitmapInfo.bmiHead.biHeight = -BitmapInfo.bmiHead.biHeight; 2643 2647 dprintf( ("GetDIBits rc=%d\n Size :%d\n Width :%d\n Height :%d\n" 2644 2648 " Planes :%d\n BitCount :%d\nLastEror = %d\nPixel[0,0] = 0x%02X\n",
Note:
See TracChangeset
for help on using the changeset viewer.