Changeset 39110 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 25, 2011 2:03:49 PM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r39108 r39110 272 272 { 273 273 /* Prepare frame-buffer depending on render-mode: */ 274 switch ( vboxGlobal().vmRenderMode())274 switch (getRenderMode()) 275 275 { 276 276 #ifdef VBOX_GUI_USE_QIMAGE … … 923 923 } 924 924 925 VBoxDefs::RenderMode UIMachineView::getRenderMode() const 926 { 927 if (visualStateType() != UIVisualStateType_Scale) 928 return vboxGlobal().vmRenderMode(); 929 /* This part of the method is temporary since not all of our framebuffer 930 * modes currently support scale view mode. Once they do it will be 931 * removed. */ 932 /** @note this could have been a mini-class which would be easier to 933 * unit test. */ 934 /* Prepare frame-buffer depending on render-mode: */ 935 switch (vboxGlobal().vmRenderMode()) 936 { 937 #ifdef VBOX_GUI_USE_QUARTZ2D 938 case VBoxDefs::Quartz2DMode: 939 return VBoxDefs::Quartz2DMode; 940 #endif /* VBOX_GUI_USE_QUARTZ2D */ 941 default: 942 #ifdef VBOX_GUI_USE_QIMAGE 943 case VBoxDefs::QImageMode: 944 return VBoxDefs::QImageMode; 945 #endif /* VBOX_GUI_USE_QIMAGE */ 946 break; 947 } 948 AssertReleaseMsgFailed(("Scale-mode currently does NOT supporting render-mode %d\n", vboxGlobal().vmRenderMode())); 949 qApp->exit(1); 950 } 951 925 952 bool UIMachineView::event(QEvent *pEvent) 926 953 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r39108 r39110 181 181 * virtual monitor. Used for storing monitor-specific extra data. */ 182 182 QString makeExtraDataKeyPerMonitor(QString base) const; 183 /** Returns the current rendering mode. 184 * @note contains special case logic for scale mode. */ 185 VBoxDefs::RenderMode getRenderMode() const; 183 186 184 187 /* Cross-platforms event processors: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
r39081 r39110 76 76 saveMachineViewSettings(); 77 77 78 /* Disable scaling: */ 79 frameBuffer()->setScaledSize(QSize()); 80 78 81 /* Cleanup frame buffer: */ 79 82 cleanupFrameBuffer(); … … 259 262 } 260 263 261 void UIMachineViewScale::prepareFrameBuffer()262 {263 /* That method is partial copy-paste of UIMachineView::prepareFrameBuffer()264 * and its temporary here just because not all of our frame-buffers are currently supports scale-mode;265 * When all of our frame-buffers will be supporting scale-mode, method will be removed!266 * Here we are processing only these frame-buffer types, which knows scale-mode! */267 268 /* Prepare frame-buffer depending on render-mode: */269 switch (vboxGlobal().vmRenderMode())270 {271 #ifdef VBOX_GUI_USE_QUARTZ2D272 case VBoxDefs::Quartz2DMode:273 /* Indicate that we are doing all drawing stuff ourself: */274 viewport()->setAttribute(Qt::WA_PaintOnScreen);275 m_pFrameBuffer = new UIFrameBufferQuartz2D(this);276 break;277 #endif /* VBOX_GUI_USE_QUARTZ2D */278 default:279 #ifdef VBOX_GUI_USE_QIMAGE280 case VBoxDefs::QImageMode:281 m_pFrameBuffer = new UIFrameBufferQImage(this);282 break;283 #endif /* VBOX_GUI_USE_QIMAGE */284 AssertReleaseMsgFailed(("Scale-mode is currently NOT supporting that render-mode: %d\n", vboxGlobal().vmRenderMode()));285 LogRel(("Scale-mode is currently NOT supporting that render-mode: %d\n", vboxGlobal().vmRenderMode()));286 qApp->exit(1);287 break;288 }289 290 /* If frame-buffer was prepared: */291 if (m_pFrameBuffer)292 {293 /* Prepare display: */294 CDisplay display = session().GetConsole().GetDisplay();295 Assert(!display.isNull());296 m_pFrameBuffer->AddRef();297 display.SetFramebuffer(m_uScreenId, CFramebuffer(m_pFrameBuffer));298 }299 300 QSize size;301 #ifdef Q_WS_X11302 /* Processing pseudo resize-event to synchronize frame-buffer with stored303 * framebuffer size. On X11 this will be additional done when the machine304 * state was 'saved'. */305 if (session().GetMachine().GetState() == KMachineState_Saved)306 size = guestSizeHint();307 #endif /* Q_WS_X11 */308 /* If there is a preview image saved, we will resize the framebuffer to the309 * size of that image. */310 ULONG buffer = 0, width = 0, height = 0;311 CMachine machine = session().GetMachine();312 machine.QuerySavedScreenshotPNGSize(0, buffer, width, height);313 if (buffer > 0)314 {315 /* Init with the screenshot size */316 size = QSize(width, height);317 /* Try to get the real guest dimensions from the save state */318 ULONG guestWidth = 0, guestHeight = 0;319 machine.QuerySavedGuestSize(0, guestWidth, guestHeight);320 if ( guestWidth > 0321 && guestHeight > 0)322 size = QSize(guestWidth, guestHeight);323 }324 /* If we have a valid size, resize the framebuffer. */325 if ( size.width() > 0326 && size.height() > 0)327 {328 UIResizeEvent event(FramebufferPixelFormat_Opaque, NULL, 0, 0, size.width(), size.height());329 frameBuffer()->resizeEvent(&event);330 }331 }332 333 264 void UIMachineViewScale::saveMachineViewSettings() 334 265 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h
r39081 r39110 56 56 57 57 /* Prepare helpers: */ 58 void prepareFrameBuffer();58 // void prepareFrameBuffer(); 59 59 //void loadMachineViewSettings(); 60 60
Note:
See TracChangeset
for help on using the changeset viewer.