third_party/virtualbox/src/VBox/Main/src-client/DisplayImpl.cpp
/**
 * Save thumbnail and screenshot of the guest screen.
 */
Save thumbnail and screenshot of the guest screen.
Save thumbnail and screenshot of the guest screen .
static int displayMakeThumbnail(uint8_t *pbData, uint32_t cx, uint32_t cy,
                                uint8_t **ppu8Thumbnail, uint32_t *pcbThumbnail, uint32_t *pcxThumbnail, uint32_t *pcyThumbnail)
{
    int rc = VINF_SUCCESS;
    uint8_t *pu8Thumbnail = NULL;
    uint32_t cbThumbnail = 0;
    uint32_t cxThumbnail = 0;
    uint32_t cyThumbnail = 0;
    if (cx > cy)
    {
        cxThumbnail = kMaxSizeThumbnail;
        cyThumbnail = (kMaxSizeThumbnail * cy) / cx;
    }
    else
    {
        cyThumbnail = kMaxSizeThumbnail;
        cxThumbnail = (kMaxSizeThumbnail * cx) / cy;
    }
    LogRelFlowFunc(("%dx%d -> %dx%d\n", cx, cy, cxThumbnail, cyThumbnail));
    cbThumbnail = cxThumbnail * 4 * cyThumbnail;
    pu8Thumbnail = (uint8_t *)RTMemAlloc(cbThumbnail);
    if (pu8Thumbnail)
    {
        uint8_t *dst = pu8Thumbnail;
        uint8_t *src = pbData;
        int dstW = cxThumbnail;
        int dstH = cyThumbnail;
        int srcW = cx;
        int srcH = cy;
        int iDeltaLine = cx * 4;
        BitmapScale32(dst,
                      dstW, dstH,
                      src,
                      iDeltaLine,
                      srcW, srcH);
        *ppu8Thumbnail = pu8Thumbnail;
        *pcbThumbnail = cbThumbnail;
        *pcxThumbnail = cxThumbnail;
        *pcyThumbnail = cyThumbnail;
    }
    else
    {
        rc = VERR_NO_MEMORY;
    }
    return rc;
}
static int displayMakeThumbnail ( uint8_t * pbData , uint32_t cx , uint32_t cy , uint8_t * * ppu8Thumbnail , uint32_t * pcbThumbnail , uint32_t * pcxThumbnail , uint32_t * pcyThumbnail ) { int rc = VINF_SUCCESS ; uint8_t * pu8Thumbnail = NULL ; uint32_t cbThumbnail = 0 ; uint32_t cxThumbnail = 0 ; uint32_t cyThumbnail = 0 ; if ( cx > cy ) { cxThumbnail = kMaxSizeThumbnail ; cyThumbnail = ( kMaxSizeThumbnail * cy ) / cx ; } else { cyThumbnail = kMaxSizeThumbnail ; cxThumbnail = ( kMaxSizeThumbnail * cx ) / cy ; } LogRelFlowFunc ( ( " \n " , cx , cy , cxThumbnail , cyThumbnail ) ) ; cbThumbnail = cxThumbnail * 4 * cyThumbnail ; pu8Thumbnail = ( uint8_t * ) RTMemAlloc ( cbThumbnail ) ; if ( pu8Thumbnail ) { uint8_t * dst = pu8Thumbnail ; uint8_t * src = pbData ; int dstW = cxThumbnail ; int dstH = cyThumbnail ; int srcW = cx ; int srcH = cy ; int iDeltaLine = cx * 4 ; BitmapScale32 ( dst , dstW , dstH , src , iDeltaLine , srcW , srcH ) ; * ppu8Thumbnail = pu8Thumbnail ; * pcbThumbnail = cbThumbnail ; * pcxThumbnail = cxThumbnail ; * pcyThumbnail = cyThumbnail ; } else { rc = VERR_NO_MEMORY ; } return rc ; }
Save thumbnail and screenshot of the guest screen.
Save thumbnail and screenshot of the guest screen .