VirtualBox

Changeset 31299 in vbox


Ignore:
Timestamp:
Aug 2, 2010 1:18:12 PM (14 years ago)
Author:
vboxsync
Message:

FE/Qt4: make live resize in scale mode; only repaint as much as necessary

File:
1 edited

Legend:

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

    r31214 r31299  
    107107{
    108108    /* Check if scale is requested: */
    109     if (!m_fShouldWeDoScale)
    110         return;
    111 
    112109    /* Set new frame-buffer scale-factor: */
    113110    frameBuffer()->setScaledSize(viewport()->size());
     
    185182            emit resizeHintDone();
    186183
     184            pEvent->accept();
    187185            return true;
    188186        }
     
    196194            AssertMsg(contentsX() == 0, ("Thats can't be, else notify Dsen!\n"));
    197195            AssertMsg(contentsY() == 0, ("Thats can't be, else notify Dsen!\n"));
    198             viewport()->repaint((pPaintEvent->x() - 10 /* 10 pixels left to cover xRatio*10 */) * xRatio,
    199                                 (pPaintEvent->y() - 10 /* 10 pixels left to cover yRatio*10 */) * yRatio,
    200                                 (pPaintEvent->width() + 10 /* 10 pixels right to cover x shift */ + 10 /* 10 pixels right to cover xRatio*10 */) * xRatio,
    201                                 (pPaintEvent->height() + 10 /* 10 pixels right to cover y shift */ + 10 /* 10 pixels right to cover yRatio*10 */) * yRatio);
    202 
    203 //            viewport()->repaint((int)(pPaintEvent->x()  /* 10 pixels left to cover xRatio*10 */ * xRatio),
    204 //                                (int)(pPaintEvent->y()  /* 10 pixels left to cover yRatio*10 */ * yRatio),
    205 //                                (int)(pPaintEvent->width()  /* 10 pixels right to cover x shift */  /* 10 pixels right to cover xRatio*10 */ * xRatio) + 2,
    206 //                                (int)(pPaintEvent->height()  /* 10 pixels right to cover y shift */  /* 10 pixels right to cover yRatio*10 */ * yRatio) + 2);
     196            /* Make sure we update always a bigger rectangle than requested to
     197             * catch all rounding errors. (use 1 time the ratio factor and
     198             * round down on top/left, but round up for the width/height) */
     199            viewport()->repaint((int)(pPaintEvent->x() * xRatio) - ((int)xRatio),
     200                                (int)(pPaintEvent->y() * yRatio) - ((int)yRatio),
     201                                (int)(pPaintEvent->width() * xRatio) + ((int)xRatio + 1) * 2,
     202                                (int)(pPaintEvent->height() * yRatio) + ((int)yRatio + 1) * 2);
    207203            pEvent->accept();
    208204            return true;
     
    227223            case QEvent::Resize:
    228224            {
    229                 /* Set the "guest needs to resize" hint.
    230                  * This hint is acted upon when (and only when) the autoresize property is "true": */
    231                 m_fShouldWeDoScale = true;
    232                 QTimer::singleShot(300, this, SLOT(sltPerformGuestScale()));
     225                /* Perform the actually resize */
     226                sltPerformGuestScale();
    233227                break;
    234228            }
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