rename Pdev to hPDev in GDIDEVICE struct

fixed bug in DxEngGetDCState

svn path=/trunk/; revision=31530
This commit is contained in:
Magnus Olsen 2008-01-01 01:08:07 +00:00
parent 615d3af648
commit 7ef202bdd6
6 changed files with 41 additions and 36 deletions

View file

@ -84,7 +84,7 @@ EngCreateDriverObj(
DrvObjUser->pvObj = pvObj;
DrvObjUser->pFreeProc = pFreeObjProc;
DrvObjUser->hdev = hdev;
DrvObjUser->dhpdev = ((GDIDEVICE*)hdev)->PDev;
DrvObjUser->dhpdev = ((GDIDEVICE*)hdev)->hPDev;
/* fill internal object */
ExInitializeFastMutex(&DrvObjInt->Lock);

View file

@ -458,7 +458,7 @@ EngAssociateSurface(IN HSURF Surface,
/* Associate the hdev */
SurfObj->hdev = Dev;
SurfObj->dhpdev = Device->PDev;
SurfObj->dhpdev = Device->hPDev;
/* Hook up specified functions */
BitmapObj->flHooks = Hooks;

View file

@ -62,7 +62,7 @@ typedef struct _GDIDEVICE
PVOID pvGammaRamp;
DHPDEV PDev;
DHPDEV hPDev;
DEVMODEW DMW;
HSURF FillPatterns[HS_DDI_MAX];
DEVINFO DevInfo;

View file

@ -402,12 +402,18 @@ DWORD DxEngSetDCState(DWORD x1, DWORD x2, DWORD x3)
/************************************************************************/
/* DxEngGetDCState */
/************************************************************************/
/* Note type 0 = ? */
/* Note type 1 = ? */
/* Note type 2 = ? */
/* Note type 3 = Get Driver hdev */
DWORD
DxEngGetDCState(HDC hDC,
DWORD type)
{
PEDD_DIRECTDRAW_GLOBAL pEDDgpl = NULL;
PDC pDC = DC_LockDc(hDC);
DWORD retVal = 0;
if (pDC)
{
switch (type)
@ -421,17 +427,16 @@ DxEngGetDCState(HDC hDC,
case 3:
{
PGDIDEVICE GDIDevice = (PGDIDEVICE)pDC->pPDev;
pEDDgpl = GDIDevice->pEDDgpl;
DC_UnlockDc(pDC);
return (DWORD)pEDDgpl;
retVal = (DWORD)GDIDevice->hPDev;
}
default:
UNIMPLEMENTED;
break;
}
DC_UnlockDc(pDC);
}
return 0;
return retVal;
}
/************************************************************************/

View file

@ -460,7 +460,7 @@ IntPrepareDriver()
PrimarySurface.DMW.dmSize = sizeof (PrimarySurface.DMW);
if (SetupDevMode(&PrimarySurface.DMW, DisplayNumber))
{
PrimarySurface.PDev = PrimarySurface.DriverFunctions.EnablePDEV(
PrimarySurface.hPDev = PrimarySurface.DriverFunctions.EnablePDEV(
&PrimarySurface.DMW,
L"",
HS_DDI_MAX,
@ -472,7 +472,7 @@ IntPrepareDriver()
NULL,
L"",
(HANDLE) (PrimarySurface.VideoFileObject->DeviceObject));
DoDefault = (NULL == PrimarySurface.PDev);
DoDefault = (NULL == PrimarySurface.hPDev);
if (DoDefault)
{
DPRINT1("DrvEnablePDev with registry parameters failed\n");
@ -487,7 +487,7 @@ IntPrepareDriver()
{
RtlZeroMemory(&(PrimarySurface.DMW), sizeof(DEVMODEW));
PrimarySurface.DMW.dmSize = sizeof (PrimarySurface.DMW);
PrimarySurface.PDev = PrimarySurface.DriverFunctions.EnablePDEV(
PrimarySurface.hPDev = PrimarySurface.DriverFunctions.EnablePDEV(
&PrimarySurface.DMW,
L"",
HS_DDI_MAX,
@ -500,7 +500,7 @@ IntPrepareDriver()
L"",
(HANDLE) (PrimarySurface.VideoFileObject->DeviceObject));
if (NULL == PrimarySurface.PDev)
if (NULL == PrimarySurface.hPDev)
{
ObDereferenceObject(PrimarySurface.VideoFileObject);
DPRINT1("DrvEnablePDEV with default parameters failed\n");
@ -532,7 +532,7 @@ IntPrepareDriver()
/* Complete initialization of the physical device */
PrimarySurface.DriverFunctions.CompletePDEV(
PrimarySurface.PDev,
PrimarySurface.hPDev,
(HDEV)&PrimarySurface);
DPRINT("calling DRIVER_ReferenceDriver\n");
@ -635,17 +635,17 @@ IntCreatePrimarySurface()
DPRINT("calling EnableSurface\n");
/* Enable the drawing surface */
PrimarySurface.Handle =
PrimarySurface.DriverFunctions.EnableSurface(PrimarySurface.PDev);
PrimarySurface.DriverFunctions.EnableSurface(PrimarySurface.hPDev);
if (NULL == PrimarySurface.Handle)
{
/* PrimarySurface.DriverFunctions.AssertMode(PrimarySurface.PDev, FALSE);*/
PrimarySurface.DriverFunctions.DisablePDEV(PrimarySurface.PDev);
/* PrimarySurface.DriverFunctions.AssertMode(PrimarySurface.hPDev, FALSE);*/
PrimarySurface.DriverFunctions.DisablePDEV(PrimarySurface.hPDev);
ObDereferenceObject(PrimarySurface.VideoFileObject);
DPRINT1("DrvEnableSurface failed\n");
return FALSE;
}
PrimarySurface.DriverFunctions.AssertMode(PrimarySurface.PDev, TRUE);
PrimarySurface.DriverFunctions.AssertMode(PrimarySurface.hPDev, TRUE);
calledFromUser = UserIsEntered(); //fixme: possibly upgrade a shared lock
if (!calledFromUser){
@ -656,7 +656,7 @@ IntCreatePrimarySurface()
IntAttachMonitor(&PrimarySurface, PrimarySurface.DisplayNumber);
SurfObj = EngLockSurface((HSURF)PrimarySurface.Handle);
SurfObj->dhpdev = PrimarySurface.PDev;
SurfObj->dhpdev = PrimarySurface.hPDev;
SurfSize = SurfObj->sizlBitmap;
SurfaceRect.left = SurfaceRect.top = 0;
SurfaceRect.right = SurfObj->sizlBitmap.cx;
@ -703,9 +703,9 @@ IntDestroyPrimarySurface()
*/
DPRINT("Reseting display\n" );
PrimarySurface.DriverFunctions.AssertMode(PrimarySurface.PDev, FALSE);
PrimarySurface.DriverFunctions.DisableSurface(PrimarySurface.PDev);
PrimarySurface.DriverFunctions.DisablePDEV(PrimarySurface.PDev);
PrimarySurface.DriverFunctions.AssertMode(PrimarySurface.hPDev, FALSE);
PrimarySurface.DriverFunctions.DisableSurface(PrimarySurface.hPDev);
PrimarySurface.DriverFunctions.DisablePDEV(PrimarySurface.hPDev);
PrimarySurface.PreparedDriver = FALSE;
KeSetEvent(&VideoDriverNeedsPreparation, 1, FALSE);
KeResetEvent(&VideoDriverPrepared);
@ -793,12 +793,12 @@ IntGdiCreateDC(PUNICODE_STRING Driver,
NewDC->DC_Type = DC_TYPE_DIRECT;
NewDC->IsIC = CreateAsIC;
NewDC->PDev = PrimarySurface.PDev;
NewDC->PDev = PrimarySurface.hPDev;
if(pUMdhpdev) pUMdhpdev = NewDC->PDev;
NewDC->pPDev = (PVOID)&PrimarySurface;
NewDC->w.hBitmap = PrimarySurface.Handle;
NewDC->w.bitsPerPixel = ((PGDIDEVICE)NewDC->pPDev)->GDIInfo.cBitsPixel *
NewDC->w.bitsPerPixel = ((PGDIDEVICE)NewDC->pPDev)->GDIInfo.cBitsPixel *
((PGDIDEVICE)NewDC->pPDev)->GDIInfo.cPlanes;
DPRINT("Bits per pel: %u\n", NewDC->w.bitsPerPixel);
@ -1272,7 +1272,7 @@ IntGdiCopyFromSaveState(PDC dc, PDC dcs, HDC hDC)
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
sDc_Attr = dcs->pDc_Attr;
if(!sDc_Attr) sDc_Attr = &dcs->Dc_Attr;
dc->w.flags = dcs->w.flags & ~DC_SAVED;
dc->w.hFirstBitmap = dcs->w.hFirstBitmap;
@ -2386,7 +2386,7 @@ DC_AllocDC(PUNICODE_STRING Driver)
}
Dc_Attr = NewDC->pDc_Attr;
if(!Dc_Attr) Dc_Attr = &NewDC->Dc_Attr;
NewDC->hHmgr = (HGDIOBJ) hDC; // Save the handle for this DC object.
NewDC->w.xformWorld2Wnd.eM11 = 1.0f;
NewDC->w.xformWorld2Wnd.eM12 = 0.0f;
@ -2653,7 +2653,7 @@ DC_LockDisplay(HDC hDC)
DC_UnlockDc(dc);
if (!Resource) return;
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite( Resource , TRUE);
ExAcquireResourceExclusiveLite( Resource , TRUE);
}
VOID
@ -3366,7 +3366,7 @@ NtGdiGetDhpdev(
} while (pPDev != NULL);
KeLeaveCriticalRegion();
if (!pPDev) return NULL;
return pGdiDevice->PDev;
return pGdiDevice->hPDev;
}
/* EOF */

View file

@ -98,7 +98,7 @@ IntGetDeviceGammaRamp(HDEV hPDev, PGAMMARAMP Ramp)
{
int NewValue = i * 256;
if (NewValue > 65535) NewValue = 65535;
Ramp->Red[i] = Ramp->Green[i] = Ramp->Blue[i] = ((WORD)NewValue);
}
return TRUE;
@ -122,7 +122,7 @@ NtGdiGetDeviceGammaRamp(HDC hDC,
dc = DC_LockDc(hDC);
if (!dc)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
@ -132,7 +132,7 @@ NtGdiGetDeviceGammaRamp(HDC hDC,
DC_UnlockDc(dc);
SetLastWin32Error(STATUS_NO_MEMORY);
return FALSE;
}
}
Ret = IntGetDeviceGammaRamp((HDEV)dc->pPDev, SafeRamp);
@ -208,7 +208,7 @@ UpdateDeviceGammaRamp( HDEV hPDev )
(pGDev->DevInfo.iDitherFormat == BMF_32BPP))
{
if (pGDev->DriverFunctions.IcmSetDeviceGammaRamp)
return pGDev->DriverFunctions.IcmSetDeviceGammaRamp( pGDev->PDev,
return pGDev->DriverFunctions.IcmSetDeviceGammaRamp( pGDev->hPDev,
IGRF_RGB_256WORDS,
pGDev->pvGammaRamp);
@ -232,7 +232,7 @@ UpdateDeviceGammaRamp( HDEV hPDev )
// PALOBJ_cGetColors check mode flags and update Gamma Correction.
// Set the HDEV to pal and go.
palGDI->hPDev = hPDev;
Ret = pGDev->DriverFunctions.SetPalette(pGDev->PDev,
Ret = pGDev->DriverFunctions.SetPalette(pGDev->hPDev,
palPtr,
0,
0,
@ -270,9 +270,9 @@ IntSetDeviceGammaRamp(HDEV hPDev, PGAMMARAMP Ramp, BOOL Test)
if (!pGDev->DriverFunctions.IcmSetDeviceGammaRamp)
{ // No driver support
if (!(pGDev->DevInfo.flGraphicsCaps2 & GCAPS2_CHANGEGAMMARAMP))
{ // Driver does not support Gamma Ramp, so test to see we
{ // Driver does not support Gamma Ramp, so test to see we
// have BMF_8BPP only and palette operation support.
if ((pGDev->DevInfo.iDitherFormat != BMF_8BPP) ||
if ((pGDev->DevInfo.iDitherFormat != BMF_8BPP) ||
!(pGDev->GDIInfo.flRaster & RC_PALETTE)) return FALSE;
}
}
@ -338,7 +338,7 @@ NtGdiSetDeviceGammaRamp(HDC hDC,
dc = DC_LockDc(hDC);
if (!dc)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
@ -348,7 +348,7 @@ NtGdiSetDeviceGammaRamp(HDC hDC,
DC_UnlockDc(dc);
SetLastWin32Error(STATUS_NO_MEMORY);
return FALSE;
}
}
_SEH_TRY
{
ProbeForRead( Ramp,