VirtualBox

Ignore:
Timestamp:
Jan 14, 2015 1:53:30 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
97611
Message:

FE/Qt: 6278: Support for scaled video-output: 2D Video Acceleration support.

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

Legend:

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

    r52805 r53803  
    38593859
    38603860    ulong bytesPerPixel = bitsPerPixel/8;
    3861     ulong displayWidth = bytesPerLine/bytesPerPixel;
    3862     ulong displayHeight = size.height();
     3861    const QSize scaledSize = size.scaledSize();
     3862    const ulong displayWidth = scaledSize.isValid() ? scaledSize.width() : bytesPerLine / bytesPerPixel;
     3863    const ulong displayHeight = scaledSize.isValid() ? scaledSize.height() : size.height();
    38633864
    38643865#ifdef VBOXQGL_DBG_SURF
     
    44064407}
    44074408
    4408 bool VBoxQGLOverlay::onNotifyUpdate(ULONG aX, ULONG aY,
    4409                          ULONG aW, ULONG aH)
    4410 {
     4409bool VBoxQGLOverlay::onNotifyUpdate(ULONG uX, ULONG uY,
     4410                                    ULONG uW, ULONG uH)
     4411{
     4412    /* Prepare corresponding viewport part: */
     4413    QRect rect;
     4414
     4415    /* Take the scale-factor into account: */
     4416    const double dScaleFactor = mSizeInfo.scaleFactor();
     4417    if (dScaleFactor == 1.0)
     4418    {
     4419        /* Adjust corresponding viewport part: */
     4420        rect.moveTo(uX, uY);
     4421        rect.setSize(QSize(uW, uH));
     4422    }
     4423    else
     4424    {
     4425        /* Adjust corresponding viewport part: */
     4426        rect.moveTo(uX * dScaleFactor - 1,
     4427                    uY * dScaleFactor - 1);
     4428        rect.setSize(QSize(uW * dScaleFactor + 2 * dScaleFactor + 1,
     4429                           uH * dScaleFactor + 2 * dScaleFactor + 1));
     4430    }
     4431
    44114432    /* we do not to miss notify updates, because we have to update bg textures for it,
    44124433     * so no not check for m_fUnused here,
    44134434     * mOverlay will store the required info for us */
    4414     QRect r(aX, aY, aW, aH);
    4415     mCmdPipe.postCmd(VBOXVHWA_PIPECMD_PAINT, &r);
     4435    mCmdPipe.postCmd(VBOXVHWA_PIPECMD_PAINT, &rect);
     4436
    44164437    return true;
    44174438}
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h

    r52722 r53803  
    13411341{
    13421342public:
     1343
    13431344    VBoxFBSizeInfo() {}
    1344     template<class T> VBoxFBSizeInfo(T * fb) :
    1345         mPixelFormat(fb->pixelFormat()), mVRAM(fb->address()), mBitsPerPixel(fb->bitsPerPixel()),
    1346         mBytesPerLine(fb->bytesPerLine()), mWidth(fb->width()), mHeight(fb->height()),
     1345    template<class T> VBoxFBSizeInfo(T *pFb) :
     1346        mPixelFormat(pFb->pixelFormat()), mVRAM(pFb->address()), mBitsPerPixel(pFb->bitsPerPixel()),
     1347        mBytesPerLine(pFb->bytesPerLine()), mWidth(pFb->width()), mHeight(pFb->height()),
     1348        m_dScaleFactor(pFb->scaleFactor()), m_scaledSize(pFb->scaledSize()),
    13471349        mUsesGuestVram(true) {}
    13481350
    13491351    VBoxFBSizeInfo(ulong aPixelFormat, uchar *aVRAM,
    1350                      ulong aBitsPerPixel, ulong aBytesPerLine,
    1351                      ulong aWidth, ulong aHeight,
    1352                      bool bUsesGuestVram) :
    1353         mPixelFormat (aPixelFormat), mVRAM (aVRAM), mBitsPerPixel (aBitsPerPixel),
    1354         mBytesPerLine (aBytesPerLine), mWidth (aWidth), mHeight (aHeight),
     1352                   ulong aBitsPerPixel, ulong aBytesPerLine,
     1353                   ulong aWidth, ulong aHeight,
     1354                   bool bUsesGuestVram) :
     1355        mPixelFormat(aPixelFormat), mVRAM(aVRAM), mBitsPerPixel(aBitsPerPixel),
     1356        mBytesPerLine(aBytesPerLine), mWidth(aWidth), mHeight(aHeight),
    13551357        mUsesGuestVram(bUsesGuestVram) {}
     1358
    13561359    ulong pixelFormat() const { return mPixelFormat; }
    13571360    uchar *VRAM() const { return mVRAM; }
     
    13601363    ulong width() const { return mWidth; }
    13611364    ulong height() const { return mHeight; }
     1365    double scaleFactor() const { return m_dScaleFactor; }
     1366    QSize scaledSize() const { return m_scaledSize; }
    13621367    bool usesGuestVram() const {return mUsesGuestVram;}
    13631368
    13641369private:
     1370
    13651371    ulong mPixelFormat;
    13661372    uchar *mVRAM;
     
    13691375    ulong mWidth;
    13701376    ulong mHeight;
     1377    double m_dScaleFactor;
     1378    QSize m_scaledSize;
    13711379    bool mUsesGuestVram;
    13721380};
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h

    r53520 r53803  
    183183    void unlock() const { RTCritSectLeave(&m_critSect); }
    184184
    185     /** Returns host-to-guest scale ratio. */
     185    /** Returns the scale-factor used by the scaled-size. */
     186    double scaleFactor() const { return m_dScaleFactor; }
     187    /** Returns the frame-buffer's scaled-size. */
    186188    QSize scaledSize() const { return m_scaledSize; }
    187189    /** Defines host-to-guest scale ratio as @a size. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r53499 r53803  
    357357    /* Adjust frame-buffer, machine-window and guest-screen size if necessary: */
    358358    sltHandleNotifyChange(frameBuffer()->width(), frameBuffer()->height());
     359    frameBuffer()->resizeEvent(frameBuffer()->width(), frameBuffer()->height());
    359360    machineWindow()->normalizeGeometry(true /* adjust position */);
    360361    adjustGuestScreenSize();
     
    370371    /* Adjust frame-buffer, machine-window and guest-screen size if necessary: */
    371372    sltHandleNotifyChange(frameBuffer()->width(), frameBuffer()->height());
     373    frameBuffer()->resizeEvent(frameBuffer()->width(), frameBuffer()->height());
    372374    machineWindow()->normalizeGeometry(true /* adjust position */);
    373375    adjustGuestScreenSize();
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