Changeset 90798 in vbox
- Timestamp:
- Aug 23, 2021 3:59:23 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r90705 r90798 283 283 if ( !isFullscreenOrSeamless() 284 284 && uisession()->isGuestSupportsGraphics() 285 && ( (int) m_pFrameBuffer->width() != size.width()286 || (int) m_pFrameBuffer->height() != size.height()285 && ( (int)frameBuffer()->width() != size.width() 286 || (int)frameBuffer()->height() != size.height() 287 287 || uisession()->isScreenVisible(screenId()) != uisession()->isScreenVisibleHostDesires(screenId()))) 288 288 storeGuestSizeHint(size); … … 295 295 { 296 296 /* Do not send a hint if nothing has changed to prevent the guest being notified about its own changes: */ 297 if ((int) m_pFrameBuffer->width() != size.width() || (int)m_pFrameBuffer->height() != size.height())297 if ((int)frameBuffer()->width() != size.width() || (int)frameBuffer()->height() != size.height()) 298 298 { 299 299 LogRel(("GUI: UIMachineView::sltPerformGuestResize: Auto-pilot resizing screen %d as %dx%d\n", … … 348 348 { 349 349 /* Do not send a hint if nothing has changed to prevent the guest being notified about its own changes: */ 350 if ((int) m_pFrameBuffer->width() != size.width() || (int)m_pFrameBuffer->height() != size.height())350 if ((int)frameBuffer()->width() != size.width() || (int)frameBuffer()->height() != size.height()) 351 351 { 352 352 LogRel(("GUI: UIMachineView::sltPerformGuestResize: Sending guest size-hint to screen %d as %dx%d\n", … … 402 402 if ( !isFullscreenOrSeamless() 403 403 && uisession()->isGuestSupportsGraphics() 404 && ( m_pFrameBuffer->width() != uWidth405 || m_pFrameBuffer->height() != uHeight404 && ( frameBuffer()->width() != uWidth 405 || frameBuffer()->height() != uHeight 406 406 || uisession()->isScreenVisible(screenId()) != uisession()->isScreenVisibleHostDesires(screenId()))) 407 407 storeGuestSizeHint(QSize(uWidth, uHeight)); … … 453 453 if ( !isFullscreenOrSeamless() 454 454 && uisession()->isGuestSupportsGraphics() 455 && ( (int) m_pFrameBuffer->width() != size.width()456 || (int) m_pFrameBuffer->height() != size.height()455 && ( (int)frameBuffer()->width() != size.width() 456 || (int)frameBuffer()->height() != size.height() 457 457 || uisession()->isScreenVisible(screenId()) != uisession()->isScreenVisibleHostDesires(screenId()))) 458 458 storeGuestSizeHint(size); … … 473 473 void UIMachineView::sltHandleNotifyChange(int iWidth, int iHeight) 474 474 { 475 /* Sanity check: */ 476 if (!frameBuffer()) 477 return; 478 475 479 LogRel2(("GUI: UIMachineView::sltHandleNotifyChange: Screen=%d, Size=%dx%d\n", 476 480 (unsigned long)m_uScreenId, iWidth, iHeight)); … … 570 574 void UIMachineView::sltHandleNotifyUpdate(int iX, int iY, int iWidth, int iHeight) 571 575 { 576 /* Sanity check: */ 577 if (!frameBuffer()) 578 return; 579 572 580 /* Prepare corresponding viewport part: */ 573 581 QRect rect(iX, iY, iWidth, iHeight); … … 705 713 case KMachineState_TeleportingPausedVM: 706 714 { 707 if ( m_pFrameBuffer715 if ( frameBuffer() 708 716 && ( state != KMachineState_TeleportingPausedVM 709 717 || m_previousState != KMachineState_Teleporting)) … … 741 749 m_previousState == KMachineState_Restoring) 742 750 { 743 if ( m_pFrameBuffer)751 if (frameBuffer()) 744 752 { 745 753 /* Reset pause-pixmap: */ … … 861 869 /* Create new frame-buffer: */ 862 870 m_pFrameBuffer = new UIFrameBuffer; 863 m_pFrameBuffer->init(this);871 frameBuffer()->init(this); 864 872 865 873 /* Take scaling optimization type into account: */ 866 m_pFrameBuffer->setScalingOptimizationType(gEDataManager->scalingOptimizationType(uiCommon().managedVMUuid()));874 frameBuffer()->setScalingOptimizationType(gEDataManager->scalingOptimizationType(uiCommon().managedVMUuid())); 867 875 868 876 /* Acquire selected scale-factor: */ … … 876 884 877 885 /* Assign frame-buffer with new values: */ 878 m_pFrameBuffer->setDevicePixelRatio(dDevicePixelRatioFormal);879 m_pFrameBuffer->setDevicePixelRatioActual(dDevicePixelRatioActual);880 m_pFrameBuffer->setScaleFactor(dScaleFactor);881 m_pFrameBuffer->setUseUnscaledHiDPIOutput(fUseUnscaledHiDPIOutput);886 frameBuffer()->setDevicePixelRatio(dDevicePixelRatioFormal); 887 frameBuffer()->setDevicePixelRatioActual(dDevicePixelRatioActual); 888 frameBuffer()->setScaleFactor(dScaleFactor); 889 frameBuffer()->setUseUnscaledHiDPIOutput(fUseUnscaledHiDPIOutput); 882 890 883 891 /* Propagate the scale-factor related attributes to 3D service if necessary: */ … … 899 907 900 908 /* Perform frame-buffer rescaling: */ 901 m_pFrameBuffer->performRescale();909 frameBuffer()->performRescale(); 902 910 903 911 /* Associate uisession with frame-buffer finally: */ 904 uisession()->setFrameBuffer(screenId(), m_pFrameBuffer);912 uisession()->setFrameBuffer(screenId(), frameBuffer()); 905 913 } 906 914 907 915 /* Make sure frame-buffer was prepared: */ 908 AssertReturnVoid( m_pFrameBuffer);916 AssertReturnVoid(frameBuffer()); 909 917 910 918 /* Reattach to IDisplay: */ 911 m_pFrameBuffer->detach();912 m_pFrameBuffer->attach();919 frameBuffer()->detach(); 920 frameBuffer()->attach(); 913 921 914 922 /* Calculate frame-buffer size: */ … … 1031 1039 { 1032 1040 /* Make sure framebuffer assigned at all: */ 1033 if (! m_pFrameBuffer)1041 if (!frameBuffer()) 1034 1042 return; 1035 1043 1036 1044 /* Make sure proper framebuffer assigned: */ 1037 AssertReturnVoid( m_pFrameBuffer== uisession()->frameBuffer(screenId()));1045 AssertReturnVoid(frameBuffer() == uisession()->frameBuffer(screenId())); 1038 1046 1039 1047 /* Mark framebuffer as unused: */ 1040 1048 LogRelFlow(("GUI: UIMachineView::cleanupFrameBuffer: Stop EMT callbacks accepting for screen: %d\n", screenId())); 1041 m_pFrameBuffer->setMarkAsUnused(true);1049 frameBuffer()->setMarkAsUnused(true); 1042 1050 1043 1051 /* Process pending framebuffer events: */ … … 1049 1057 * to ensure 3D gets notified of view being destroyed... */ 1050 1058 if (console().isOk() && !display().isNull()) 1051 m_pFrameBuffer->detach();1059 frameBuffer()->detach(); 1052 1060 1053 1061 /* Detach framebuffer from view: */ 1054 m_pFrameBuffer->setView(NULL);1062 frameBuffer()->setView(NULL); 1055 1063 } 1056 1064 … … 1123 1131 1124 1132 /* Get frame-buffer size-hint: */ 1125 QSize size( m_pFrameBuffer->width(), m_pFrameBuffer->height());1133 QSize size(frameBuffer()->width(), frameBuffer()->height()); 1126 1134 1127 1135 /* Take the scale-factor(s) into account: */ … … 1152 1160 int UIMachineView::contentsWidth() const 1153 1161 { 1154 return m_pFrameBuffer->width();1162 return frameBuffer()->width(); 1155 1163 } 1156 1164 1157 1165 int UIMachineView::contentsHeight() const 1158 1166 { 1159 return m_pFrameBuffer->height();1167 return frameBuffer()->height(); 1160 1168 } 1161 1169 … … 1288 1296 { 1289 1297 /* Prepare a screen-shot: */ 1290 QImage screenShot = QImage( m_pFrameBuffer->width(), m_pFrameBuffer->height(), QImage::Format_RGB32);1298 QImage screenShot = QImage(frameBuffer()->width(), frameBuffer()->height(), QImage::Format_RGB32); 1291 1299 /* Which will be a 'black image' by default. */ 1292 1300 screenShot.fill(0); … … 1511 1519 1512 1520 /* Create the image ref out of the frame-buffer: */ 1513 return frameBuffertoCGImageRef( m_pFrameBuffer);1521 return frameBuffertoCGImageRef(frameBuffer()); 1514 1522 } 1515 1523 … … 1582 1590 /* Notify framebuffer about viewport resize: */ 1583 1591 QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent); 1584 if ( m_pFrameBuffer)1585 m_pFrameBuffer->viewportResized(pResizeEvent);1592 if (frameBuffer()) 1593 frameBuffer()->viewportResized(pResizeEvent); 1586 1594 /* Update console's display viewport and 3D overlay: */ 1587 1595 updateViewport(); … … 1696 1704 1697 1705 /* Delegate the paint function to the UIFrameBuffer interface: */ 1698 if ( m_pFrameBuffer)1699 m_pFrameBuffer->handlePaintEvent(pPaintEvent);1706 if (frameBuffer()) 1707 frameBuffer()->handlePaintEvent(pPaintEvent); 1700 1708 #ifdef VBOX_WS_MAC 1701 1709 /* Update the dock icon if we are in the running state: */
Note:
See TracChangeset
for help on using the changeset viewer.