VirtualBox

Ignore:
Timestamp:
Jan 15, 2015 11:00:51 AM (10 years ago)
Author:
vboxsync
Message:

Host 3D: prepare for content scaling.

Location:
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.h

    r53262 r53814  
    215215        int SetVisibleRegionsChanged();
    216216        int SetCompositor(const struct VBOXVR_SCR_COMPOSITOR * pCompositor);
     217        void SetScaleFactor(GLdouble scaleFactor);
     218        GLdouble GetScaleFactor();
    217219        int UpdateBegin();
    218220        void UpdateEnd();
     
    250252        CR_FBWIN_FLAGS mFlags;
    251253        uint64_t mParentId;
     254        volatile uint32_t mScaleFactorStorage;
    252255};
    253256
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/window.cpp

    r53262 r53814  
    2828    mWidth(0),
    2929    mHeight(0),
    30     mParentId(parentId)
     30    mParentId(parentId),
     31    mScaleFactorStorage(1)
    3132{
    3233    mFlags.Value = 0;
     
    128129    }
    129130
    130     LOG(("CrWIN: Size [%d ; %d]", width, height));
    131 
    132131    if (mWidth != width || mHeight != height)
    133132    {
     133        GLdouble scaleFactor = GetScaleFactor();
     134
    134135        mFlags.fCompositoEntriesModified = 1;
    135         mWidth = width;
    136         mHeight = height;
     136        mWidth  = scaleFactor ? (uint32_t)((GLdouble)width  * scaleFactor) : width;
     137        mHeight = scaleFactor ? (uint32_t)((GLdouble)height * scaleFactor) : height;
     138
     139        LOG(("CrWIN: Size [%d ; %d]", width, height));
     140
    137141        if (mSpuWindow)
    138             cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, width, height);
     142            cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, mWidth, mHeight);
    139143    }
    140144
     
    193197
    194198
     199void CrFbWindow::SetScaleFactor(GLdouble scaleFactor)
     200{
     201    ASMAtomicWriteU32(&mScaleFactorStorage, (uint32_t)scaleFactor);
     202}
     203
     204
     205GLdouble CrFbWindow::GetScaleFactor()
     206{
     207    return (GLdouble)ASMAtomicReadU32(&mScaleFactorStorage);
     208}
     209
     210
    195211int CrFbWindow::UpdateBegin()
    196212{
     
    226242        if (fPresentNeeded || mFlags.fForcePresentOnReenable)
    227243        {
     244            GLdouble scaleFactor = GetScaleFactor();
     245
    228246            mFlags.fForcePresentOnReenable = false;
    229247            if (mpCompositor)
     248            {
     249                CrVrScrCompositorSetStretching((VBOXVR_SCR_COMPOSITOR *)mpCompositor, scaleFactor, scaleFactor);
    230250                cr_server.head_spu->dispatch_table.VBoxPresentComposition(mSpuWindow, mpCompositor, NULL);
     251            }
    231252            else
    232253            {
     
    238259                Rect.yBottom = mHeight;
    239260                CrVrScrCompositorInit(&TmpCompositor, &Rect);
     261                CrVrScrCompositorSetStretching((VBOXVR_SCR_COMPOSITOR *)&TmpCompositor, scaleFactor, scaleFactor);
    240262                /* this is a cleanup operation
    241263                 * empty compositor is guarantid to be released on VBoxPresentComposition return */
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