VirtualBox

Changeset 22822 in vbox


Ignore:
Timestamp:
Sep 7, 2009 7:33:48 PM (15 years ago)
Author:
vboxsync
Message:

video hw accel: generic template for overlay buffer

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

Legend:

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

    r22817 r22822  
    12571257
    12581258
     1259template <class T>
     1260class VBoxOverlayFrameBuffer : public T
     1261{
     1262public:
     1263    VBoxOverlayFrameBuffer (class VBoxConsoleView *aView)
     1264        : T(aView),
     1265          mOverlay(aView, this)
     1266    {}
     1267
     1268
     1269    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand)
     1270    {
     1271        return mOverlay.onVHWACommand((VBOXVHWACMD*)pCommand);
     1272    }
     1273
     1274    void doProcessVHWACommand(QEvent * pEvent)
     1275    {
     1276        mOverlay.onVHWACommandEvent(pEvent);
     1277    }
     1278
     1279    STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
     1280                             ULONG aW, ULONG aH)
     1281    {
     1282        if(mOverlay.onNotifyUpdate(aX, aY, aW, aH))
     1283            return S_OK;
     1284        return T::NotifyUpdate(aX, aY, aW, aH);
     1285    }
     1286
     1287    void paintEvent (QPaintEvent *pe)
     1288    {
     1289        QRect rect;
     1290        VBOXFBOVERLAY_RESUT res = mOverlay.onPaintEvent(pe, &rect);
     1291        switch(res)
     1292        {
     1293            case VBOXFBOVERLAY_MODIFIED:
     1294            {
     1295                QPaintEvent modified(rect);
     1296                T::paintEvent(&modified);
     1297            } break;
     1298            case VBOXFBOVERLAY_UNTOUCHED:
     1299                T::paintEvent(pe);
     1300                break;
     1301        }
     1302    }
     1303
     1304    void resizeEvent (VBoxResizeEvent *re)
     1305    {
     1306        mOverlay.onResizeEvent(re);
     1307        T::resizeEvent(re);
     1308        mOverlay.onResizeEventPostprocess(re);
     1309    }
     1310private:
     1311    VBoxQGLOverlay mOverlay;
     1312};
     1313
    12591314#endif
    12601315
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h

    r22818 r22822  
    333333};
    334334
    335 # ifdef VBOX_WITH_VIDEOHWACCEL
    336 #  ifdef VBOX_GUI_USE_QIMAGE
    337 class VBoxQImageOverlayFrameBuffer : public VBoxQImageFrameBuffer
    338 {
    339 public:
    340     VBoxQImageOverlayFrameBuffer (VBoxConsoleView *aView);
    341 
    342 
    343     STDMETHOD(ProcessVHWACommand)(BYTE *pCommand);
    344 
    345     void doProcessVHWACommand(QEvent * pEvent);
    346 
    347     STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
    348                              ULONG aW, ULONG aH);
    349 
    350     void paintEvent (QPaintEvent *pe);
    351     void resizeEvent (VBoxResizeEvent *re);
    352 private:
    353     VBoxQGLOverlay mOverlay;
    354 };
    355 #  endif /* #  ifdef VBOX_GUI_USE_QIMAGE */
    356 # endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
    357 
    358335#endif
    359336
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r22816 r22822  
    840840            mFrameBuf =
    841841#ifdef VBOX_WITH_VIDEOHWACCEL
    842                     mAccelerate2DVideo ? new VBoxQImageOverlayFrameBuffer (this) :
     842                    mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQImageFrameBuffer>(this) :
    843843#endif
    844844                    new VBoxQImageFrameBuffer (this);
     
    855855            XFlush(QX11Info::display());
    856856# endif
    857             mFrameBuf = new VBoxSDLFrameBuffer (this);
     857            mFrameBuf =
     858#if defined(VBOX_WITH_VIDEOHWACCEL) && defined(DEBUG_misha) /* not tested yet */
     859                    mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxSDLFrameBuffer>(this) :
     860#endif
     861                    new VBoxSDLFrameBuffer (this);
    858862            /*
    859863             *  disable scrollbars because we cannot correctly draw in a
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp

    r22816 r22822  
    57115711    }
    57125712}
    5713 #endif
     5713
     5714#endif
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQGL.cpp

    r22816 r22822  
    164164}
    165165
    166 
    167 VBoxQImageOverlayFrameBuffer::VBoxQImageOverlayFrameBuffer (VBoxConsoleView *aView)
    168     : VBoxQImageFrameBuffer(aView),
    169       mOverlay(aView, this)
    170 {}
    171 
    172 
    173 STDMETHODIMP VBoxQImageOverlayFrameBuffer::ProcessVHWACommand(BYTE *pCommand)
    174 {
    175     return mOverlay.onVHWACommand((VBOXVHWACMD*)pCommand);
    176 }
    177 
    178 void VBoxQImageOverlayFrameBuffer::doProcessVHWACommand(QEvent * pEvent)
    179 {
    180     mOverlay.onVHWACommandEvent(pEvent);
    181 }
    182 
    183 STDMETHODIMP VBoxQImageOverlayFrameBuffer::NotifyUpdate (ULONG aX, ULONG aY,
    184                              ULONG aW, ULONG aH)
    185 {
    186     if(mOverlay.onNotifyUpdate(aX, aY, aW, aH))
    187         return S_OK;
    188     return VBoxQImageFrameBuffer::NotifyUpdate(aX, aY, aW, aH);
    189 }
    190 
    191 void VBoxQImageOverlayFrameBuffer::paintEvent (QPaintEvent *pe)
    192 {
    193     QRect rect;
    194     VBOXFBOVERLAY_RESUT res = mOverlay.onPaintEvent(pe, &rect);
    195     switch(res)
    196     {
    197         case VBOXFBOVERLAY_MODIFIED:
    198         {
    199             QPaintEvent modified(rect);
    200             VBoxQImageFrameBuffer::paintEvent(&modified);
    201         } break;
    202         case VBOXFBOVERLAY_UNTOUCHED:
    203             VBoxQImageFrameBuffer::paintEvent(pe);
    204             break;
    205     }
    206 }
    207 
    208 void VBoxQImageOverlayFrameBuffer::resizeEvent (VBoxResizeEvent *re)
    209 {
    210     mOverlay.onResizeEvent(re);
    211     VBoxQImageFrameBuffer::resizeEvent(re);
    212     mOverlay.onResizeEventPostprocess(re);
    213 }
    214 
    215166#endif
    216167
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