VirtualBox

Changeset 53443 in vbox for trunk/src


Ignore:
Timestamp:
Dec 4, 2014 2:41:55 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 6278: Support for scaled video-output: Common viewport update rules for scaled and unscaled cases.

File:
1 edited

Legend:

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

    r53389 r53443  
    281281void UIMachineView::sltHandleNotifyUpdate(int iX, int iY, int iWidth, int iHeight)
    282282{
     283    /* Prepare corresponding viewport part: */
     284    QRect rect;
     285
    283286    /* Take the scale-factor into account: */
    284287    const double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());
    285288    if (dScaleFactor == 1)
    286289    {
    287         /* Just update corresponding viewport part: */
    288         viewport()->update(iX - contentsX(), iY - contentsY(), iWidth, iHeight);
     290        /* Adjust corresponding viewport part: */
     291        rect.moveTo(iX - contentsX(),
     292                    iY - contentsY());
     293        rect.setSize(QSize(iWidth,
     294                           iHeight));
    289295    }
    290296    else
    291297    {
    292         /* Calculate corresponding viewport part: */
    293         QRect rect(iX * dScaleFactor - 1 - contentsX(),
    294                    iY * dScaleFactor - 1 - contentsY(),
    295                    iWidth  * dScaleFactor + 2 * dScaleFactor + 1,
    296                    iHeight * dScaleFactor + 2 * dScaleFactor + 1);
    297         /* Limit the resulting part by the viewport rectangle: */
    298         rect &= viewport()->rect();
    299         /* Update corresponding viewport part: */
    300         viewport()->update(rect);
    301     }
     298        /* Adjust corresponding viewport part: */
     299        rect.moveTo(iX * dScaleFactor - 1 - contentsX(),
     300                    iY * dScaleFactor - 1 - contentsY());
     301        rect.setSize(QSize(iWidth  * dScaleFactor + 2 * dScaleFactor + 1,
     302                           iHeight * dScaleFactor + 2 * dScaleFactor + 1));
     303    }
     304
     305    /* Limit the resulting part by the viewport rectangle: */
     306    rect &= viewport()->rect();
     307
     308    /* Update corresponding viewport part: */
     309    viewport()->update(rect);
    302310}
    303311
Note: See TracChangeset for help on using the changeset viewer.

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