VirtualBox

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


Ignore:
Timestamp:
May 27, 2013 11:22:29 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86027
Message:

FE/Qt: Runtime UI: QImage frame-buffer stuff: Experimental try to fix seamless-region flicker.

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

Legend:

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

    r46129 r46283  
    264264    }
    265265    lock(); /* See comment in setView(). */
     266    m_syncVisibleRegion = reg;
    266267    if (m_pMachineView)
    267268        QApplication::postEvent(m_pMachineView, new UISetRegionEvent(reg));
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h

    r46255 r46283  
    237237    ulong m_width;
    238238    ulong m_height;
    239     QRegion m_visibleRegion;
    240239    QSize m_scaledSize;
    241240    int64_t m_WinId;
    242241    bool m_fIsDeleted;
    243242
     243    /* To avoid a seamless flicker,
     244     * which caused by the latency between the
     245     * initial visible-region arriving from EMT thread
     246     * and actual visible-region application on GUI thread
     247     * it was decided to use two visible-region instances:
     248     * 1. 'Sync-one' which being updated synchronously by locking EMT thread,
     249     *               and used for immediate manual clipping of the painting operations.
     250     * 2. 'Async-one' which updated asynchronously by posting async-event from EMT to GUI thread,
     251                      which is used to update viewport parts for visible-region changes,
     252                      because NotifyUpdate doesn't take into account these changes. */
     253    QRegion m_syncVisibleRegion;
     254    QRegion m_asyncVisibleRegion;
     255
    244256#if defined (Q_OS_WIN32)
    245257private:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp

    r46255 r46283  
    5656{
    5757    /* Invalidate visible-region if necessary: */
    58     if (m_width != pEvent->width() ||
    59         m_height != pEvent->height())
    60         m_visibleRegion = QRegion();
     58    if (m_pMachineView->machineLogic()->visualStateType() == UIVisualStateType_Seamless &&
     59        (m_width != pEvent->width() || m_height != pEvent->height()))
     60    {
     61        lock();
     62        m_syncVisibleRegion = QRegion();
     63        m_asyncVisibleRegion = QRegion();
     64        unlock();
     65    }
    6166
    6267    /* Remember new width/height: */
     
    175180void UIFrameBufferQImage::applyVisibleRegionEvent(UISetRegionEvent *pEvent)
    176181{
    177     /* Make sure visible-region changed: */
    178     if (m_visibleRegion == pEvent->region())
    179         return;
    180 
    181     /* Compose viewport region to update: */
    182     QRegion toUpdate = pEvent->region() + m_visibleRegion;
    183     /* Remember new visible-region: */
    184     m_visibleRegion = pEvent->region();
    185     /* Update viewport region finally: */
    186     m_pMachineView->viewport()->update(toUpdate);
     182    /* Make sure async visible-region changed: */
     183    if (m_asyncVisibleRegion == pEvent->region())
     184        return;
     185
     186    /* We are accounting async visible-regions one-by-one
     187     * to keep corresponding viewport area always updated! */
     188    m_pMachineView->viewport()->update(pEvent->region() + m_asyncVisibleRegion);
     189    m_asyncVisibleRegion = pEvent->region();
     190
    187191#ifdef Q_WS_X11
    188192    /* Qt 4.8.3 under X11 has Qt::WA_TranslucentBackground window attribute broken,
    189      * so we are still have to use old one known Xshape extension wrapped by the widget setMask API: */
    190     m_pMachineView->machineWindow()->setMask(m_visibleRegion);
     193     * so we are also have to use async visible-region to apply to [Q]Widget [set]Mask
     194     * which internally wraps old one known (approved) Xshape extension: */
     195    m_pMachineView->machineWindow()->setMask(m_asyncVisibleRegion);
    191196#endif /* Q_WS_X11 */
    192197}
     
    226231    painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
    227232
     233    /* Manually clip paint rectangle using visible-region: */
     234    lock();
     235    QRegion visiblePaintRegion = m_syncVisibleRegion & paintRect;
     236    unlock();
     237
    228238    /* Repaint all the rectangles of visible-region: */
    229     QRegion visiblePaintRegion = m_visibleRegion & paintRect;
    230239    foreach (const QRect &rect, visiblePaintRegion.rects())
    231240    {
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.cpp

    r46255 r46283  
    465465void UIFrameBufferQuartz2D::applyVisibleRegionEvent(UISetRegionEvent *pEvent)
    466466{
    467     /* Make sure visible-region changed: */
    468     if (m_visibleRegion == pEvent->region())
     467    /* Make sure async visible-region changed: */
     468    if (m_asyncVisibleRegion == pEvent->region())
    469469        return;
    470470
    471     /* Remember new visible-region: */
    472     m_visibleRegion = pEvent->region();
    473     /* Invalidate whole the viewport: */
     471    /* We are handling the fact of async visible-region change
     472     * to invalidate whole the viewport area! */
    474473    ::darwinWindowInvalidateShape(m_pMachineView->viewport());
     474    m_asyncVisibleRegion = pEvent->region();
    475475}
    476476
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