Changeset 70995 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 13, 2018 11:56:54 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120842
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
r70627 r70995 65 65 QSize scaledSize = size(); 66 66 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 67 if (dDevicePixelRatio > 1.0 && frameBuffer()->useUnscaledHiDPIOutput()) 67 const bool fUseUnscaledHiDPIOutput = frameBuffer()->useUnscaledHiDPIOutput(); 68 if (dDevicePixelRatio > 1.0 && fUseUnscaledHiDPIOutput) 68 69 scaledSize *= dDevicePixelRatio; 69 70 frameBuffer()->setScaledSize(scaledSize); … … 76 77 if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable()) 77 78 { 78 const double xScaleFactor = (double)scaledSize.width() / frameBuffer()->width(); 79 const double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height(); 79 double xScaleFactor = (double)scaledSize.width() / frameBuffer()->width(); 80 double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height(); 81 #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11) 82 // WORKAROUND: 83 // On Windows and Linux opposing to macOS it's only Qt which can auto scale up, 84 // not 3D overlay itself, so for auto scale-up mode we have to take that into account. 85 if (!fUseUnscaledHiDPIOutput) 86 { 87 xScaleFactor *= dDevicePixelRatio; 88 yScaleFactor *= dDevicePixelRatio; 89 } 90 #endif /* VBOX_WS_WIN || VBOX_WS_X11 */ 80 91 display().NotifyScaleFactorChange(m_uScreenId, 81 92 (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), … … 118 129 /* If scaled-size is valid: */ 119 130 const QSize scaledSize = frameBuffer()->scaledSize(); 131 const double dDevicePixelRatio = frameBuffer()->devicePixelRatio(); 132 const bool fUseUnscaledHiDPIOutput = frameBuffer()->useUnscaledHiDPIOutput(); 120 133 if (scaledSize.isValid()) 121 134 { … … 123 136 if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable()) 124 137 { 125 const double xScaleFactor = (double)scaledSize.width() / frameBuffer()->width(); 126 const double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height(); 138 double xScaleFactor = (double)scaledSize.width() / frameBuffer()->width(); 139 double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height(); 140 #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11) 141 // WORKAROUND: 142 // On Windows and Linux opposing to macOS it's only Qt which can auto scale up, 143 // not 3D overlay itself, so for auto scale-up mode we have to take that into account. 144 if (!fUseUnscaledHiDPIOutput) 145 { 146 xScaleFactor *= dDevicePixelRatio; 147 yScaleFactor *= dDevicePixelRatio; 148 } 149 #endif /* VBOX_WS_WIN || VBOX_WS_X11 */ 127 150 display().NotifyScaleFactorChange(m_uScreenId, 128 151 (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), … … 132 155 133 156 /* Take unscaled HiDPI output mode into account: */ 134 const bool fUseUnscaledHiDPIOutput = gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid());135 157 frameBuffer()->setUseUnscaledHiDPIOutput(fUseUnscaledHiDPIOutput); 136 158 /* Propagate unscaled-hidpi-output feature to 3D service if necessary: */
Note:
See TracChangeset
for help on using the changeset viewer.