VirtualBox

Changeset 53963 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jan 26, 2015 4:12:24 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
97861
Message:

FE/Qt: 3635: Scaling mode support: Use common update procedure code instead of scale one.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
4 edited

Legend:

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

    r53961 r53963  
    290290    QRect rect(iX, iY, iWidth, iHeight);
    291291
    292     /* Take the scale-factor into account: */
    293     const double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());
    294     if (dScaleFactor != 1.0)
    295     {
    296         rect.moveTo(floor((double)rect.x() * dScaleFactor) - 1,
    297                     floor((double)rect.y() * dScaleFactor) - 1);
    298         rect.setSize(QSize(ceil((double)rect.width()  * dScaleFactor) + 2,
    299                            ceil((double)rect.height() * dScaleFactor) + 2));
     292    /* Take the scaling into account: */
     293    const double dScaleFactor = frameBuffer()->scaleFactor();
     294    const QSize scaledSize = frameBuffer()->scaledSize();
     295    if (scaledSize.isValid())
     296    {
     297        /* Calculate corresponding scale-factors: */
     298        const double xScaleFactor = visualStateType() == UIVisualStateType_Scale ?
     299                                    (double)scaledSize.width()  / frameBuffer()->width()  : dScaleFactor;
     300        const double yScaleFactor = visualStateType() == UIVisualStateType_Scale ?
     301                                    (double)scaledSize.height() / frameBuffer()->height() : dScaleFactor;
     302        /* Adjust corresponding viewport part: */
     303        rect.moveTo(floor((double)rect.x() * xScaleFactor) - 1,
     304                    floor((double)rect.y() * yScaleFactor) - 1);
     305        rect.setSize(QSize(ceil((double)rect.width()  * xScaleFactor) + 2,
     306                           ceil((double)rect.height() * yScaleFactor) + 2));
    300307    }
    301308
     
    306313#ifdef Q_WS_MAC
    307314    /* Take the backing-scale-factor into account: */
    308     if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid()))
    309     {
    310         const double dBackingScaleFactor = darwinBackingScaleFactor(machineWindow());
     315    if (frameBuffer()->useUnscaledHiDPIOutput())
     316    {
     317        const double dBackingScaleFactor = frameBuffer()->backingScaleFactor();
    311318        if (dBackingScaleFactor > 1.0)
    312319        {
     
    974981    if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid()))
    975982    {
    976         const double dBackingScaleFactor = darwinBackingScaleFactor(machineWindow());
     983        const double dBackingScaleFactor = frameBuffer()->backingScaleFactor();
    977984        if (dBackingScaleFactor > 1.0)
    978985        {
     
    10021009    if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid()))
    10031010    {
    1004         const double dBackingScaleFactor = darwinBackingScaleFactor(machineWindow());
     1011        const double dBackingScaleFactor = frameBuffer()->backingScaleFactor();
    10051012        if (dBackingScaleFactor > 1.0)
    10061013        {
     
    12311238        QPainter painter(viewport());
    12321239        /* Take the scale-factor into account: */
    1233         if (gEDataManager->scaleFactor(vboxGlobal().managedVMUuid()) == 1.0)
     1240        if (frameBuffer()->scaleFactor() == 1.0)
    12341241            painter.drawPixmap(rect.topLeft(), pausePixmap());
    12351242        else
     
    14261433{
    14271434    /* Take the scale-factor into account: */
    1428     const double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());
     1435    const double dScaleFactor = frameBuffer()->scaleFactor();
    14291436    if (dScaleFactor != 1.0)
    14301437        size = QSize(size.width() * dScaleFactor, size.height() * dScaleFactor);
     
    14341441    if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid()))
    14351442    {
    1436         const double dBackingScaleFactor = darwinBackingScaleFactor(machineWindow());
     1443        const double dBackingScaleFactor = frameBuffer()->backingScaleFactor();
    14371444        if (dBackingScaleFactor > 1.0)
    14381445            size = QSize(size.width() / dBackingScaleFactor, size.height() / dBackingScaleFactor);
     
    14501457    if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid()))
    14511458    {
    1452         const double dBackingScaleFactor = darwinBackingScaleFactor(machineWindow());
     1459        const double dBackingScaleFactor = frameBuffer()->backingScaleFactor();
    14531460        if (dBackingScaleFactor > 1.0)
    14541461            size = QSize(size.width() * dBackingScaleFactor, size.height() * dBackingScaleFactor);
     
    14571464
    14581465    /* Take the scale-factor into account: */
    1459     const double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());
     1466    const double dScaleFactor = frameBuffer()->scaleFactor();
    14601467    if (dScaleFactor != 1.0)
    14611468        size = QSize(size.width() / dScaleFactor, size.height() / dScaleFactor);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp

    r53959 r53963  
    946946            if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid()))
    947947            {
    948                 const double dBackingScaleFactor = darwinBackingScaleFactor(m_windows.value(uScreenId));
     948                const double dBackingScaleFactor = pFrameBuffer->backingScaleFactor();
    949949                if (dBackingScaleFactor > 1.0)
    950950                {
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp

    r53962 r53963  
    101101    /* Update machine-view sliders: */
    102102    updateSliders();
    103 }
    104 
    105 void UIMachineViewScale::sltHandleNotifyUpdate(int iX, int iY, int iW, int iH)
    106 {
    107     /* Initialize variables for scale mode: */
    108     const QSize scaledSize = frameBuffer()->scaledSize();
    109     const double xScaleFactor = (double)scaledSize.width()  / frameBuffer()->width();
    110     const double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height();
    111 
    112     /* Update corresponding viewport part,
    113      * But make sure we update always a bigger rectangle than requested to
    114      * catch all rounding errors. (use 1 time the ratio factor and
    115      * round down on top/left, but round up for the width/height) */
    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);
    120103}
    121104
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h

    r53962 r53963  
    4242    void sltPerformGuestScale();
    4343
    44     /* Handler: Frame-buffer NotifyUpdate stuff: */
    45     void sltHandleNotifyUpdate(int iX, int iY, int iW, int iH);
    46 
    4744private:
    4845
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