Changeset 98548 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 13, 2023 3:06:38 PM (2 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r98547 r98548 454 454 xOrigin, yOrigin, uWidth, uHeight, 455 455 uBitsPerPixel); 456 } 457 458 bool UIMachine::acquireScreenShot(ulong uScreenId, ulong uWidth, ulong uHeight, KBitmapFormat enmFormat, uchar *pBits) 459 { 460 return uisession()->acquireScreenShot(uScreenId, uWidth, uHeight, enmFormat, pBits); 456 461 } 457 462 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r98547 r98548 289 289 long &xOrigin, long &yOrigin, ulong &uWidth, ulong &uHeight, 290 290 ulong &uBitsPerPixel); 291 /** Acquires screen-shot for guest-screen with passed uScreenId. */ 292 bool acquireScreenShot(ulong uScreenId, ulong uWidth, ulong uHeight, KBitmapFormat enmFormat, uchar *pBits); 291 293 /** @} */ 292 294 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r98520 r98548 88 88 #include "CAudioAdapter.h" 89 89 #include "CAudioSettings.h" 90 #include "CDisplay.h"91 90 #include "CEmulatedUSB.h" 92 91 #include "CGraphicsAdapter.h" … … 297 296 { 298 297 return uisession()->console(); 299 }300 301 CDisplay& UIMachineLogic::display() const302 {303 return uisession()->display();304 298 } 305 299 … … 3135 3129 uMaxHeight = RT_MAX(uMaxHeight, uHeight); 3136 3130 QImage shot = QImage(uWidth, uHeight, QImage::Format_RGB32); 3137 /* For separate process: */ 3138 if (uiCommon().isSeparateProcess()) 3139 { 3140 /* Take screen-data to array first: */ 3141 const QVector<BYTE> screenData = display().TakeScreenShotToArray(uScreenIndex, shot.width(), shot.height(), KBitmapFormat_BGR0); 3142 /* And copy that data to screen-shot if it is Ok: */ 3143 if (display().isOk() && !screenData.isEmpty()) 3144 memcpy(shot.bits(), screenData.data(), shot.width() * shot.height() * 4); 3145 } 3146 /* For the same process: */ 3147 else 3148 { 3149 /* Take the screen-shot directly: */ 3150 display().TakeScreenShot(uScreenIndex, shot.bits(), shot.width(), shot.height(), KBitmapFormat_BGR0); 3151 } 3131 uimachine()->acquireScreenShot(uScreenIndex, shot.width(), shot.height(), KBitmapFormat_BGR0, shot.bits()); 3152 3132 images << shot; 3153 3133 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r98516 r98548 57 57 class CMachine; 58 58 class CConsole; 59 class CDisplay;60 59 class CGuest; 61 60 class CMouse; … … 123 122 /** Returns the session's console reference. */ 124 123 CConsole& console() const; 125 /** Returns the console's display reference. */126 CDisplay& display() const;127 124 /** Returns the console's guest reference. */ 128 125 CGuest& guest() const; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r98547 r98548 452 452 uHeight = uGuestHeight; 453 453 uBitsPerPixel = uGuestBitsPerPixel; 454 return fSuccess; 455 } 456 457 bool UISession::acquireScreenShot(ulong uScreenId, ulong uWidth, ulong uHeight, KBitmapFormat enmFormat, uchar *pBits) 458 { 459 CDisplay comDisplay = display(); 460 bool fSuccess = false; 461 /* For separate process: */ 462 if (uiCommon().isSeparateProcess()) 463 { 464 /* Take screen-data to array first: */ 465 const QVector<BYTE> screenData = comDisplay.TakeScreenShotToArray(uScreenId, uWidth, uHeight, enmFormat); 466 fSuccess = comDisplay.isOk(); 467 if (!fSuccess) 468 UINotificationMessage::cannotAcquireDisplayParameter(comDisplay); 469 else 470 { 471 /* And copy that data to screen-shot if it is Ok: */ 472 if (!screenData.isEmpty()) 473 memcpy(pBits, screenData.data(), uWidth * uHeight * 4); 474 } 475 } 476 /* For the same process: */ 477 else 478 { 479 /* Take the screen-shot directly: */ 480 comDisplay.TakeScreenShot(uScreenId, pBits, uWidth, uHeight, enmFormat); 481 fSuccess = comDisplay.isOk(); 482 if (!fSuccess) 483 UINotificationMessage::cannotAcquireDisplayParameter(comDisplay); 484 } 454 485 return fSuccess; 455 486 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r98547 r98548 307 307 long &xOrigin, long &yOrigin, ulong &uWidth, ulong &uHeight, 308 308 ulong &uBitsPerPixel); 309 /** Acquires screen-shot for guest-screen with passed uScreenId. */ 310 bool acquireScreenShot(ulong uScreenId, ulong uWidth, ulong uHeight, KBitmapFormat enmFormat, uchar *pBits); 309 311 /** @} */ 310 312
Note:
See TracChangeset
for help on using the changeset viewer.