VirtualBox

Changeset 53964 in vbox


Ignore:
Timestamp:
Jan 26, 2015 7:04:59 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
97863
Message:

FE/Qt: 3635: 2D Video Acceleration support for Scaling mode: Update routine bug-fixes.

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

Legend:

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

    r53823 r53964  
    5353#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    5454
     55/* Other VBox includes: */
    5556#include <iprt/memcache.h>
    5657#include <VBox/err.h>
    57 
    5858
    5959#ifdef VBOX_WITH_VIDEOHWACCEL
     
    6161# include <VBox/vmm/ssm.h>
    6262#endif /* VBOX_WITH_VIDEOHWACCEL */
     63
     64/* Other includes: */
     65#include <math.h>
     66
    6367
    6468#ifdef VBOXQGL_PROF_BASE
     
    44154419{
    44164420    /* Prepare corresponding viewport part: */
    4417     QRect rect;
    4418 
    4419     /* Take the scale-factor into account: */
     4421    QRect rect(uX, uY, uW, uH);
     4422
     4423    /* Take the scaling into account: */
    44204424    const double dScaleFactor = mSizeInfo.scaleFactor();
    4421     if (dScaleFactor == 1.0)
    4422     {
     4425    const QSize scaledSize = mSizeInfo.scaledSize();
     4426    if (scaledSize.isValid())
     4427    {
     4428        /* Calculate corresponding scale-factors: */
     4429        const double xScaleFactor = mSizeInfo.visualState() == UIVisualStateType_Scale ?
     4430                                    (double)scaledSize.width()  / mSizeInfo.width()  : dScaleFactor;
     4431        const double yScaleFactor = mSizeInfo.visualState() == UIVisualStateType_Scale ?
     4432                                    (double)scaledSize.height() / mSizeInfo.height() : dScaleFactor;
    44234433        /* Adjust corresponding viewport part: */
    4424         rect.moveTo(uX, uY);
    4425         rect.setSize(QSize(uW, uH));
    4426     }
    4427     else
    4428     {
    4429         /* Adjust corresponding viewport part: */
    4430         rect.moveTo(uX * dScaleFactor - 1,
    4431                     uY * dScaleFactor - 1);
    4432         rect.setSize(QSize(uW * dScaleFactor + 2 * dScaleFactor + 1,
    4433                            uH * dScaleFactor + 2 * dScaleFactor + 1));
     4434        rect.moveTo(floor((double)rect.x() * xScaleFactor) - 1,
     4435                    floor((double)rect.y() * yScaleFactor) - 1);
     4436        rect.setSize(QSize(ceil((double)rect.width()  * xScaleFactor) + 2,
     4437                           ceil((double)rect.height() * yScaleFactor) + 2));
    44344438    }
    44354439
     
    44414445        if (dBackingScaleFactor > 1.0)
    44424446        {
    4443             rect.moveTo(rect.topLeft() / dBackingScaleFactor - QPoint(1, 1));
    4444             rect.setSize(rect.size() / dBackingScaleFactor + QSize(2, 2));
     4447            rect.moveTo(floor((double)rect.x() / dBackingScaleFactor) - 1,
     4448                        floor((double)rect.y() / dBackingScaleFactor) - 1);
     4449            rect.setSize(QSize(ceil((double)rect.width()  / dBackingScaleFactor) + 2,
     4450                               ceil((double)rect.height() / dBackingScaleFactor) + 2));
    44454451        }
    44464452    }
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h

    r53823 r53964  
    13441344    VBoxFBSizeInfo() {}
    13451345    template<class T> VBoxFBSizeInfo(T *pFb) :
     1346        m_visualState(pFb->visualState()),
    13461347        mPixelFormat(pFb->pixelFormat()), mVRAM(pFb->address()), mBitsPerPixel(pFb->bitsPerPixel()),
    13471348        mBytesPerLine(pFb->bytesPerLine()), mWidth(pFb->width()), mHeight(pFb->height()),
     
    13531354                   ulong aWidth, ulong aHeight,
    13541355                   bool bUsesGuestVram) :
     1356        m_visualState(UIVisualStateType_Invalid),
    13551357        mPixelFormat(aPixelFormat), mVRAM(aVRAM), mBitsPerPixel(aBitsPerPixel),
    13561358        mBytesPerLine(aBytesPerLine), mWidth(aWidth), mHeight(aHeight),
     
    13581360        mUsesGuestVram(bUsesGuestVram) {}
    13591361
     1362    UIVisualStateType visualState() const { return m_visualState; }
    13601363    ulong pixelFormat() const { return mPixelFormat; }
    13611364    uchar *VRAM() const { return mVRAM; }
     
    13711374private:
    13721375
     1376    UIVisualStateType m_visualState;
    13731377    ulong mPixelFormat;
    13741378    uchar *mVRAM;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp

    r53959 r53964  
    5656
    5757UIFrameBuffer::UIFrameBuffer()
    58     : m_iWidth(0), m_iHeight(0)
     58    : m_visualState(UIVisualStateType_Invalid)
     59    , m_iWidth(0), m_iHeight(0)
    5960    , m_pMachineView(NULL)
    6061    , m_iWinId(0)
     
    7475{
    7576    LogRel2(("UIFrameBuffer::init %p\n", this));
     77
     78    /* Fetch visual-state: */
     79    m_visualState = pMachineView->visualStateType();
    7680
    7781    /* Assign mahine-view: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h

    r53861 r53964  
    7676      * @note Calls to this and any other EMT callback are synchronized (from GUI side). */
    7777    void setMarkAsUnused(bool fUnused);
     78
     79    /** Returns the visual-state this frame-buffer created for. */
     80    UIVisualStateType visualState() const { return m_visualState; }
    7881
    7982    /** Returns whether frame-buffer is <b>auto-enabled</b>.
     
    260263                              HiDPIOptimizationType hiDPIOptimizationType,
    261264                              double dBackingScaleFactor);
     265
     266    /** Holds the visual-state this frame-buffer created for. */
     267    UIVisualStateType m_visualState;
    262268
    263269    /** Holds the QImage buffer. */
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