Changeset 51634 in vbox for trunk/src/VBox/Frontends/VBoxSDL
- Timestamp:
- Jun 17, 2014 2:06:13 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxSDL
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp
r51627 r51634 18 18 19 19 #include <VBox/com/com.h> 20 #include <VBox/com/array.h> 20 21 #include <VBox/com/string.h> 21 22 #include <VBox/com/Guid.h> … … 89 90 bool fFullscreen, bool fResizable, bool fShowSDLConfig, 90 91 bool fKeepHostRes, uint32_t u32FixedWidth, 91 uint32_t u32FixedHeight, uint32_t u32FixedBPP) 92 uint32_t u32FixedHeight, uint32_t u32FixedBPP, 93 bool fUpdateImage) 92 94 { 93 95 int rc; … … 99 101 100 102 mScreenId = uScreenId; 103 mfUpdateImage = fUpdateImage; 101 104 mScreen = NULL; 102 105 #ifdef VBOX_WITH_SDL13 … … 425 428 ComSafeArrayIn(BYTE, aImage)) 426 429 { 427 return E_NOTIMPL; 430 LogFlow(("NotifyUpdateImage: %d,%d %dx%d\n", aX, aY, aWidth, aHeight)); 431 432 com::SafeArray<BYTE> image(ComSafeArrayInArg(aImage)); 433 434 /* Copy to mSurfVRAM. */ 435 SDL_Rect srcRect; 436 SDL_Rect dstRect; 437 srcRect.x = 0; 438 srcRect.y = 0; 439 srcRect.w = (uint16_t)aWidth; 440 srcRect.h = (uint16_t)aHeight; 441 dstRect.x = (int16_t)aX; 442 dstRect.y = (int16_t)aY; 443 dstRect.w = (uint16_t)aWidth; 444 dstRect.h = (uint16_t)aHeight; 445 446 const uint32_t Rmask = 0x00FF0000, Gmask = 0x0000FF00, Bmask = 0x000000FF, Amask = 0; 447 SDL_Surface *surfSrc = SDL_CreateRGBSurfaceFrom(image.raw(), aWidth, aHeight, 32, aWidth * 4, 448 Rmask, Gmask, Bmask, Amask); 449 if (surfSrc) 450 { 451 RTCritSectEnter(&mUpdateLock); 452 if (mfUpdates) 453 SDL_BlitSurface(surfSrc, &srcRect, mSurfVRAM, &dstRect); 454 RTCritSectLeave(&mUpdateLock); 455 456 SDL_FreeSurface(surfSrc); 457 } 458 459 return NotifyUpdate(aX, aY, aWidth, aHeight); 428 460 } 429 461 … … 439 471 aScreenId, aXOrigin, aYOrigin, aWidth, aHeight)); 440 472 473 ComPtr<IDisplaySourceBitmap> pSourceBitmap; 474 if (!mfUpdateImage) 475 gpDisplay->QuerySourceBitmap(aScreenId, pSourceBitmap.asOutParam()); 476 441 477 RTCritSectEnter(&mUpdateLock); 442 478 … … 444 480 mfUpdates = false; 445 481 446 /* Save the new bitmap. */ 447 mpPendingSourceBitmap.setNull(); 448 gpDisplay->QuerySourceBitmap(aScreenId, mpPendingSourceBitmap.asOutParam()); 482 if (mfUpdateImage) 483 { 484 mGuestXRes = aWidth; 485 mGuestYRes = aHeight; 486 mPtrVRAM = NULL; 487 mBitsPerPixel = 0; 488 mBytesPerLine = 0; 489 } 490 else 491 { 492 /* Save the new bitmap. */ 493 mpPendingSourceBitmap = pSourceBitmap; 494 } 449 495 450 496 RTCritSectLeave(&mUpdateLock); … … 546 592 RTCritSectEnter(&mUpdateLock); 547 593 548 if ( mpPendingSourceBitmap.isNull())594 if (!mfUpdateImage && mpPendingSourceBitmap.isNull()) 549 595 { 550 596 /* Do nothing. Change event already processed. */ … … 603 649 604 650 resizeGuest(); 651 652 if (mfUpdateImage) 653 { 654 gpDisplay->SetFramebufferUpdateMode(aScreenId, FramebufferUpdateMode_NotifyUpdateImage); 655 gpDisplay->InvalidateAndUpdate(); 656 } 605 657 } 606 658 … … 614 666 AssertMsg(gSdlNativeThread == RTThreadNativeSelf(), 615 667 ("Wrong thread! SDL is not threadsafe!\n")); 668 669 RTCritSectEnter(&mUpdateLock); 616 670 617 671 const uint32_t Rmask = 0x00FF0000, Gmask = 0x0000FF00, Bmask = 0x000000FF, Amask = 0; … … 651 705 652 706 /* Enable screen updates. */ 653 RTCritSectEnter(&mUpdateLock);654 707 mfUpdates = true; 708 655 709 RTCritSectLeave(&mUpdateLock); 656 710 … … 896 950 AssertMsg(gSdlNativeThread == RTThreadNativeSelf(), ("Wrong thread! SDL is not threadsafe!\n")); 897 951 #endif 952 RTCritSectEnter(&mUpdateLock); 953 Log(("Updates %d, %d,%d %dx%d\n", mfUpdates, x, y, w, h)); 954 if (!mfUpdates) 955 { 956 RTCritSectLeave(&mUpdateLock); 957 return; 958 } 959 898 960 Assert(mScreen); 899 961 Assert(mSurfVRAM); 900 962 if (!mScreen || !mSurfVRAM) 901 return;902 903 RTCritSectEnter(&mUpdateLock);904 Log(("Updates %d, %d,%d %dx%d\n", mfUpdates, x, y, w, h));905 if (!mfUpdates)906 963 { 907 964 RTCritSectLeave(&mUpdateLock); 908 965 return; 909 966 } 967 910 968 /* the source and destination rectangles */ 911 969 SDL_Rect srcRect; -
trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.h
r51627 r51634 49 49 bool fFullscreen = false, bool fResizable = true, bool fShowSDLConfig = false, 50 50 bool fKeepHostRes = false, uint32_t u32FixedWidth = ~(uint32_t)0, 51 uint32_t u32FixedHeight = ~(uint32_t)0, uint32_t u32FixedBPP = ~(uint32_t)0); 51 uint32_t u32FixedHeight = ~(uint32_t)0, uint32_t u32FixedBPP = ~(uint32_t)0, 52 bool fUpdateImage = false); 52 53 virtual ~VBoxSDLFB(); 53 54 … … 141 142 /** the screen number of this framebuffer */ 142 143 uint32_t mScreenId; 144 /** use NotifyUpdateImage */ 145 bool mfUpdateImage; 143 146 /** maximum possible screen width in pixels (~0 = no restriction) */ 144 147 uint32_t mMaxScreenWidth;
Note:
See TracChangeset
for help on using the changeset viewer.