mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
More dc cleanup: make DC_AllocDC return a pointer, not a handle, like done with the other objects, too.
Remove DC_GetnextDC and DC_SetNextDC, as they are trivial. Misc cleanup and improvements. svn path=/trunk/; revision=40203
This commit is contained in:
parent
65ce2884da
commit
a6e1bbc54d
3 changed files with 116 additions and 154 deletions
|
@ -57,6 +57,7 @@ DC_AllocDC(PUNICODE_STRING Driver)
|
||||||
}
|
}
|
||||||
pdcattr = NewDC->pdcattr;
|
pdcattr = NewDC->pdcattr;
|
||||||
|
|
||||||
|
// FIXME: no floating point in the kernel!
|
||||||
xformTemplate.eM11 = 1.0f;
|
xformTemplate.eM11 = 1.0f;
|
||||||
xformTemplate.eM12 = 0.0f;
|
xformTemplate.eM12 = 0.0f;
|
||||||
xformTemplate.eM21 = 0.0f;
|
xformTemplate.eM21 = 0.0f;
|
||||||
|
@ -67,7 +68,7 @@ DC_AllocDC(PUNICODE_STRING Driver)
|
||||||
XForm2MatrixS(&NewDC->dclevel.mxDeviceToWorld, &xformTemplate);
|
XForm2MatrixS(&NewDC->dclevel.mxDeviceToWorld, &xformTemplate);
|
||||||
XForm2MatrixS(&NewDC->dclevel.mxWorldToPage, &xformTemplate);
|
XForm2MatrixS(&NewDC->dclevel.mxWorldToPage, &xformTemplate);
|
||||||
|
|
||||||
// Setup syncing bits for the dcattr data packets.
|
// Setup syncing bits for the dcattr data packets.
|
||||||
pdcattr->flXform = DEVICE_TO_PAGE_INVALID;
|
pdcattr->flXform = DEVICE_TO_PAGE_INVALID;
|
||||||
|
|
||||||
pdcattr->ulDirty_ = 0; // Server side
|
pdcattr->ulDirty_ = 0; // Server side
|
||||||
|
@ -87,21 +88,21 @@ DC_AllocDC(PUNICODE_STRING Driver)
|
||||||
pdcattr->ulBackgroundClr = 0xffffff;
|
pdcattr->ulBackgroundClr = 0xffffff;
|
||||||
pdcattr->crBackgroundClr = 0xffffff;
|
pdcattr->crBackgroundClr = 0xffffff;
|
||||||
|
|
||||||
pdcattr->ulPenClr = RGB( 0, 0, 0 );
|
pdcattr->ulPenClr = RGB(0, 0, 0);
|
||||||
pdcattr->crPenClr = RGB( 0, 0, 0 );
|
pdcattr->crPenClr = RGB(0, 0, 0);
|
||||||
|
|
||||||
pdcattr->ulBrushClr = RGB( 255, 255, 255 ); // Do this way too.
|
pdcattr->ulBrushClr = RGB(255, 255, 255); // Do this way too.
|
||||||
pdcattr->crBrushClr = RGB( 255, 255, 255 );
|
pdcattr->crBrushClr = RGB(255, 255, 255);
|
||||||
|
|
||||||
//// This fixes the default brush and pen settings. See DC_InitDC.
|
//// This fixes the default brush and pen settings. See DC_InitDC.
|
||||||
|
|
||||||
/* Create the default fill brush */
|
/* Create the default fill brush */
|
||||||
pdcattr->hbrush = NtGdiGetStockObject( WHITE_BRUSH );
|
pdcattr->hbrush = NtGdiGetStockObject(WHITE_BRUSH);
|
||||||
NewDC->dclevel.pbrFill = BRUSH_ShareLockBrush(pdcattr->hbrush);
|
NewDC->dclevel.pbrFill = BRUSH_ShareLockBrush(pdcattr->hbrush);
|
||||||
EBRUSHOBJ_vInit(&NewDC->eboFill, NewDC->dclevel.pbrFill, NULL);
|
EBRUSHOBJ_vInit(&NewDC->eboFill, NewDC->dclevel.pbrFill, NULL);
|
||||||
|
|
||||||
/* Create the default pen / line brush */
|
/* Create the default pen / line brush */
|
||||||
pdcattr->hpen = NtGdiGetStockObject( BLACK_PEN );
|
pdcattr->hpen = NtGdiGetStockObject(BLACK_PEN);
|
||||||
NewDC->dclevel.pbrLine = PEN_ShareLockPen(pdcattr->hpen);
|
NewDC->dclevel.pbrLine = PEN_ShareLockPen(pdcattr->hpen);
|
||||||
EBRUSHOBJ_vInit(&NewDC->eboLine, NewDC->dclevel.pbrFill, NULL);
|
EBRUSHOBJ_vInit(&NewDC->eboLine, NewDC->dclevel.pbrFill, NULL);
|
||||||
|
|
||||||
|
@ -112,16 +113,14 @@ DC_AllocDC(PUNICODE_STRING Driver)
|
||||||
NewDC->dclevel.hpal = NtGdiGetStockObject(DEFAULT_PALETTE);
|
NewDC->dclevel.hpal = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||||
NewDC->dclevel.laPath.eMiterLimit = 10.0;
|
NewDC->dclevel.laPath.eMiterLimit = 10.0;
|
||||||
|
|
||||||
DC_UnlockDc(NewDC);
|
return NewDC;
|
||||||
|
|
||||||
return hDC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
DC_FreeDC(HDC DCToFree)
|
DC_FreeDC(HDC DCToFree)
|
||||||
{
|
{
|
||||||
DC_FreeDcAttr(DCToFree);
|
DC_FreeDcAttr(DCToFree);
|
||||||
if (!IsObjectDead( DCToFree ))
|
if (!IsObjectDead(DCToFree))
|
||||||
{
|
{
|
||||||
if (!GDIOBJ_FreeObjByHandle(DCToFree, GDI_OBJECT_TYPE_DC))
|
if (!GDIOBJ_FreeObjByHandle(DCToFree, GDI_OBJECT_TYPE_DC))
|
||||||
{
|
{
|
||||||
|
@ -172,6 +171,7 @@ DC_SetOwnership(HDC hDC, PEPROCESS Owner)
|
||||||
}
|
}
|
||||||
DC_UnlockDc(pDC);
|
DC_UnlockDc(pDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,20 +248,13 @@ IntGdiCreateDC(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a DC object */
|
/* Allocate a DC object */
|
||||||
if ((hdc = DC_AllocDC(Driver)) == NULL)
|
pdc = DC_AllocDC(Driver);
|
||||||
|
if (pdc == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1("DC_AllocDC() failed\n");
|
DPRINT1("DC_AllocDC() failed\n");
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pdc = DC_LockDc( hdc );
|
|
||||||
if ( !pdc )
|
|
||||||
{
|
|
||||||
DC_FreeDC( hdc );
|
|
||||||
DPRINT1("DC_LockDc() failed\n");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
hdc = pdc->BaseObject.hHmgr;
|
||||||
pdcattr = pdc->pdcattr;
|
pdcattr = pdc->pdcattr;
|
||||||
|
|
||||||
pdc->dctype = DC_TYPE_DIRECT;
|
pdc->dctype = DC_TYPE_DIRECT;
|
||||||
|
@ -298,7 +291,7 @@ IntGdiCreateDC(
|
||||||
{
|
{
|
||||||
pdc->pSurfInfo = NULL;
|
pdc->pSurfInfo = NULL;
|
||||||
// pdc->dclevel.pSurface =
|
// pdc->dclevel.pSurface =
|
||||||
DC_UnlockDc( pdc );
|
DC_UnlockDc(pdc);
|
||||||
|
|
||||||
/* Initialize the DC state */
|
/* Initialize the DC state */
|
||||||
DC_InitDC(hdc);
|
DC_InitDC(hdc);
|
||||||
|
@ -318,7 +311,7 @@ IntGdiCreateDC(
|
||||||
DC_vSelectSurface(pdc, NULL);
|
DC_vSelectSurface(pdc, NULL);
|
||||||
pdcattr->crBackgroundClr = pdcattr->ulBackgroundClr = RGB(255, 255, 255);
|
pdcattr->crBackgroundClr = pdcattr->ulBackgroundClr = RGB(255, 255, 255);
|
||||||
pdcattr->crForegroundClr = RGB(0, 0, 0);
|
pdcattr->crForegroundClr = RGB(0, 0, 0);
|
||||||
DC_UnlockDc( pdc );
|
DC_UnlockDc(pdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hVisRgn)
|
if (hVisRgn)
|
||||||
|
@ -342,7 +335,7 @@ NtGdiOpenDCW(
|
||||||
ULONG iType,
|
ULONG iType,
|
||||||
HANDLE hspool,
|
HANDLE hspool,
|
||||||
VOID *pDriverInfo2,
|
VOID *pDriverInfo2,
|
||||||
VOID *pUMdhpdev )
|
VOID *pUMdhpdev)
|
||||||
{
|
{
|
||||||
UNICODE_STRING SafeDevice;
|
UNICODE_STRING SafeDevice;
|
||||||
DEVMODEW SafeInitData;
|
DEVMODEW SafeInitData;
|
||||||
|
@ -417,17 +410,17 @@ IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC)
|
||||||
//
|
//
|
||||||
if (hDC && !defaultDCstate) // Ultra HAX! Dedicated to GvG!
|
if (hDC && !defaultDCstate) // Ultra HAX! Dedicated to GvG!
|
||||||
{ // This is a cheesy way to do this.
|
{ // This is a cheesy way to do this.
|
||||||
PDC dc = DC_LockDc ( hDC );
|
PDC dc = DC_LockDc(hDC);
|
||||||
defaultDCstate = ExAllocatePoolWithTag(PagedPool, sizeof(DC), TAG_DC);
|
defaultDCstate = ExAllocatePoolWithTag(PagedPool, sizeof(DC), TAG_DC);
|
||||||
if (!defaultDCstate)
|
if (!defaultDCstate)
|
||||||
{
|
{
|
||||||
DC_UnlockDc( dc );
|
DC_UnlockDc(dc);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
RtlZeroMemory(defaultDCstate, sizeof(DC));
|
RtlZeroMemory(defaultDCstate, sizeof(DC));
|
||||||
defaultDCstate->pdcattr = &defaultDCstate->dcattr;
|
defaultDCstate->pdcattr = &defaultDCstate->dcattr;
|
||||||
IntGdiCopyToSaveState(dc, defaultDCstate);
|
IntGdiCopyToSaveState(dc, defaultDCstate);
|
||||||
DC_UnlockDc( dc );
|
DC_UnlockDc(dc);
|
||||||
}
|
}
|
||||||
return hDC;
|
return hDC;
|
||||||
}
|
}
|
||||||
|
@ -436,7 +429,7 @@ BOOL
|
||||||
FASTCALL
|
FASTCALL
|
||||||
IntGdiDeleteDC(HDC hDC, BOOL Force)
|
IntGdiDeleteDC(HDC hDC, BOOL Force)
|
||||||
{
|
{
|
||||||
PDC DCToDelete = DC_LockDc(hDC);
|
PDC DCToDelete = DC_LockDc(hDC);
|
||||||
|
|
||||||
if (DCToDelete == NULL)
|
if (DCToDelete == NULL)
|
||||||
{
|
{
|
||||||
|
@ -449,7 +442,7 @@ IntGdiDeleteDC(HDC hDC, BOOL Force)
|
||||||
if (DCToDelete->fs & DC_FLAG_PERMANENT)
|
if (DCToDelete->fs & DC_FLAG_PERMANENT)
|
||||||
{
|
{
|
||||||
DPRINT1("No! You Naughty Application!\n");
|
DPRINT1("No! You Naughty Application!\n");
|
||||||
DC_UnlockDc( DCToDelete );
|
DC_UnlockDc(DCToDelete);
|
||||||
return UserReleaseDC(NULL, hDC, FALSE);
|
return UserReleaseDC(NULL, hDC, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -460,15 +453,15 @@ IntGdiDeleteDC(HDC hDC, BOOL Force)
|
||||||
PDC savedDC;
|
PDC savedDC;
|
||||||
HDC savedHDC;
|
HDC savedHDC;
|
||||||
|
|
||||||
savedHDC = DC_GetNextDC (DCToDelete);
|
savedHDC = DCToDelete->hdcNext;
|
||||||
savedDC = DC_LockDc (savedHDC);
|
savedDC = DC_LockDc(savedHDC);
|
||||||
if (savedDC == NULL)
|
if (savedDC == NULL)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DC_SetNextDC (DCToDelete, DC_GetNextDC (savedDC));
|
DCToDelete->hdcNext = savedDC->hdcNext;
|
||||||
DCToDelete->dclevel.lSaveDepth--;
|
DCToDelete->dclevel.lSaveDepth--;
|
||||||
DC_UnlockDc( savedDC );
|
DC_UnlockDc(savedDC);
|
||||||
IntGdiDeleteDC(savedHDC, Force);
|
IntGdiDeleteDC(savedHDC, Force);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,11 +480,11 @@ IntGdiDeleteDC(HDC hDC, BOOL Force)
|
||||||
}
|
}
|
||||||
if (DCToDelete->rosdc.hClipRgn)
|
if (DCToDelete->rosdc.hClipRgn)
|
||||||
{
|
{
|
||||||
NtGdiDeleteObject (DCToDelete->rosdc.hClipRgn);
|
NtGdiDeleteObject(DCToDelete->rosdc.hClipRgn);
|
||||||
}
|
}
|
||||||
if (DCToDelete->rosdc.hVisRgn)
|
if (DCToDelete->rosdc.hVisRgn)
|
||||||
{
|
{
|
||||||
NtGdiDeleteObject (DCToDelete->rosdc.hVisRgn);
|
NtGdiDeleteObject(DCToDelete->rosdc.hVisRgn);
|
||||||
}
|
}
|
||||||
if (NULL != DCToDelete->rosdc.CombinedClip)
|
if (NULL != DCToDelete->rosdc.CombinedClip)
|
||||||
{
|
{
|
||||||
|
@ -499,12 +492,12 @@ IntGdiDeleteDC(HDC hDC, BOOL Force)
|
||||||
}
|
}
|
||||||
if (DCToDelete->rosdc.hGCClipRgn)
|
if (DCToDelete->rosdc.hGCClipRgn)
|
||||||
{
|
{
|
||||||
NtGdiDeleteObject (DCToDelete->rosdc.hGCClipRgn);
|
NtGdiDeleteObject(DCToDelete->rosdc.hGCClipRgn);
|
||||||
}
|
}
|
||||||
PATH_Delete(DCToDelete->dclevel.hPath);
|
PATH_Delete(DCToDelete->dclevel.hPath);
|
||||||
|
|
||||||
DC_UnlockDc( DCToDelete );
|
DC_UnlockDc(DCToDelete);
|
||||||
DC_FreeDC ( hDC );
|
DC_FreeDC(hDC);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,9 +546,9 @@ NtGdiMakeInfoDC(
|
||||||
HDC APIENTRY
|
HDC APIENTRY
|
||||||
NtGdiCreateCompatibleDC(HDC hDC)
|
NtGdiCreateCompatibleDC(HDC hDC)
|
||||||
{
|
{
|
||||||
PDC NewDC, OrigDC;
|
PDC pdcNew, pdcOld;
|
||||||
PDC_ATTR pdcattrNew, pdcattrOld;
|
PDC_ATTR pdcattrNew, pdcattrOld;
|
||||||
HDC hNewDC, DisplayDC = NULL;
|
HDC hdcNew, DisplayDC = NULL;
|
||||||
HRGN hVisRgn;
|
HRGN hVisRgn;
|
||||||
UNICODE_STRING DriverName;
|
UNICODE_STRING DriverName;
|
||||||
DWORD Layout = 0;
|
DWORD Layout = 0;
|
||||||
|
@ -573,8 +566,8 @@ NtGdiCreateCompatibleDC(HDC hDC)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a new DC based on the original DC's device */
|
/* Allocate a new DC based on the original DC's device */
|
||||||
OrigDC = DC_LockDc(hDC);
|
pdcOld = DC_LockDc(hDC);
|
||||||
if (NULL == OrigDC)
|
if (NULL == pdcOld)
|
||||||
{
|
{
|
||||||
if (NULL != DisplayDC)
|
if (NULL != DisplayDC)
|
||||||
{
|
{
|
||||||
|
@ -583,35 +576,28 @@ NtGdiCreateCompatibleDC(HDC hDC)
|
||||||
DPRINT1("Failed to lock hDC\n");
|
DPRINT1("Failed to lock hDC\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
hNewDC = DC_AllocDC(&OrigDC->rosdc.DriverName);
|
pdcNew = DC_AllocDC(&pdcOld->rosdc.DriverName);
|
||||||
if (NULL == hNewDC)
|
if (!pdcNew)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to create hNewDC\n");
|
DPRINT1("Failed to create pdcNew\n");
|
||||||
DC_UnlockDc(OrigDC);
|
DC_UnlockDc(pdcOld);
|
||||||
if (NULL != DisplayDC)
|
if (DisplayDC)
|
||||||
{
|
{
|
||||||
NtGdiDeleteObjectApp(DisplayDC);
|
NtGdiDeleteObjectApp(DisplayDC);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
NewDC = DC_LockDc( hNewDC );
|
hdcNew = pdcNew->BaseObject.hHmgr;
|
||||||
|
|
||||||
if (!NewDC)
|
pdcattrOld = pdcOld->pdcattr;
|
||||||
{
|
pdcattrNew = pdcNew->pdcattr;
|
||||||
DPRINT1("Failed to lock hNewDC\n");
|
|
||||||
NtGdiDeleteObjectApp(hNewDC);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pdcattrOld = OrigDC->pdcattr;
|
|
||||||
pdcattrNew = NewDC->pdcattr;
|
|
||||||
|
|
||||||
/* Copy information from original DC to new DC */
|
/* Copy information from original DC to new DC */
|
||||||
NewDC->dclevel.hdcSave = hNewDC;
|
pdcNew->dclevel.hdcSave = hdcNew;
|
||||||
|
|
||||||
NewDC->dhpdev = OrigDC->dhpdev;
|
pdcNew->dhpdev = pdcOld->dhpdev;
|
||||||
|
|
||||||
NewDC->rosdc.bitsPerPixel = OrigDC->rosdc.bitsPerPixel;
|
pdcNew->rosdc.bitsPerPixel = pdcOld->rosdc.bitsPerPixel;
|
||||||
|
|
||||||
/* DriverName is copied in the AllocDC routine */
|
/* DriverName is copied in the AllocDC routine */
|
||||||
pdcattrNew->ptlWindowOrg = pdcattrOld->ptlWindowOrg;
|
pdcattrNew->ptlWindowOrg = pdcattrOld->ptlWindowOrg;
|
||||||
|
@ -619,10 +605,10 @@ NtGdiCreateCompatibleDC(HDC hDC)
|
||||||
pdcattrNew->ptlViewportOrg = pdcattrOld->ptlViewportOrg;
|
pdcattrNew->ptlViewportOrg = pdcattrOld->ptlViewportOrg;
|
||||||
pdcattrNew->szlViewportExt = pdcattrOld->szlViewportExt;
|
pdcattrNew->szlViewportExt = pdcattrOld->szlViewportExt;
|
||||||
|
|
||||||
NewDC->dctype = DC_TYPE_MEMORY; // Always!
|
pdcNew->dctype = DC_TYPE_MEMORY; // Always!
|
||||||
NewDC->rosdc.hBitmap = NtGdiGetStockObject(DEFAULT_BITMAP);
|
pdcNew->rosdc.hBitmap = NtGdiGetStockObject(DEFAULT_BITMAP);
|
||||||
NewDC->ppdev = OrigDC->ppdev;
|
pdcNew->ppdev = pdcOld->ppdev;
|
||||||
NewDC->dclevel.hpal = OrigDC->dclevel.hpal;
|
pdcNew->dclevel.hpal = pdcOld->dclevel.hpal;
|
||||||
|
|
||||||
pdcattrNew->lTextAlign = pdcattrOld->lTextAlign;
|
pdcattrNew->lTextAlign = pdcattrOld->lTextAlign;
|
||||||
pdcattrNew->lBkMode = pdcattrOld->lBkMode;
|
pdcattrNew->lBkMode = pdcattrOld->lBkMode;
|
||||||
|
@ -630,17 +616,14 @@ NtGdiCreateCompatibleDC(HDC hDC)
|
||||||
pdcattrNew->jROP2 = pdcattrOld->jROP2;
|
pdcattrNew->jROP2 = pdcattrOld->jROP2;
|
||||||
pdcattrNew->dwLayout = pdcattrOld->dwLayout;
|
pdcattrNew->dwLayout = pdcattrOld->dwLayout;
|
||||||
if (pdcattrOld->dwLayout & LAYOUT_ORIENTATIONMASK) Layout = pdcattrOld->dwLayout;
|
if (pdcattrOld->dwLayout & LAYOUT_ORIENTATIONMASK) Layout = pdcattrOld->dwLayout;
|
||||||
NewDC->dclevel.flPath = OrigDC->dclevel.flPath;
|
pdcNew->dclevel.flPath = pdcOld->dclevel.flPath;
|
||||||
pdcattrNew->ulDirty_ = pdcattrOld->ulDirty_;
|
pdcattrNew->ulDirty_ = pdcattrOld->ulDirty_;
|
||||||
pdcattrNew->iCS_CP = pdcattrOld->iCS_CP;
|
pdcattrNew->iCS_CP = pdcattrOld->iCS_CP;
|
||||||
|
|
||||||
NewDC->erclWindow = (RECTL)
|
pdcNew->erclWindow = (RECTL){0, 0, 1, 1};
|
||||||
{
|
|
||||||
0,0,1,1
|
|
||||||
};
|
|
||||||
|
|
||||||
DC_UnlockDc(NewDC);
|
DC_UnlockDc(pdcNew);
|
||||||
DC_UnlockDc(OrigDC);
|
DC_UnlockDc(pdcOld);
|
||||||
if (NULL != DisplayDC)
|
if (NULL != DisplayDC)
|
||||||
{
|
{
|
||||||
NtGdiDeleteObjectApp(DisplayDC);
|
NtGdiDeleteObjectApp(DisplayDC);
|
||||||
|
@ -649,19 +632,19 @@ NtGdiCreateCompatibleDC(HDC hDC)
|
||||||
hVisRgn = NtGdiCreateRectRgn(0, 0, 1, 1);
|
hVisRgn = NtGdiCreateRectRgn(0, 0, 1, 1);
|
||||||
if (hVisRgn)
|
if (hVisRgn)
|
||||||
{
|
{
|
||||||
GdiSelectVisRgn(hNewDC, hVisRgn);
|
GdiSelectVisRgn(hdcNew, hVisRgn);
|
||||||
NtGdiDeleteObject(hVisRgn);
|
NtGdiDeleteObject(hVisRgn);
|
||||||
}
|
}
|
||||||
if (Layout) NtGdiSetLayout( hNewDC, -1, Layout);
|
if (Layout) NtGdiSetLayout(hdcNew, -1, Layout);
|
||||||
|
|
||||||
DC_InitDC(hNewDC);
|
DC_InitDC(hdcNew);
|
||||||
return hNewDC;
|
return hdcNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
APIENTRY
|
APIENTRY
|
||||||
NtGdiDeleteObjectApp(HANDLE DCHandle)
|
NtGdiDeleteObjectApp(HANDLE DCHandle)
|
||||||
{
|
{
|
||||||
/* Complete all pending operations */
|
/* Complete all pending operations */
|
||||||
NtGdiFlushUserBatch();
|
NtGdiFlushUserBatch();
|
||||||
|
|
|
@ -177,34 +177,33 @@ IntGdiCopyFromSaveState(PDC dc, PDC dcs, HDC hDC)
|
||||||
}
|
}
|
||||||
|
|
||||||
HDC APIENTRY
|
HDC APIENTRY
|
||||||
IntGdiGetDCState(HDC hDC)
|
IntGdiGetDCState(HDC hDC)
|
||||||
{
|
{
|
||||||
PDC newdc, dc;
|
PDC pdcNew, pdc;
|
||||||
HDC hnewdc;
|
HDC hdcNew;
|
||||||
|
|
||||||
dc = DC_LockDc(hDC);
|
pdc = DC_LockDc(hDC);
|
||||||
if (dc == NULL)
|
if (pdc == NULL)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
hnewdc = DC_AllocDC(NULL);
|
pdcNew = DC_AllocDC(NULL);
|
||||||
if (hnewdc == NULL)
|
if (pdcNew == NULL)
|
||||||
{
|
{
|
||||||
DC_UnlockDc(dc);
|
DC_UnlockDc(pdc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
newdc = DC_LockDc( hnewdc );
|
hdcNew = pdcNew->BaseObject.hHmgr;
|
||||||
/* FIXME - newdc can be NULL!!!! Don't assert here!!! */
|
|
||||||
ASSERT( newdc );
|
|
||||||
|
|
||||||
newdc->dclevel.hdcSave = hnewdc;
|
pdcNew->dclevel.hdcSave = hdcNew;
|
||||||
IntGdiCopyToSaveState( dc, newdc);
|
IntGdiCopyToSaveState(pdc, pdcNew);
|
||||||
|
|
||||||
DC_UnlockDc( newdc );
|
DC_UnlockDc(pdcNew);
|
||||||
DC_UnlockDc( dc );
|
DC_UnlockDc(pdc);
|
||||||
return hnewdc;
|
|
||||||
|
return hdcNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -281,7 +280,7 @@ NtGdiRestoreDC(HDC hDC, INT SaveLevel)
|
||||||
success=TRUE;
|
success=TRUE;
|
||||||
while (dc->dclevel.lSaveDepth >= SaveLevel)
|
while (dc->dclevel.lSaveDepth >= SaveLevel)
|
||||||
{
|
{
|
||||||
HDC hdcs = DC_GetNextDC (dc);
|
HDC hdcs = dc->hdcNext;
|
||||||
|
|
||||||
dcs = DC_LockDc (hdcs);
|
dcs = DC_LockDc (hdcs);
|
||||||
if (dcs == NULL)
|
if (dcs == NULL)
|
||||||
|
@ -290,7 +289,7 @@ NtGdiRestoreDC(HDC hDC, INT SaveLevel)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DC_SetNextDC (dc, DC_GetNextDC (dcs));
|
dc->hdcNext = dcs->hdcNext;
|
||||||
dcs->hdcNext = 0;
|
dcs->hdcNext = 0;
|
||||||
|
|
||||||
if (--dc->dclevel.lSaveDepth < SaveLevel)
|
if (--dc->dclevel.lSaveDepth < SaveLevel)
|
||||||
|
@ -359,8 +358,8 @@ NtGdiSaveDC(HDC hDC)
|
||||||
dcs->dclevel.hPath = dc->dclevel.hPath;
|
dcs->dclevel.hPath = dc->dclevel.hPath;
|
||||||
if (dcs->dclevel.hPath) dcs->dclevel.flPath |= DCPATH_SAVE;
|
if (dcs->dclevel.hPath) dcs->dclevel.flPath |= DCPATH_SAVE;
|
||||||
|
|
||||||
DC_SetNextDC (dcs, DC_GetNextDC (dc));
|
dcs->hdcNext = dc->hdcNext;
|
||||||
DC_SetNextDC (dc, hdcs);
|
dc->hdcNext = hdcs;
|
||||||
ret = ++dc->dclevel.lSaveDepth;
|
ret = ++dc->dclevel.lSaveDepth;
|
||||||
DC_UnlockDc( dcs );
|
DC_UnlockDc( dcs );
|
||||||
DC_UnlockDc( dc );
|
DC_UnlockDc( dc );
|
||||||
|
|
|
@ -124,19 +124,6 @@ IntIsPrimarySurface(SURFOBJ *SurfObj)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME: remove me
|
|
||||||
HDC FASTCALL
|
|
||||||
DC_GetNextDC (PDC pDC)
|
|
||||||
{
|
|
||||||
return pDC->hdcNext;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID FASTCALL
|
|
||||||
DC_SetNextDC (PDC pDC, HDC hNextDC)
|
|
||||||
{
|
|
||||||
pDC->hdcNext = hNextDC;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
NtGdiCancelDC(HDC hDC)
|
NtGdiCancelDC(HDC hDC)
|
||||||
|
@ -146,8 +133,6 @@ NtGdiCancelDC(HDC hDC)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WORD APIENTRY
|
WORD APIENTRY
|
||||||
IntGdiSetHookFlags(HDC hDC, WORD Flags)
|
IntGdiSetHookFlags(HDC hDC, WORD Flags)
|
||||||
{
|
{
|
||||||
|
@ -191,7 +176,7 @@ NtGdiGetDCDword(
|
||||||
DWORD *Result)
|
DWORD *Result)
|
||||||
{
|
{
|
||||||
BOOL Ret = TRUE;
|
BOOL Ret = TRUE;
|
||||||
PDC dc;
|
PDC pdc;
|
||||||
PDC_ATTR pdcattr;
|
PDC_ATTR pdcattr;
|
||||||
|
|
||||||
DWORD SafeResult = 0;
|
DWORD SafeResult = 0;
|
||||||
|
@ -203,13 +188,13 @@ NtGdiGetDCDword(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc = DC_LockDc(hDC);
|
pdc = DC_LockDc(hDC);
|
||||||
if (!dc)
|
if (!pdc)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
pdcattr = dc->pdcattr;
|
pdcattr = pdc->pdcattr;
|
||||||
|
|
||||||
switch (u)
|
switch (u)
|
||||||
{
|
{
|
||||||
|
@ -230,20 +215,20 @@ NtGdiGetDCDword(
|
||||||
|
|
||||||
case GdiGetArcDirection:
|
case GdiGetArcDirection:
|
||||||
if (pdcattr->dwLayout & LAYOUT_RTL)
|
if (pdcattr->dwLayout & LAYOUT_RTL)
|
||||||
SafeResult = AD_CLOCKWISE - ((dc->dclevel.flPath & DCPATH_CLOCKWISE) != 0);
|
SafeResult = AD_CLOCKWISE - ((pdc->dclevel.flPath & DCPATH_CLOCKWISE) != 0);
|
||||||
else
|
else
|
||||||
SafeResult = ((dc->dclevel.flPath & DCPATH_CLOCKWISE) != 0) + AD_COUNTERCLOCKWISE;
|
SafeResult = ((pdc->dclevel.flPath & DCPATH_CLOCKWISE) != 0) + AD_COUNTERCLOCKWISE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GdiGetEMFRestorDc:
|
case GdiGetEMFRestorDc:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GdiGetFontLanguageInfo:
|
case GdiGetFontLanguageInfo:
|
||||||
SafeResult = IntGetFontLanguageInfo(dc);
|
SafeResult = IntGetFontLanguageInfo(pdc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GdiGetIsMemDc:
|
case GdiGetIsMemDc:
|
||||||
SafeResult = dc->dctype;
|
SafeResult = pdc->dctype;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GdiGetMapMode:
|
case GdiGetMapMode:
|
||||||
|
@ -264,9 +249,7 @@ NtGdiGetDCDword(
|
||||||
{
|
{
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
ProbeForWrite(Result,
|
ProbeForWrite(Result, sizeof(DWORD), 1);
|
||||||
sizeof(DWORD),
|
|
||||||
1);
|
|
||||||
*Result = SafeResult;
|
*Result = SafeResult;
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
@ -274,16 +257,15 @@ NtGdiGetDCDword(
|
||||||
Status = _SEH2_GetExceptionCode();
|
Status = _SEH2_GetExceptionCode();
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
Ret = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
DC_UnlockDc(pdc);
|
||||||
{
|
|
||||||
SetLastNtError(Status);
|
|
||||||
DC_UnlockDc(dc);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
DC_UnlockDc(dc);
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +278,7 @@ NtGdiGetAndSetDCDword(
|
||||||
DWORD *Result)
|
DWORD *Result)
|
||||||
{
|
{
|
||||||
BOOL Ret = TRUE;
|
BOOL Ret = TRUE;
|
||||||
PDC dc;
|
PDC pdc;
|
||||||
PDC_ATTR pdcattr;
|
PDC_ATTR pdcattr;
|
||||||
|
|
||||||
DWORD SafeResult = 0;
|
DWORD SafeResult = 0;
|
||||||
|
@ -308,19 +290,19 @@ NtGdiGetAndSetDCDword(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc = DC_LockDc(hDC);
|
pdc = DC_LockDc(hDC);
|
||||||
if (!dc)
|
if (!pdc)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
pdcattr = dc->pdcattr;
|
pdcattr = pdc->pdcattr;
|
||||||
|
|
||||||
switch (u)
|
switch (u)
|
||||||
{
|
{
|
||||||
case GdiGetSetCopyCount:
|
case GdiGetSetCopyCount:
|
||||||
SafeResult = dc->ulCopyCount;
|
SafeResult = pdc->ulCopyCount;
|
||||||
dc->ulCopyCount = dwIn;
|
pdc->ulCopyCount = dwIn;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GdiGetSetTextAlign:
|
case GdiGetSetTextAlign:
|
||||||
|
@ -354,7 +336,7 @@ NtGdiGetAndSetDCDword(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GdiGetSetMapMode:
|
case GdiGetSetMapMode:
|
||||||
SafeResult = IntGdiSetMapMode(dc, dwIn);
|
SafeResult = IntGdiSetMapMode(pdc, dwIn);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GdiGetSetArcDirection:
|
case GdiGetSetArcDirection:
|
||||||
|
@ -366,23 +348,24 @@ NtGdiGetAndSetDCDword(
|
||||||
}
|
}
|
||||||
if (pdcattr->dwLayout & LAYOUT_RTL) // Right to Left
|
if (pdcattr->dwLayout & LAYOUT_RTL) // Right to Left
|
||||||
{
|
{
|
||||||
SafeResult = AD_CLOCKWISE - ((dc->dclevel.flPath & DCPATH_CLOCKWISE) != 0);
|
SafeResult = AD_CLOCKWISE - ((pdc->dclevel.flPath & DCPATH_CLOCKWISE) != 0);
|
||||||
if (dwIn == AD_CLOCKWISE)
|
if (dwIn == AD_CLOCKWISE)
|
||||||
{
|
{
|
||||||
dc->dclevel.flPath &= ~DCPATH_CLOCKWISE;
|
pdc->dclevel.flPath &= ~DCPATH_CLOCKWISE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dc->dclevel.flPath |= DCPATH_CLOCKWISE;
|
pdc->dclevel.flPath |= DCPATH_CLOCKWISE;
|
||||||
}
|
}
|
||||||
else // Left to Right
|
else // Left to Right
|
||||||
{
|
{
|
||||||
SafeResult = ((dc->dclevel.flPath & DCPATH_CLOCKWISE) != 0) + AD_COUNTERCLOCKWISE;
|
SafeResult = ((pdc->dclevel.flPath & DCPATH_CLOCKWISE) != 0) +
|
||||||
|
AD_COUNTERCLOCKWISE;
|
||||||
if (dwIn == AD_COUNTERCLOCKWISE)
|
if (dwIn == AD_COUNTERCLOCKWISE)
|
||||||
{
|
{
|
||||||
dc->dclevel.flPath &= ~DCPATH_CLOCKWISE;
|
pdc->dclevel.flPath &= ~DCPATH_CLOCKWISE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dc->dclevel.flPath |= DCPATH_CLOCKWISE;
|
pdc->dclevel.flPath |= DCPATH_CLOCKWISE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -396,9 +379,7 @@ NtGdiGetAndSetDCDword(
|
||||||
{
|
{
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
ProbeForWrite(Result,
|
ProbeForWrite(Result, sizeof(DWORD), 1);
|
||||||
sizeof(DWORD),
|
|
||||||
1);
|
|
||||||
*Result = SafeResult;
|
*Result = SafeResult;
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
@ -406,15 +387,14 @@ NtGdiGetAndSetDCDword(
|
||||||
Status = _SEH2_GetExceptionCode();
|
Status = _SEH2_GetExceptionCode();
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
Ret = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
DC_UnlockDc(pdc);
|
||||||
{
|
|
||||||
SetLastNtError(Status);
|
|
||||||
DC_UnlockDc(dc);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
DC_UnlockDc(dc);
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue