VirtualBox

Ignore:
Timestamp:
Jun 8, 2011 3:09:14 PM (14 years ago)
Author:
vboxsync
Message:

1 million rectangles ought to be enough for anybody...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/xpdm/VBoxDispDriver.cpp

    r37335 r37384  
    135135{
    136136    ULONG cnt=0;
    137        
     137
    138138    while (*pwcs!=*L"")
    139139    {
     
    181181        memset(_font.lfFaceName, 0, sizeof(_font.lfFaceName));                       \
    182182        memcpy(_font.lfFaceName, _name, sizeof(_name));                              \
    183     } while (0)                                                                   
     183    } while (0)
    184184
    185185static int VBoxDispInitDevice(PVBOXDISPDEV pDev, DEVMODEW *pdm, GDIINFO *pGdiInfo, DEVINFO *pDevInfo)
     
    286286    pGdiInfo->ulNumPalReg = (pDev->mode.ulBitsPerPel==8) ? (1<<pDev->mode.ulBitsPerPel) : 0;
    287287
    288     /* @todo: might want to implement IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES in miniport driver 
     288    /* @todo: might want to implement IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES in miniport driver
    289289     *        and query host for this info there
    290290     */
     
    343343    pDevInfo->flGraphicsCaps |= GCAPS_DIRECTDRAW;
    344344#endif
    345     VBOXDISPMAKELOGFONTW(pDevInfo->lfDefaultFont, 
     345    VBOXDISPMAKELOGFONTW(pDevInfo->lfDefaultFont,
    346346                         16, 7, FW_BOLD, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, VARIABLE_PITCH, L"System");
    347347
     
    383383
    384384    LOGF_LEAVE();
    385     return rc;   
     385    return rc;
    386386}
    387387
     
    442442}
    443443
    444 /* Returns video modes supported by our device/driver 
     444/* Returns video modes supported by our device/driver
    445445 * Note: If we fail here we'd be asked to enter 800x600@4bpp mode later in VBoxDispDrvEnablePDEV.
    446446 */
     
    492492 * Returns pointer to our driver private info structure which would be passed by GDI to our other callbacks.
    493493 */
    494 DHPDEV APIENTRY 
     494DHPDEV APIENTRY
    495495VBoxDispDrvEnablePDEV(DEVMODEW *pdm, LPWSTR pwszLogAddress, ULONG cPat, HSURF *phsurfPatterns,
    496496                      ULONG cjCaps, ULONG *pdevcaps,
     
    671671    size.cy = pDev->mode.ulHeight;
    672672
    673     pDev->surface.hBitmap = EngCreateBitmap(size, pDev->mode.lScanlineStride, iFormat, 
     673    pDev->surface.hBitmap = EngCreateBitmap(size, pDev->mode.lScanlineStride, iFormat,
    674674                                            pDev->mode.lScanlineStride>0 ? BMF_TOPDOWN:0,
    675675                                            pDev->memInfo.FrameBufferBase);
     
    938938            LOGF(("VBOXESC_SETVISIBLEREGION"));
    939939            LPRGNDATA lpRgnData = (LPRGNDATA)pvIn;
    940 
    941             if (cjIn >= sizeof(RGNDATAHEADER)
     940            DWORD cRects;
     941
     942            if (    cjIn >= sizeof(RGNDATAHEADER)
    942943                &&  pvIn
    943944                &&  lpRgnData->rdh.dwSize == sizeof(RGNDATAHEADER)
    944945                &&  lpRgnData->rdh.iType  == RDH_RECTANGLES
    945                 &&  cjIn == ((uint64_t)lpRgnData->rdh.nCount) * sizeof(RECT) + sizeof(RGNDATAHEADER))
    946             {
     946                &&  (cRects = lpRgnData->rdh.nCount) <= _1M
     947                &&  cjIn == cRects * (uint64_t)sizeof(RECT) + sizeof(RGNDATAHEADER))
     948            {
     949                /** @todo this whole conversion thing could maybe be skipped
     950                 *        since RTRECT matches the RECT layout. */
     951#if 0
     952                AssertCompile(sizeof(RTRECT) == sizeof(RECT));
     953                AssertCompileMembersSameSizeAndOffset(RTRECT, xLeft,    RECT, left);
     954                AssertCompileMembersSameSizeAndOffset(RTRECT, xBottom,  RECT, bottom);
     955                AssertCompileMembersSameSizeAndOffset(RTRECT, xRight,   RECT, right);
     956                AssertCompileMembersSameSizeAndOffset(RTRECT, xTop,     RECT, top);
     957
     958                rc = VBoxDispMPSetVisibleRegion(pDev->hDriver, (PRTRECT)&lpRgnData->Buffer[0], cRects);
     959                VBOX_WARNRC(rc);
     960#else
    947961                DWORD   i;
    948962                PRTRECT pRTRect;
     
    950964                RECT   *pRect = (RECT *)&lpRgnData->Buffer;
    951965
    952                 pRTRect = (PRTRECT) EngAllocMem(0, lpRgnData->rdh.nCount*sizeof(RTRECT), MEM_ALLOC_TAG);
     966                pRTRect = (PRTRECT) EngAllocMem(0, cRects*sizeof(RTRECT), MEM_ALLOC_TAG);
    953967                if (!pRTRect)
    954968                {
    955                     WARN(("failed to allocate %d bytes", lpRgnData->rdh.nCount*sizeof(RTRECT)));
     969                    WARN(("failed to allocate %d bytes", cRects*sizeof(RTRECT)));
    956970                    break;
    957971                }
    958972
    959                 for (i=0; i<lpRgnData->rdh.nCount; ++i)
     973                for (i = 0; i < cRects; ++i)
    960974                {
    961975                    LOG(("New visible rectangle (%d,%d) (%d,%d)",
     
    967981                }
    968982
    969                 rc = VBoxDispMPSetVisibleRegion(pDev->hDriver, pRTRect, lpRgnData->rdh.nCount);
     983                rc = VBoxDispMPSetVisibleRegion(pDev->hDriver, pRTRect, cRects);
    970984                VBOX_WARNRC(rc);
    971985
    972986                EngFreeMem(pRTRect);
    973987
     988#endif
    974989                if (RT_SUCCESS(rc))
    975990                {
     
    983998                {
    984999                    WARN(("check failed rdh.dwSize=%x iType=%d size=%d expected size=%d",
    985                           lpRgnData->rdh.dwSize, lpRgnData->rdh.iType, cjIn, 
     1000                          lpRgnData->rdh.dwSize, lpRgnData->rdh.iType, cjIn,
    9861001                          lpRgnData->rdh.nCount * sizeof(RECT) + sizeof(RGNDATAHEADER)));
    9871002                }
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