VirtualBox

Changeset 22868 in vbox


Ignore:
Timestamp:
Sep 9, 2009 3:36:19 PM (15 years ago)
Author:
vboxsync
Message:

Windows guest display driver: fixed incorrect creation of the screen bitmap and surface in DrvEnableSurface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/enable.c

    r22481 r22868  
    759759    ppdev->ulBitmapType = ulBitmapType;
    760760#else
    761     hsurf = (HSURF) EngCreateBitmap(sizl,
    762                                     ppdev->lDeltaScreen,
    763                                     ulBitmapType,
    764                                     (ppdev->lDeltaScreen > 0) ? BMF_TOPDOWN : 0,
    765                                     (PVOID) (ppdev->pjScreen));
    766 
    767     if (hsurf == (HSURF) 0)
    768     {
    769         DISPDBG((0, "DISP DrvEnableSurface failed EngCreateBitmap\n"));
     761    /* Create a GDI bitmap which will be used to draw with Eng* functions. */
     762    ppdev->hsurfScreenBitmap = (HSURF)EngCreateBitmap(sizl,
     763                                                      ppdev->lDeltaScreen,
     764                                                      ulBitmapType,
     765                                                      (ppdev->lDeltaScreen > 0) ? BMF_TOPDOWN : 0,
     766                                                      (PVOID) (ppdev->pjScreen));
     767
     768    if (ppdev->hsurfScreenBitmap == (HSURF) 0)
     769    {
     770        DISPDBG((0, "DISP DrvEnableSurface failed EngCreateBitmap ppdev->hsurfScreenBitmap\n"));
    770771        goto l_Failure;
    771772    }
    772773    else
    773774    {
    774         ppdev->hsurfScreenBitmap = hsurf;
    775 
    776         if (!EngAssociateSurface(hsurf, ppdev->hdevEng, 0))
    777         {
    778             DISPDBG((0, "DISP DrvEnableSurface failed EngAssociateSurface for ScreenBitmap.\n"));
     775        /* Get the GDI bitmap SURFOBJ, which will be passed to Eng*. */
     776        ppdev->psoScreenBitmap = EngLockSurface(ppdev->hsurfScreenBitmap);
     777
     778        /* Create device managed surface, which will represent screen for GDI. */
     779        ppdev->hsurfScreen = (HSURF)EngCreateDeviceSurface((DHSURF)ppdev, /* Handle assigned by the device. */
     780                                                           sizl,
     781                                                           ulBitmapType);
     782
     783        if (ppdev->hsurfScreen == (HSURF) 0)
     784        {
     785            DISPDBG((0, "DISP DrvEnableSurface failed EngCreateDeviceSurface ppdev->hsurfScreen\n"));
    779786            goto l_Failure;
    780787        }
    781788        else
    782789        {
    783             SURFOBJ *pso = EngLockSurface(hsurf);
    784 
    785             ppdev->psoScreenBitmap = pso;
    786 
    787             hsurf = (HSURF) EngCreateDeviceSurface((DHSURF)pso,
    788                                                     sizl,
    789                                                     ulBitmapType);
    790 
    791             if (hsurf == (HSURF) 0)
    792             {
    793                 DISPDBG((0, "DISP DrvEnableSurface failed EngCreateDeviceSurface\n"));
     790            /* Tell GDI that the driver will handle drawing operations on the screen surface. */
     791            if (!EngAssociateSurface(ppdev->hsurfScreen, ppdev->hdevEng, flHooks))
     792            {
     793                DISPDBG((0, "DISP DrvEnableSurface failed EngAssociateSurface for Screen.\n"));
    794794                goto l_Failure;
    795795            }
    796796            else
    797797            {
    798                 ppdev->hsurfScreen = hsurf;
    799                 /* Must set dhsurf to make sure GDI doesn't ignore our hooks */
    800                 ppdev->psoScreenBitmap->dhsurf = (DHSURF)hsurf;
    801 
    802                 if (!EngAssociateSurface(hsurf, ppdev->hdevEng, flHooks))
    803                 {
    804                     DISPDBG((0, "DISP DrvEnableSurface failed EngAssociateSurface for Screen.\n"));
    805                     goto l_Failure;
    806                 }
    807                 else
    808                 {
    809                     ppdev->flHooks = flHooks;
    810                     ppdev->ulBitmapType = ulBitmapType;
    811                 }
     798                ppdev->flHooks = flHooks;
     799                ppdev->ulBitmapType = ulBitmapType;
     800
     801                DISPDBG((0, "DISP DrvEnableSurface success ppdev %p, ppdev->hsurfScreen %p\n", ppdev, ppdev->hsurfScreen));
    812802            }
    813803        }
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