Changeset 53962 in vbox
- Timestamp:
- Jan 26, 2015 2:34:13 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 97856
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r53912 r53962 92 92 93 93 /** Applies machine-view scale-factor. */ 94 v oid applyMachineViewScaleFactor();94 virtual void applyMachineViewScaleFactor(); 95 95 96 96 /* Framebuffer aspect ratio: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
r53897 r53962 66 66 saveMachineViewSettings(); 67 67 68 /* Return scaled-size to ' normal' mode: */69 applyMachineViewScaleFactor();68 /* Return scaled-size to 'default' mode: */ 69 UIMachineView::applyMachineViewScaleFactor(); 70 70 71 71 /* Cleanup frame buffer: */ … … 78 78 frameBuffer()->setScaledSize(viewport()->size()); 79 79 80 /* Propagate scale-factor to 3D service if necessary: */ 81 if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable()) 82 { 83 const double xRatio = (double)frameBuffer()->scaledSize().width() / frameBuffer()->width(); 84 const double yRatio = (double)frameBuffer()->scaledSize().height() / frameBuffer()->height(); 85 display().NotifyScaleFactorChange(m_uScreenId, 86 (uint32_t)(xRatio * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), 87 (uint32_t)(yRatio * VBOX_OGL_SCALE_FACTOR_MULTIPLIER)); 80 /* If scaled-size is valid: */ 81 const QSize scaledSize = frameBuffer()->scaledSize(); 82 if (scaledSize.isValid()) 83 { 84 /* Propagate scale-factor to 3D service if necessary: */ 85 if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable()) 86 { 87 const double xScaleFactor = (double)scaledSize.width() / frameBuffer()->width(); 88 const double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height(); 89 display().NotifyScaleFactorChange(m_uScreenId, 90 (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), 91 (uint32_t)(yScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER)); 92 } 88 93 } 89 94 … … 101 106 { 102 107 /* Initialize variables for scale mode: */ 103 QSize scaledSize = frameBuffer()->scaledSize(); 104 double xRatio = (double)scaledSize.width() / frameBuffer()->width(); 105 double yRatio = (double)scaledSize.height() / frameBuffer()->height(); 106 AssertMsg(contentsX() == 0, ("This can't be, else notify Dsen!\n")); 107 AssertMsg(contentsY() == 0, ("This can't be, else notify Dsen!\n")); 108 const QSize scaledSize = frameBuffer()->scaledSize(); 109 const double xScaleFactor = (double)scaledSize.width() / frameBuffer()->width(); 110 const double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height(); 108 111 109 112 /* Update corresponding viewport part, … … 111 114 * catch all rounding errors. (use 1 time the ratio factor and 112 115 * round down on top/left, but round up for the width/height) */ 113 viewport()->update((int)(iX * x Ratio) - ((int)xRatio) - 1,114 (int)(iY * y Ratio) - ((int)yRatio) - 1,115 (int)(iW * x Ratio) + ((int)xRatio+ 2) * 2,116 (int)(iH * y Ratio) + ((int)yRatio+ 2) * 2);116 viewport()->update((int)(iX * xScaleFactor) - ((int)xScaleFactor) - 1, 117 (int)(iY * yScaleFactor) - ((int)yScaleFactor) - 1, 118 (int)(iW * xScaleFactor) + ((int)xScaleFactor + 2) * 2, 119 (int)(iH * yScaleFactor) + ((int)yScaleFactor + 2) * 2); 117 120 } 118 121 … … 142 145 if (uisession()->isScreenVisible(screenId())) 143 146 storeGuestSizeHint(QSize(frameBuffer()->width(), frameBuffer()->height())); 147 } 148 149 void UIMachineViewScale::applyMachineViewScaleFactor() 150 { 151 /* If scaled-size is valid: */ 152 const QSize scaledSize = frameBuffer()->scaledSize(); 153 if (scaledSize.isValid()) 154 { 155 /* Propagate scale-factor to 3D service if necessary: */ 156 if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable()) 157 { 158 const double xScaleFactor = (double)scaledSize.width() / frameBuffer()->width(); 159 const double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height(); 160 display().NotifyScaleFactorChange(m_uScreenId, 161 (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), 162 (uint32_t)(yScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER)); 163 } 164 } 165 166 /* Take unscaled HiDPI output mode into account: */ 167 const bool fUseUnscaledHiDPIOutput = gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid()); 168 frameBuffer()->setUseUnscaledHiDPIOutput(fUseUnscaledHiDPIOutput); 144 169 } 145 170 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h
r53372 r53962 56 56 void saveMachineViewSettings(); 57 57 58 /** Applies machine-view scale-factor. */ 59 void applyMachineViewScaleFactor(); 60 58 61 /** Resends guest size-hint if necessary. */ 59 62 void maybeResendSizeHint();
Note:
See TracChangeset
for help on using the changeset viewer.