VirtualBox

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


Ignore:
Timestamp:
Mar 26, 2010 6:51:00 PM (15 years ago)
Author:
vboxsync
Message:

2d: better cleanup, bugfixes

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h

    r27757 r27758  
    14291429public:
    14301430    VBoxFBSizeInfo() {}
    1431     template<class T> VBoxFBSizeInfo(T * e) :
    1432         mPixelFormat(e->pixelFormat()), mVRAM(e->VRAM()), mBitsPerPixel(e->bitsPerPixel()),
    1433         mBytesPerLine(e->bytesPerLine()), mWidth(e->width()), mHeight(e->height()) {}
     1431    template<class T> VBoxFBSizeInfo(T * fb) :
     1432        mPixelFormat(fb->pixelFormat()), mVRAM(fb->address()), mBitsPerPixel(fb->bitsPerPixel()),
     1433        mBytesPerLine(fb->bytesPerLine()), mWidth(fb->width()), mHeight(fb->height()),
     1434        mUsesGuestVram(fb->usesGuestVRAM()) {}
    14341435
    14351436    VBoxFBSizeInfo(ulong aPixelFormat, uchar *aVRAM,
    14361437                     ulong aBitsPerPixel, ulong aBytesPerLine,
    1437                      ulong aWidth, ulong aHeight) :
     1438                     ulong aWidth, ulong aHeight,
     1439                     bool bUsesGuestVram) :
    14381440        mPixelFormat (aPixelFormat), mVRAM (aVRAM), mBitsPerPixel (aBitsPerPixel),
    1439         mBytesPerLine (aBytesPerLine), mWidth (aWidth), mHeight (aHeight) {}
     1441        mBytesPerLine (aBytesPerLine), mWidth (aWidth), mHeight (aHeight),
     1442        mUsesGuestVram(bUsesGuestVram) {}
    14401443    ulong pixelFormat() const { return mPixelFormat; }
    14411444    uchar *VRAM() const { return mVRAM; }
     
    14441447    ulong width() const { return mWidth; }
    14451448    ulong height() const { return mHeight; }
     1449    bool usesGuestVram() const {return mUsesGuestVram;}
    14461450
    14471451private:
     
    14521456    ulong mWidth;
    14531457    ulong mHeight;
     1458    bool mUsesGuestVram;
    14541459};
    14551460
     
    19081913          mOverlay(pView->viewport(), pView, aSession),
    19091914          mpView (pView)
    1910     {}
     1915    {
     1916        /* synch with framebuffer */
     1917        mOverlay.onResizeEventPostprocess (VBoxFBSizeInfo(this), QPoint(mpView->contentsX(), mpView->contentsY()));
     1918    }
    19111919
    19121920    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand)
     
    19491957    {
    19501958        T::resizeEvent (re);
    1951         mOverlay.onResizeEventPostprocess (VBoxFBSizeInfo(re),
     1959        mOverlay.onResizeEventPostprocess (VBoxFBSizeInfo(this),
    19521960                QPoint(mpView->contentsX(), mpView->contentsY()));
    19531961    }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r27757 r27758  
    527527# endif
    528528# if defined(VBOX_WITH_VIDEOHWACCEL) && defined(DEBUG_misha) /* not tested yet */
    529             /* these two additional template args is a workaround to this [VBox|UI] duplication
    530              * @todo: they are to be removed once VBox stuff is gone */
    531             m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<UIFrameBufferSDL, UIMachineView, UIResizeEvent> (this, &machineWindowWrapper()->session()) : new UIFrameBufferSDL(this);
     529            if (m_fAccelerate2DVideo)
     530            {
     531                class UIFrameBuffer* pFramebuffer = uisession()->persistedBrameBuffer(screenId());
     532                if (pFramebuffer)
     533                    pFramebuffer->setView(this);
     534                else
     535                {
     536                    /* these two additional template args is a workaround to this [VBox|UI] duplication
     537                     * @todo: they are to be removed once VBox stuff is gone */
     538                    pFramebuffer = new VBoxOverlayFrameBuffer<UIFrameBufferSDL, UIMachineView, UIResizeEvent>(this, &machineWindowWrapper()->session());
     539                    uisession()->setPersistedBrameBuffer(screenId(), pFramebuffer);
     540                }
     541                m_pFrameBuffer = pFramebuffer;
     542            }
     543            else
     544                m_pFrameBuffer = new UIFrameBufferSDL(this);
    532545# else
    533546            m_pFrameBuffer = new UIFrameBufferSDL(this);
     
    557570            viewport()->setAttribute(Qt::WA_PaintOnScreen);
    558571# ifdef VBOX_WITH_VIDEOHWACCEL
    559             /* these two additional template args is a workaround to this [VBox|UI] duplication
    560              * @todo: they are to be removed once VBox stuff is gone */
    561             m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<UIFrameBufferQuartz2D, UIMachineView, UIResizeEvent>(this, &machineWindowWrapper()->session()) : new UIFrameBufferQuartz2D(this);
     572            if (m_fAccelerate2DVideo)
     573            {
     574                class UIFrameBuffer* pFramebuffer = uisession()->persistedBrameBuffer(screenId());
     575                if (pFramebuffer)
     576                    pFramebuffer->setView(this);
     577                else
     578                {
     579                    /* these two additional template args is a workaround to this [VBox|UI] duplication
     580                     * @todo: they are to be removed once VBox stuff is gone */
     581                    pFramebuffer = new VBoxOverlayFrameBuffer<UIFrameBufferQuartz2D, UIMachineView, UIResizeEvent>(this, &machineWindowWrapper()->session());
     582                    uisession()->setPersistedBrameBuffer(screenId(), pFramebuffer);
     583                }
     584                m_pFrameBuffer = pFramebuffer;
     585            }
     586            else
     587                m_pFrameBuffer = new UIFrameBufferQuartz2D(this);
    562588# else
    563589            m_pFrameBuffer = new UIFrameBufferQuartz2D(this);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r27757 r27758  
    3838#ifdef VBOX_WITH_VIDEOHWACCEL
    3939# include "VBoxFBOverlay.h"
     40# include "UIFrameBuffer.h"
    4041#endif
    4142
     
    594595        DestroyIcon(m_alphaCursor);
    595596#endif
     597
     598#ifdef VBOX_WITH_VIDEOHWACCEL
     599    for (int i = m_FrameBufferVector.size() - 1; i >= 0; --i)
     600    {
     601        UIFrameBuffer *pFb = m_FrameBufferVector[i];
     602        if (pFb)
     603        {
     604            /* Warn framebuffer about its no more necessary: */
     605            pFb->setDeleted(true);
     606            /* Detach framebuffer from Display: */
     607            CDisplay display = session().GetConsole().GetDisplay();
     608            display.SetFramebuffer(i, CFramebuffer(NULL));
     609            /* Release the reference: */
     610            pFb->Release();
     611        }
     612    }
     613#endif
    596614}
    597615
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