VirtualBox

Changeset 28215 in vbox


Ignore:
Timestamp:
Apr 12, 2010 3:31:54 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
59955
Message:

IDisplay API changes for multimonitor (xTracker 4655)

Location:
trunk/src/VBox
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxBFE/DisplayImpl.cpp

    r26980 r28215  
    205205}
    206206
    207 STDMETHODIMP Display::COMGETTER(Width)(ULONG *pWidth)
    208 {
    209     *pWidth = getWidth();
    210     return S_OK;
    211 }
    212 
    213 STDMETHODIMP Display::COMGETTER(Height)(ULONG *pHeight)
    214 {
    215     *pHeight = getHeight();
     207STDMETHODIMP Display::GetScreenResolution(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel)
     208{
     209    if (aWidth)
     210        *aWidth = getWidth();
     211    if (aHeight)
     212        *aHeight = getHeight();
     213    if (aBitsPerPixel)
     214        *aBitsPerPixel = getBitsPerPixel();
    216215    return S_OK;
    217216}
  • trunk/src/VBox/Frontends/VBoxBFE/DisplayImpl.h

    r26980 r28215  
    5858    STDMETHODIMP InvalidateAndUpdate();
    5959    STDMETHODIMP ResizeCompleted();
    60     STDMETHODIMP COMGETTER(Width)(ULONG *pWidth);
    61     STDMETHODIMP COMGETTER(Height)(ULONG *pHeight);
     60    STDMETHODIMP GetScreenResolution(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel);
    6261
    6362    void resetFramebuffer();
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r28211 r28215  
    11721172        {
    11731173            ULONG xRes, yRes, bpp;
    1174             rc = display->COMGETTER(Width)(&xRes);
    1175             if (rc == E_ACCESSDENIED)
    1176                 break; /* VM not powered up */
    1177             if (FAILED(rc))
    1178             {
    1179                 com::ErrorInfo info (display);
    1180                 GluePrintErrorInfo(info);
    1181                 return rc;
    1182             }
    1183             rc = display->COMGETTER(Height)(&yRes);
    1184             if (rc == E_ACCESSDENIED)
    1185                 break; /* VM not powered up */
    1186             if (FAILED(rc))
    1187             {
    1188                 com::ErrorInfo info (display);
    1189                 GluePrintErrorInfo(info);
    1190                 return rc;
    1191             }
    1192             rc = display->COMGETTER(BitsPerPixel)(&bpp);
     1174            rc = display->GetScreenResolution (0, &xRes, &yRes, &bpp);
    11931175            if (rc == E_ACCESSDENIED)
    11941176                break; /* VM not powered up */
  • trunk/src/VBox/Frontends/VBoxShell/vboxshell.py

    r28201 r28215  
    360360        h = console.display.height
    361361    print "Saving screenshot (%d x %d) in %s..." %(w,h,f)
    362     data = display.takeScreenShotSlow(w,h)
     362    data = display.takeScreenShotToArray(w,h)
    363363    size = (w,h)
    364364    mode = "RGBA"
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r28148 r28215  
    33533353                QImage shot = QImage (mFrameBuf->width(), mFrameBuf->height(), QImage::Format_RGB32);
    33543354                CDisplay dsp = mConsole.GetDisplay();
    3355                 dsp.TakeScreenShot (shot.bits(), shot.width(), shot.height());
     3355                dsp.TakeScreenShot (0, shot.bits(), shot.width(), shot.height());
    33563356                /*
    33573357                 *  TakeScreenShot() may fail if, e.g. the Paused notification
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r27873 r28215  
    26212621
    26222622        CDisplay dsp = console.GetDisplay();
    2623         QImage shot = QImage (dsp.GetWidth(), dsp.GetHeight(), QImage::Format_RGB32);
    2624         dsp.TakeScreenShot (shot.bits(), shot.width(), shot.height());
     2623        ULONG width = 0;
     2624        ULONG height = 0;
     2625        ULONG bpp = 0;
     2626        dsp.GetScreenResolution(0, width, height, bpp);
     2627        QImage shot = QImage (width, height, QImage::Format_RGB32);
     2628        dsp.TakeScreenShot (0, shot.bits(), shot.width(), shot.height());
    26252629        shot.save (QFile::encodeName (fname), "PNG");
    26262630
     
    33063310                          * _1M /* mb to bytes */
    33073311                          * 8; /* to bits */
    3308         ULONG guestBpp = mConsole->console().GetDisplay().GetBitsPerPixel();
     3312        ULONG width = 0;
     3313        ULONG height = 0;
     3314        ULONG guestBpp = 0;
     3315        mConsole->console().GetDisplay().GetScreenResolution(0, width, height, guestBpp);
    33093316        ULONG64 usedBits = (screen.width() /* display width */
    33103317                         * screen.height() /* display height */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.cpp

    r27223 r28215  
    555555    {
    556556        CConsole console = mSession.GetConsole();
    557         ULONG bpp = console.GetDisplay().GetBitsPerPixel();
     557        ULONG width = 0;
     558        ULONG height = 0;
     559        ULONG bpp = 0;
     560        console.GetDisplay().GetScreenResolution(0, width, height, bpp);
    558561        QString resolution = QString ("%1x%2")
    559             .arg (console.GetDisplay().GetWidth())
    560             .arg (console.GetDisplay().GetHeight());
     562            .arg (width)
     563            .arg (height);
    561564        if (bpp)
    562565            resolution += QString ("x%1").arg (bpp);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r28020 r28215  
    632632            QString strFileName = strLogFolder + "/VBox.png";
    633633            CDisplay display = console.GetDisplay();
    634             QImage shot = QImage(display.GetWidth(), display.GetHeight(), QImage::Format_RGB32);
    635             display.TakeScreenShot(shot.bits(), shot.width(), shot.height());
     634            ULONG width = 0;
     635            ULONG height = 0;
     636            ULONG bpp = 0;
     637            display.GetScreenResolution(0, width, height, bpp);
     638            QImage shot = QImage(width, height, QImage::Format_RGB32);
     639            display.TakeScreenShot(0, shot.bits(), shot.width(), shot.height());
    636640            shot.save(QFile::encodeName(strFileName), "PNG");
    637641
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r28148 r28215  
    12271227                    QImage shot = QImage(m_pFrameBuffer->width(), m_pFrameBuffer->height(), QImage::Format_RGB32);
    12281228                    CDisplay dsp = session().GetConsole().GetDisplay();
    1229                     dsp.TakeScreenShot(shot.bits(), shot.width(), shot.height());
     1229                    dsp.TakeScreenShot(screenId(), shot.bits(), shot.width(), shot.height());
    12301230                    /* TakeScreenShot() may fail if, e.g. the Paused notification was delivered
    12311231                     * after the machine execution was resumed. It's not fatal: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp

    r27420 r28215  
    203203quint64 UIMultiScreenLayout::memoryRequirements(const QMap<int, int> *pScreenLayout) const
    204204{
    205     int guestBpp = m_pMachineLogic->uisession()->session().GetConsole().GetDisplay().GetBitsPerPixel();
     205    ULONG width = 0;
     206    ULONG height = 0;
     207    ULONG guestBpp = 0;
     208    m_pMachineLogic->uisession()->session().GetConsole().GetDisplay().GetScreenResolution(0, width, height, guestBpp);
    206209    quint64 usedBits = 0;
    207210    for (int i = 0; i < m_cGuestScreens; ++ i)
  • trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp

    r27889 r28215  
    217217    }
    218218
    219     CHECK_ERROR(pDisplay, DrawToScreen(data, 0, 0, 100, 100));
     219    CHECK_ERROR(pDisplay, DrawToScreen(screenId, data, 0, 0, 100, 100));
    220220
    221221    RTMemTmpFree(data);
     
    225225
    226226    CHECK_ERROR(g_pConsole, COMGETTER(Display)(pDisplay.asOutParam()));
    227     CHECK_ERROR(pDisplay, DrawToScreen((BYTE*)data, x, y, w, h));
     227    CHECK_ERROR(pDisplay, DrawToScreen(screenId, (BYTE*)data, x, y, w, h));
    228228}
    229229
  • trunk/src/VBox/Main/DisplayImpl.cpp

    r27905 r28215  
    19801980
    19811981
    1982 // IDisplay properties
     1982// IDisplay methods
    19831983/////////////////////////////////////////////////////////////////////////////
    1984 
    1985 /**
    1986  * Returns the current display width in pixel
    1987  *
    1988  * @returns COM status code
    1989  * @param width Address of result variable.
    1990  */
    1991 STDMETHODIMP Display::COMGETTER(Width) (ULONG *width)
    1992 {
    1993     CheckComArgNotNull(width);
     1984STDMETHODIMP Display::GetScreenResolution (ULONG aScreenId,
     1985    ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel)
     1986{
     1987    LogFlowFunc (("aScreenId = %d\n", aScreenId));
    19941988
    19951989    AutoCaller autoCaller(this);
    19961990    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    19971991
    1998     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    1999 
    2000     CHECK_CONSOLE_DRV (mpDrv);
    2001 
    2002     *width = mpDrv->IConnector.cx;
     1992    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1993
     1994    uint32_t u32Width = 0;
     1995    uint32_t u32Height = 0;
     1996    uint32_t u32BitsPerPixel = 0;
     1997
     1998    if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
     1999    {
     2000        CHECK_CONSOLE_DRV (mpDrv);
     2001
     2002        u32Width = mpDrv->IConnector.cx;
     2003        u32Height = mpDrv->IConnector.cy;
     2004        int rc = mpDrv->pUpPort->pfnQueryColorDepth(mpDrv->pUpPort, &u32BitsPerPixel);
     2005        AssertRC(rc);
     2006    }
     2007    else if (aScreenId < mcMonitors)
     2008    {
     2009        DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId];
     2010        u32Width = pFBInfo->w;
     2011        u32Height = pFBInfo->h;
     2012        u32BitsPerPixel = pFBInfo->u16BitsPerPixel;
     2013    }
     2014    else
     2015    {
     2016        return E_INVALIDARG;
     2017    }
     2018
     2019    if (aWidth)
     2020        *aWidth = u32Width;
     2021    if (aHeight)
     2022        *aHeight = u32Height;
     2023    if (aBitsPerPixel)
     2024        *aBitsPerPixel = u32BitsPerPixel;
    20032025
    20042026    return S_OK;
    20052027}
    2006 
    2007 /**
    2008  * Returns the current display height in pixel
    2009  *
    2010  * @returns COM status code
    2011  * @param height Address of result variable.
    2012  */
    2013 STDMETHODIMP Display::COMGETTER(Height) (ULONG *height)
    2014 {
    2015     CheckComArgNotNull(height);
    2016 
    2017     AutoCaller autoCaller(this);
    2018     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    2019 
    2020     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    2021 
    2022     CHECK_CONSOLE_DRV (mpDrv);
    2023 
    2024     *height = mpDrv->IConnector.cy;
    2025 
    2026     return S_OK;
    2027 }
    2028 
    2029 /**
    2030  * Returns the current display color depth in bits
    2031  *
    2032  * @returns COM status code
    2033  * @param bitsPerPixel Address of result variable.
    2034  */
    2035 STDMETHODIMP Display::COMGETTER(BitsPerPixel) (ULONG *bitsPerPixel)
    2036 {
    2037     if (!bitsPerPixel)
    2038         return E_INVALIDARG;
    2039 
    2040     AutoCaller autoCaller(this);
    2041     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    2042 
    2043     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    2044 
    2045     CHECK_CONSOLE_DRV (mpDrv);
    2046 
    2047     uint32_t cBits = 0;
    2048     int rc = mpDrv->pUpPort->pfnQueryColorDepth(mpDrv->pUpPort, &cBits);
    2049     AssertRC(rc);
    2050     *bitsPerPixel = cBits;
    2051 
    2052     return S_OK;
    2053 }
    2054 
    2055 
    2056 // IDisplay methods
    2057 /////////////////////////////////////////////////////////////////////////////
    20582028
    20592029STDMETHODIMP Display::SetFramebuffer (ULONG aScreenId,
     
    22782248}
    22792249
    2280 STDMETHODIMP Display::TakeScreenShot (BYTE *address, ULONG width, ULONG height)
     2250STDMETHODIMP Display::TakeScreenShot (ULONG aScreenId, BYTE *address, ULONG width, ULONG height)
    22812251{
    22822252    /// @todo (r=dmik) this function may take too long to complete if the VM
     
    23332303}
    23342304
    2335 STDMETHODIMP Display::TakeScreenShotSlow (ULONG width, ULONG height,
     2305STDMETHODIMP Display::TakeScreenShotToArray (ULONG aScreenId, ULONG width, ULONG height,
    23362306                                          ComSafeArrayOut(BYTE, aScreenData))
    23372307{
     
    24202390#endif /* VBOX_WITH_OLD_VBVA_LOCK */
    24212391
    2422 STDMETHODIMP Display::DrawToScreen (BYTE *address, ULONG x, ULONG y,
     2392STDMETHODIMP Display::DrawToScreen (ULONG aScreenId, BYTE *address, ULONG x, ULONG y,
    24232393                                    ULONG width, ULONG height)
    24242394{
     
    25702540        ResizeStatus_UpdateDisplayData, ResizeStatus_InProgress);
    25712541    AssertRelease(f);NOREF(f);
    2572 
    2573     return S_OK;
    2574 }
    2575 
    2576 /**
    2577  * Notification that the framebuffer has completed the
    2578  * asynchronous update processing
    2579  *
    2580  * @returns COM status code
    2581  */
    2582 STDMETHODIMP Display::UpdateCompleted()
    2583 {
    2584     LogFlowFunc (("\n"));
    2585 
    2586     /// @todo (dmik) can we AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); here?
    2587     //  do it when we switch this class to VirtualBoxBase_NEXT.
    2588     //  Tthis will require general code review and may add some details.
    2589     //  In particular, we may want to check whether EMT is really waiting for
    2590     //  this notification, etc. It might be also good to obey the caller to make
    2591     //  sure this method is not called from more than one thread at a time
    2592     //  (and therefore don't use Display lock at all here to save some
    2593     //  milliseconds).
    2594     AutoCaller autoCaller(this);
    2595     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    2596 
    2597     /* this is only valid for external framebuffers */
    2598     if (maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer == NULL)
    2599         return setError(VBOX_E_NOT_SUPPORTED,
    2600                         tr("Resize completed notification is valid only for external framebuffers"));
    26012542
    26022543    return S_OK;
  • trunk/src/VBox/Main/MouseImpl.cpp

    r27607 r28215  
    409409
    410410    ULONG displayWidth;
    411     HRESULT rc = pDisplay->COMGETTER(Width)(&displayWidth);
     411    HRESULT rc = pDisplay->GetScreenResolution (0, &displayWidth, NULL, NULL);
    412412    if (FAILED(rc)) return rc;
    413413
     
    429429
    430430    ULONG displayHeight;
    431     HRESULT rc = pDisplay->COMGETTER(Height)(&displayHeight);
     431    HRESULT rc = pDisplay->GetScreenResolution (0, NULL, &displayHeight, NULL);
    432432    if (FAILED(rc)) return rc;
    433433
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r28205 r28215  
    1131411314  <interface
    1131511315     name="IDisplay" extends="$unknown"
    11316      uuid="e2a38ebc-d854-4a3e-bc2e-fdf5ac4a0000"
     11316     uuid="1fa79e39-0cc9-4ab3-9df3-ed3e96b42496"
    1131711317     wsmap="managed"
    1131811318     >
     
    1132811328      the host computer or an RDP session's display on a remote computer.
    1132911329    </desc>
    11330     <attribute name="width" type="unsigned long" readonly="yes">
    11331       <desc>Current display width.</desc>
    11332     </attribute>
    11333 
    11334     <attribute name="height" type="unsigned long" readonly="yes">
    11335       <desc>Current display height.</desc>
    11336     </attribute>
    11337 
    11338     <attribute name="bitsPerPixel" type="unsigned long" readonly="yes">
    11339       <desc>
    11340         Current guest display color depth. Note that this may differ
    11341         from <link to="IFramebuffer::bitsPerPixel"/>.
    11342       </desc>
    11343     </attribute>
     11330    <method name="getScreenResolution">
     11331      <desc>Queries display width, height and color depth for given screen.</desc>
     11332      <param name="screenId" type="unsigned long" dir="in"/>
     11333      <param name="width" type="unsigned long" dir="out"/>
     11334      <param name="height" type="unsigned long" dir="out"/>
     11335      <param name="bitsPerPixel" type="unsigned long" dir="out"/>
     11336    </method>
    1134411337
    1134511338    <method name="setFramebuffer">
     
    1142211415
    1142311416      </desc>
     11417      <param name="screenId" type="unsigned long" dir="in"/>
    1142411418      <param name="address" type="octet" mod="ptr" dir="in"/>
    1142511419      <param name="width" type="unsigned long" dir="in"/>
     
    1142711421    </method>
    1142811422
    11429     <method name="takeScreenShotSlow">
     11423    <method name="takeScreenShotToArray">
    1143011424      <desc>
    1143111425        Takes a guest screen shot of the requested size and returns it as
     
    1144411438        </result>
    1144511439      </desc>
     11440      <param name="screenId" type="unsigned long" dir="in"/>
    1144611441      <param name="width" type="unsigned long" dir="in">
    1144711442        <desc>
     
    1147411469
    1147511470      </desc>
     11471      <param name="screenId" type="unsigned long" dir="in"/>
    1147611472      <param name="address" type="octet" mod="ptr" dir="in"/>
    1147711473      <param name="x" type="unsigned long" dir="in"/>
     
    1150311499      </desc>
    1150411500      <param name="screenId" type="unsigned long" dir="in"/>
    11505     </method>
    11506 
    11507     <method name="updateCompleted">
    11508       <desc>
    11509         Signals that a framebuffer has completed the update operation.
    11510 
    11511         <result name="VBOX_E_NOT_SUPPORTED">
    11512           Operation only valid for external frame buffers.
    11513         </result>
    11514 
    11515       </desc>
    1151611501    </method>
    1151711502
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r27751 r28215  
    246246    }
    247247
    248     // IDisplay properties
    249     STDMETHOD(COMGETTER(Width)) (ULONG *width);
    250     STDMETHOD(COMGETTER(Height)) (ULONG *height);
    251     STDMETHOD(COMGETTER(BitsPerPixel)) (ULONG *bitsPerPixel);
    252 
    253248    // IDisplay methods
     249    STDMETHOD(GetScreenResolution)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel);
    254250    STDMETHOD(SetFramebuffer)(ULONG aScreenId, IFramebuffer *aFramebuffer);
    255251    STDMETHOD(GetFramebuffer)(ULONG aScreenId, IFramebuffer **aFramebuffer, LONG *aXOrigin, LONG *aYOrigin);
    256252    STDMETHOD(SetVideoModeHint)(ULONG width, ULONG height, ULONG bitsPerPixel, ULONG display);
    257     STDMETHOD(TakeScreenShot)(BYTE *address, ULONG width, ULONG height);
    258     STDMETHOD(TakeScreenShotSlow)(ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
    259     STDMETHOD(DrawToScreen)(BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
     253    STDMETHOD(TakeScreenShot)(ULONG aScreenId, BYTE *address, ULONG width, ULONG height);
     254    STDMETHOD(TakeScreenShotToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
     255    STDMETHOD(DrawToScreen)(ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
    260256    STDMETHOD(InvalidateAndUpdate)();
    261257    STDMETHOD(ResizeCompleted)(ULONG aScreenId);
    262     STDMETHOD(UpdateCompleted)();
    263258    STDMETHOD(SetSeamlessMode)(BOOL enabled);
    264259
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