VirtualBox

Changeset 55854 in vbox


Ignore:
Timestamp:
May 13, 2015 2:40:26 PM (9 years ago)
Author:
vboxsync
Message:

Main: saved screenshot API cleanup.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/SDKRef.xml

    r55800 r55854  
    41944194          <computeroutput>bitmapFormat</computeroutput>. As a consequence of this,
    41954195          IMachine::ReadSavedThumbnailPNGToArray() has been removed.
     4196        </para></listitem>
     4197
     4198        <listitem><para>
     4199          IMachine::QuerySavedScreenshotPNGSize() has been renamed to
     4200          IMachine::QuerySavedScreenshotInfo() which also returns
     4201          an array of available screenshot formats.
     4202        </para></listitem>
     4203
     4204        <listitem><para>
     4205          IMachine::ReadSavedScreenshotPNGToArray() has been renamed to
     4206          IMachine::ReadSavedScreenshotToArray() which  has a new parameter
     4207          <computeroutput>bitmapFormat</computeroutput>.
     4208        </para></listitem>
     4209
     4210        <listitem><para>
     4211          IMachine::QuerySavedThumbnailSize() has been removed.
    41964212        </para></listitem>
    41974213
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.cpp

    r52958 r55854  
    7676    QVector <BYTE> thumbData = machine.ReadSavedThumbnailToArray (0, KBitmapFormat_BGR0, width, height);
    7777    mThumbnail = thumbData.size() != 0 ? QPixmap::fromImage (QImage (thumbData.data(), width, height, QImage::Format_RGB32).copy()) : QPixmap();
    78     QVector <BYTE> screenData = machine.ReadSavedScreenshotPNGToArray (0, width, height);
     78    QVector <BYTE> screenData = machine.ReadSavedScreenshotToArray (0, KBitmapFormat_PNG, width, height);
    7979    mScreenshot = screenData.size() != 0 ? QPixmap::fromImage (QImage::fromData (screenData.data(), screenData.size(), "PNG")) : QPixmap();
    8080
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r55845 r55854  
    647647        /* If there is a preview image saved,
    648648         * we will resize the framebuffer to the size of that image: */
    649         ULONG uBuffer = 0, uWidth = 0, uHeight = 0;
    650         machine().QuerySavedScreenshotPNGSize(0, uBuffer, uWidth, uHeight);
    651         if (uBuffer > 0)
     649        ULONG uWidth = 0, uHeight = 0;
     650        QVector<KBitmapFormat> formats = machine().QuerySavedScreenshotInfo(0, uWidth, uHeight);
     651        if (formats.size() > 0)
    652652        {
    653653            /* Init with the screenshot size: */
     
    10301030    /* Acquire the screen-data from the saved-state: */
    10311031    ULONG uWidth = 0, uHeight = 0;
    1032     const QVector<BYTE> screenData = machine().ReadSavedScreenshotPNGToArray(0, uWidth, uHeight);
     1032    const QVector<BYTE> screenData = machine().ReadSavedScreenshotToArray(0, KBitmapFormat_PNG, uWidth, uHeight);
    10331033
    10341034    /* Make sure there is saved-state screen-data: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp

    r55819 r55854  
    207207                    /* Use the screenshot from saved-state if possible: */
    208208                    ULONG uGuestWidth = 0, uGuestHeight = 0;
    209                     QVector<BYTE> screenData = m_machine.ReadSavedScreenshotPNGToArray(0, uGuestWidth, uGuestHeight);
     209                    QVector<BYTE> screenData = m_machine.ReadSavedScreenshotToArray(0, KBitmapFormat_PNG, uGuestWidth, uGuestHeight);
    210210
    211211                    /* Make sure screen-data is OK: */
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r55807 r55854  
    41704170  <interface
    41714171    name="IMachine" extends="$unknown"
    4172     uuid="77a44043-a68a-4ef9-ac26-e9567b1e6bbc"
     4172    uuid="feb138aa-dbce-4a89-8ec0-380fc7ec4913"
    41734173    wsmap="managed"
    41744174    wrap-hint-server-addinterfaces="IInternalMachineControl"
     
    70377037    </method>
    70387038
    7039     <method name="querySavedThumbnailSize">
    7040       <desc>
    7041         Returns size in bytes and dimensions in pixels of a saved thumbnail bitmap from saved state.
     7039    <method name="readSavedThumbnailToArray">
     7040      <desc>
     7041        Thumbnail is retrieved to an array of bytes in the requested format.
    70427042      </desc>
    70437043      <param name="screenId" type="unsigned long" dir="in">
    70447044        <desc>
     7045          Saved guest screen to read from.
     7046        </desc>
     7047      </param>
     7048      <param name="bitmapFormat" type="BitmapFormat" dir="in">
     7049        <desc>
     7050          The requested format.
     7051        </desc>
     7052      </param>
     7053      <param name="width" type="unsigned long" dir="out">
     7054        <desc>
     7055          Bitmap width.
     7056        </desc>
     7057      </param>
     7058      <param name="height" type="unsigned long" dir="out">
     7059        <desc>
     7060          Bitmap height.
     7061        </desc>
     7062      </param>
     7063      <param name="data" type="octet" safearray="yes" dir="return">
     7064        <desc>
     7065          Array with resulting bitmap data.
     7066        </desc>
     7067      </param>
     7068    </method>
     7069
     7070    <method name="querySavedScreenshotInfo">
     7071      <desc>
     7072        Returns available formats and size of the screenshot from saved state.
     7073      </desc>
     7074      <param name="screenId" type="unsigned long" dir="in">
     7075        <desc>
    70457076          Saved guest screen to query info from.
    70467077        </desc>
    70477078      </param>
    7048       <param name="size" type="unsigned long" dir="out">
    7049         <desc>
    7050           Size of buffer required to store the bitmap.
    7051         </desc>
    7052       </param>
    70537079      <param name="width" type="unsigned long" dir="out">
    70547080        <desc>
    7055           Bitmap width.
     7081          Image width.
    70567082        </desc>
    70577083      </param>
    70587084      <param name="height" type="unsigned long" dir="out">
    70597085        <desc>
    7060           Bitmap height.
    7061         </desc>
    7062       </param>
    7063     </method>
    7064 
    7065     <method name="readSavedThumbnailToArray">
    7066       <desc>
    7067         Thumbnail is retrieved to an array of bytes in the requested format.
     7086          Image height.
     7087        </desc>
     7088      </param>
     7089      <param name="bitmapFormats" type="BitmapFormat" safearray="yes" dir="return">
     7090        <desc>
     7091          Formats supported by readSavedScreenshotToArray.
     7092        </desc>
     7093      </param>
     7094    </method>
     7095
     7096    <method name="readSavedScreenshotToArray">
     7097      <desc>
     7098        Screenshot in requested format is retrieved to an array of bytes.
    70687099      </desc>
    70697100      <param name="screenId" type="unsigned long" dir="in">
     
    70797110      <param name="width" type="unsigned long" dir="out">
    70807111        <desc>
    7081           Bitmap width.
     7112          Image width.
    70827113        </desc>
    70837114      </param>
    70847115      <param name="height" type="unsigned long" dir="out">
    70857116        <desc>
    7086           Bitmap height.
    7087         </desc>
    7088       </param>
    7089       <param name="data" type="octet" safearray="yes" dir="return">
    7090         <desc>
    7091           Array with resulting bitmap data.
    7092         </desc>
    7093       </param>
    7094     </method>
    7095 
    7096     <method name="querySavedScreenshotPNGSize">
    7097       <desc>
    7098         Returns size in bytes and dimensions of a saved PNG image of screenshot from saved state.
    7099       </desc>
    7100       <param name="screenId" type="unsigned long" dir="in">
    7101         <desc>
    7102           Saved guest screen to query info from.
    7103         </desc>
    7104       </param>
    7105       <param name="size" type="unsigned long" dir="out">
    7106         <desc>
    7107           Size of buffer required to store the PNG binary data.
    7108         </desc>
    7109       </param>
    7110       <param name="width" type="unsigned long" dir="out">
    7111         <desc>
    7112           Image width.
    7113         </desc>
    7114       </param>
    7115       <param name="height" type="unsigned long" dir="out">
    7116         <desc>
    71177117          Image height.
    71187118        </desc>
    71197119      </param>
    7120     </method>
    7121 
    7122     <method name="readSavedScreenshotPNGToArray">
    7123       <desc>
    7124         Screenshot in PNG format is retrieved to an array of bytes.
    7125       </desc>
    7126       <param name="screenId" type="unsigned long" dir="in">
    7127         <desc>
    7128           Saved guest screen to read from.
    7129         </desc>
    7130       </param>
    7131       <param name="width" type="unsigned long" dir="out">
    7132         <desc>
    7133           Image width.
    7134         </desc>
    7135       </param>
    7136       <param name="height" type="unsigned long" dir="out">
    7137         <desc>
    7138           Image height.
    7139         </desc>
    7140       </param>
    71417120      <param name="data" type="octet" dir="return" safearray="yes">
    71427121        <desc>
    7143           Array with resulting PNG data.
     7122          Array with resulting image data.
    71447123        </desc>
    71457124      </param>
  • trunk/src/VBox/Main/include/MachineImpl.h

    r55807 r55854  
    11571157                                      ULONG *aHeight,
    11581158                                      BOOL *aEnabled);
    1159     HRESULT querySavedThumbnailSize(ULONG aScreenId,
    1160                                     ULONG *aSize,
    1161                                     ULONG *aWidth,
    1162                                     ULONG *aHeight);
    11631159    HRESULT readSavedThumbnailToArray(ULONG aScreenId,
    11641160                                      BitmapFormat_T aBitmapFormat,
     
    11661162                                      ULONG *aHeight,
    11671163                                      std::vector<BYTE> &aData);
    1168     HRESULT querySavedScreenshotPNGSize(ULONG aScreenId,
    1169                                         ULONG *aSize,
    1170                                         ULONG *aWidth,
    1171                                         ULONG *aHeight);
    1172     HRESULT readSavedScreenshotPNGToArray(ULONG aScreenId,
    1173                                           ULONG *aWidth,
    1174                                           ULONG *aHeight,
    1175                                           std::vector<BYTE> &aData);
     1164    HRESULT querySavedScreenshotInfo(ULONG aScreenId,
     1165                                     ULONG *aWidth,
     1166                                     ULONG *aHeight,
     1167                                     std::vector<BitmapFormat_T> &aBitmapFormats);
     1168    HRESULT readSavedScreenshotToArray(ULONG aScreenId,
     1169                                       BitmapFormat_T aBitmapFormat,
     1170                                       ULONG *aWidth,
     1171                                       ULONG *aHeight,
     1172                                       std::vector<BYTE> &aData);
     1173
    11761174    HRESULT hotPlugCPU(ULONG aCpu);
    11771175    HRESULT hotUnplugCPU(ULONG aCpu);
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r55835 r55854  
    63706370}
    63716371
    6372 HRESULT Machine::querySavedThumbnailSize(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight)
    6373 {
    6374     if (aScreenId != 0)
    6375         return E_NOTIMPL;
    6376 
    6377     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    6378 
    6379     uint8_t *pu8Data = NULL;
    6380     uint32_t cbData = 0;
    6381     uint32_t u32Width = 0;
    6382     uint32_t u32Height = 0;
    6383 
    6384     int vrc = readSavedDisplayScreenshot(mSSData->strStateFilePath, 0 /* u32Type */, &pu8Data, &cbData, &u32Width, &u32Height);
    6385 
    6386     if (RT_FAILURE(vrc))
    6387         return setError(VBOX_E_IPRT_ERROR,
    6388                         tr("Saved screenshot data is not available (%Rrc)"),
    6389                         vrc);
    6390 
    6391     *aSize = cbData;
    6392     *aWidth = u32Width;
    6393     *aHeight = u32Height;
    6394 
    6395     freeSavedDisplayScreenshot(pu8Data);
    6396 
    6397     return S_OK;
    6398 }
    6399 
    64006372HRESULT Machine::readSavedThumbnailToArray(ULONG aScreenId, BitmapFormat_T aBitmapFormat,
    64016373                                           ULONG *aWidth, ULONG *aHeight, std::vector<BYTE> &aData)
     
    64926464}
    64936465
    6494 HRESULT Machine::querySavedScreenshotPNGSize(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight)
     6466HRESULT Machine::querySavedScreenshotInfo(ULONG aScreenId,
     6467                                          ULONG *aWidth,
     6468                                          ULONG *aHeight,
     6469                                          std::vector<BitmapFormat_T> &aBitmapFormats)
    64956470{
    64966471    if (aScreenId != 0)
     
    65116486                        vrc);
    65126487
    6513     *aSize = cbData;
    65146488    *aWidth = u32Width;
    65156489    *aHeight = u32Height;
     6490    aBitmapFormats.resize(1);
     6491    aBitmapFormats[0] = BitmapFormat_PNG;
    65166492
    65176493    freeSavedDisplayScreenshot(pu8Data);
     
    65206496}
    65216497
    6522 HRESULT Machine::readSavedScreenshotPNGToArray(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, std::vector<BYTE> &aData)
     6498HRESULT Machine::readSavedScreenshotToArray(ULONG aScreenId,
     6499                                            BitmapFormat_T aBitmapFormat,
     6500                                            ULONG *aWidth,
     6501                                            ULONG *aHeight,
     6502                                            std::vector<BYTE> &aData)
    65236503{
    65246504    if (aScreenId != 0)
     6505        return E_NOTIMPL;
     6506
     6507    if (aBitmapFormat != BitmapFormat_PNG)
    65256508        return E_NOTIMPL;
    65266509
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