VirtualBox

Ignore:
Timestamp:
Feb 13, 2018 11:56:54 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120842
Message:

FE/Qt: bugref:8694: Runtime UI: Few missed bits for 3D scaled mode support (s.a. r120416); this time for Unscaled HiDPI Output mode toggled off.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp

    r70627 r70995  
    6565    QSize scaledSize = size();
    6666    const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
    67     if (dDevicePixelRatio > 1.0 && frameBuffer()->useUnscaledHiDPIOutput())
     67    const bool fUseUnscaledHiDPIOutput = frameBuffer()->useUnscaledHiDPIOutput();
     68    if (dDevicePixelRatio > 1.0 && fUseUnscaledHiDPIOutput)
    6869        scaledSize *= dDevicePixelRatio;
    6970    frameBuffer()->setScaledSize(scaledSize);
     
    7677        if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
    7778        {
    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 */
    8091            display().NotifyScaleFactorChange(m_uScreenId,
    8192                                              (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
     
    118129    /* If scaled-size is valid: */
    119130    const QSize scaledSize = frameBuffer()->scaledSize();
     131    const double dDevicePixelRatio = frameBuffer()->devicePixelRatio();
     132    const bool fUseUnscaledHiDPIOutput = frameBuffer()->useUnscaledHiDPIOutput();
    120133    if (scaledSize.isValid())
    121134    {
     
    123136        if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
    124137        {
    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 */
    127150            display().NotifyScaleFactorChange(m_uScreenId,
    128151                                              (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
     
    132155
    133156    /* Take unscaled HiDPI output mode into account: */
    134     const bool fUseUnscaledHiDPIOutput = gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid());
    135157    frameBuffer()->setUseUnscaledHiDPIOutput(fUseUnscaledHiDPIOutput);
    136158    /* Propagate unscaled-hidpi-output feature to 3D service if necessary: */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette