mirror of
https://github.com/reactos/reactos.git
synced 2025-05-17 16:27:00 +00:00
Complete move to Dc_Attr in win32k. Tested Qemu Linux, Xp with AbiWord.
svn path=/trunk/; revision=30546
This commit is contained in:
parent
29077a08f7
commit
92f9c23098
14 changed files with 714 additions and 525 deletions
|
@ -83,28 +83,28 @@ static __inline void INTERNAL_LPTODP(DC *dc, LPPOINT point)
|
|||
|
||||
#define MulDiv( x, y, z ) EngMulDiv( x, y, z )
|
||||
|
||||
#define XDPTOLP(dc,tx) \
|
||||
(MulDiv(((tx)-(dc)->Dc_Attr.ptlViewportOrg.x), (dc)->Dc_Attr.szlWindowExt.cx, (dc)->Dc_Attr.szlViewportExt.cx) + (dc)->Dc_Attr.ptlWindowOrg.x)
|
||||
#define YDPTOLP(dc,ty) \
|
||||
(MulDiv(((ty)-(dc)->Dc_Attr.ptlViewportOrg.y), (dc)->Dc_Attr.szlWindowExt.cy, (dc)->Dc_Attr.szlViewportExt.cy) + (dc)->Dc_Attr.ptlWindowOrg.y)
|
||||
#define XLPTODP(dc,tx) \
|
||||
(MulDiv(((tx)-(dc)->Dc_Attr.ptlWindowOrg.x), (dc)->Dc_Attr.szlViewportExt.cx, (dc)->Dc_Attr.szlWindowExt.cx) + (dc)->Dc_Attr.ptlViewportOrg.x)
|
||||
#define YLPTODP(dc,ty) \
|
||||
(MulDiv(((ty)-(dc)->Dc_Attr.ptlWindowOrg.y), (dc)->Dc_Attr.szlViewportExt.cy, (dc)->Dc_Attr.szlWindowExt.cy) + (dc)->Dc_Attr.ptlViewportOrg.y)
|
||||
#define XDPTOLP(Dc_Attr,tx) \
|
||||
(MulDiv(((tx)-(Dc_Attr)->ptlViewportOrg.x), (Dc_Attr)->szlWindowExt.cx, (Dc_Attr)->szlViewportExt.cx) + (Dc_Attr)->ptlWindowOrg.x)
|
||||
#define YDPTOLP(Dc_Attr,ty) \
|
||||
(MulDiv(((ty)-(Dc_Attr)->ptlViewportOrg.y), (Dc_Attr)->szlWindowExt.cy, (Dc_Attr)->szlViewportExt.cy) + (Dc_Attr)->ptlWindowOrg.y)
|
||||
#define XLPTODP(Dc_Attr,tx) \
|
||||
(MulDiv(((tx)-(Dc_Attr)->ptlWindowOrg.x), (Dc_Attr)->szlViewportExt.cx, (Dc_Attr)->szlWindowExt.cx) + (Dc_Attr)->ptlViewportOrg.x)
|
||||
#define YLPTODP(Dc_Attr,ty) \
|
||||
(MulDiv(((ty)-(Dc_Attr)->ptlWindowOrg.y), (Dc_Attr)->szlViewportExt.cy, (Dc_Attr)->szlWindowExt.cy) + (Dc_Attr)->ptlViewportOrg.y)
|
||||
|
||||
/* Device <-> logical size conversion */
|
||||
|
||||
#define XDSTOLS(dc,tx) \
|
||||
MulDiv((tx), (dc)->Dc_Attr.szlWindowExt.cx, (dc)->Dc_Attr.szlViewportExt.cx)
|
||||
#define YDSTOLS(dc,ty) \
|
||||
MulDiv((ty), (dc)->Dc_Attr.szlWindowExt.cy, (dc)->Dc_Attr.szlViewportExt.cy)
|
||||
#define XLSTODS(dc,tx) \
|
||||
MulDiv((tx), (dc)->Dc_Attr.szlViewportExt.cx, (dc)->Dc_Attr.szlWindowExt.cx)
|
||||
#define YLSTODS(dc,ty) \
|
||||
MulDiv((ty), (dc)->Dc_Attr.szlViewportExt.cy, (dc)->Dc_Attr.szlWindowExt.cy)
|
||||
|
||||
#endif
|
||||
#define XDSTOLS(Dc_Attr,tx) \
|
||||
MulDiv((tx), (Dc_Attr)->szlWindowExt.cx, (Dc_Attr)->szlViewportExt.cx)
|
||||
#define YDSTOLS(DC_Attr,ty) \
|
||||
MulDiv((ty), (Dc_Attr)->szlWindowExt.cy, (Dc_Attr)->szlViewportExt.cy)
|
||||
#define XLSTODS(Dc_Attr,tx) \
|
||||
MulDiv((tx), (Dc_Attr)->szlViewportExt.cx, (Dc_Attr)->szlWindowExt.cx)
|
||||
#define YLSTODS(Dc_Attr,ty) \
|
||||
MulDiv((ty), (Dc_Attr)->szlViewportExt.cy, (Dc_Attr)->szlWindowExt.cy)
|
||||
|
||||
VOID FASTCALL XForm2MatrixS( MATRIX_S *, PXFORM);
|
||||
VOID FASTCALL MatrixS2XForm( PXFORM, MATRIX_S *);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -158,6 +158,9 @@ DceAllocDCE(PWINDOW_OBJECT Window OPTIONAL, DCE_TYPE Type)
|
|||
else
|
||||
{
|
||||
DPRINT("FREE DCATTR!!!! NOT DCE_WINDOW_DC!!!!! hDC-> %x\n", pDce->hDC);
|
||||
PDC dc = DC_LockDc ( pDce->hDC );
|
||||
MmCopyFromCaller(&dc->Dc_Attr, dc->pDc_Attr, sizeof(DC_ATTR));
|
||||
DC_UnlockDc( dc );
|
||||
DC_FreeDcAttr(pDce->hDC); // Free the dcattr!
|
||||
DC_SetOwnership(pDce->hDC, NULL); // This hDC is inaccessible!
|
||||
}
|
||||
|
@ -275,6 +278,16 @@ DceReleaseDC(DCE* dce, BOOL EndPaint)
|
|||
dce->DCXFlags |= DCX_DCEEMPTY;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Save Users Dc_Attr.
|
||||
PDC dc = DC_LockDc(dce->hDC);
|
||||
if(dc)
|
||||
{
|
||||
PDC_ATTR Dc_Attr = dc->pDc_Attr;
|
||||
if(Dc_Attr) MmCopyFromCaller(&dc->Dc_Attr, Dc_Attr, sizeof(DC_ATTR));
|
||||
DC_UnlockDc(dc);
|
||||
}
|
||||
}
|
||||
DPRINT("Exit!!!!! DCX_CACHE!!!!!! hDC-> %x \n", dce->hDC);
|
||||
DC_FreeDcAttr(dce->hDC); // Free the dcattr.
|
||||
DC_SetOwnership(dce->hDC, NULL); // Set hDC inaccessible mode.
|
||||
|
|
|
@ -42,6 +42,7 @@ NtGdiAlphaBlend(
|
|||
{
|
||||
PDC DCDest = NULL;
|
||||
PDC DCSrc = NULL;
|
||||
PDC_ATTR Dc_Attr = NULL;
|
||||
BITMAPOBJ *BitmapDest, *BitmapSrc;
|
||||
RECTL DestRect, SourceRect;
|
||||
BOOL Status;
|
||||
|
@ -87,6 +88,9 @@ NtGdiAlphaBlend(
|
|||
DCSrc = DCDest;
|
||||
}
|
||||
|
||||
Dc_Attr = DCSrc->pDc_Attr;
|
||||
if (!Dc_Attr) Dc_Attr = &DCSrc->Dc_Attr;
|
||||
|
||||
/* Offset the destination and source by the origin of their DCs. */
|
||||
XOriginDest += DCDest->w.DCOrgX;
|
||||
YOriginDest += DCDest->w.DCOrgY;
|
||||
|
@ -125,11 +129,11 @@ NtGdiAlphaBlend(
|
|||
{
|
||||
if (DCDest->w.bitsPerPixel == 1)
|
||||
{
|
||||
XlateObj = IntEngCreateMonoXlate(0, DestPalette, SourcePalette, DCSrc->Dc_Attr.crBackgroundClr);
|
||||
XlateObj = IntEngCreateMonoXlate(0, DestPalette, SourcePalette, Dc_Attr->crBackgroundClr);
|
||||
}
|
||||
else if (DCSrc->w.bitsPerPixel == 1)
|
||||
{
|
||||
XlateObj = IntEngCreateSrcMonoXlate(DestPalette, DCSrc->Dc_Attr.crBackgroundClr, DCSrc->Dc_Attr.crForegroundClr);
|
||||
XlateObj = IntEngCreateSrcMonoXlate(DestPalette, Dc_Attr->crBackgroundClr, Dc_Attr->crForegroundClr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -182,6 +186,7 @@ NtGdiBitBlt(
|
|||
{
|
||||
PDC DCDest = NULL;
|
||||
PDC DCSrc = NULL;
|
||||
PDC_ATTR Dc_Attr = NULL;
|
||||
BITMAPOBJ *BitmapDest, *BitmapSrc;
|
||||
RECTL DestRect;
|
||||
POINTL SourcePoint, BrushOrigin;
|
||||
|
@ -235,6 +240,9 @@ NtGdiBitBlt(
|
|||
DCSrc = NULL;
|
||||
}
|
||||
|
||||
Dc_Attr = DCDest->pDc_Attr;
|
||||
if (!Dc_Attr) Dc_Attr = &DCDest->Dc_Attr;
|
||||
|
||||
/* Offset the destination and source by the origin of their DCs. */
|
||||
XDest += DCDest->w.DCOrgX;
|
||||
YDest += DCDest->w.DCOrgY;
|
||||
|
@ -273,7 +281,7 @@ NtGdiBitBlt(
|
|||
|
||||
if (UsesPattern)
|
||||
{
|
||||
BrushObj = BRUSHOBJ_LockBrush(DCDest->Dc_Attr.hbrush);
|
||||
BrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
|
||||
if (NULL == BrushObj)
|
||||
{
|
||||
if (UsesSource && hDCSrc != hDCDest)
|
||||
|
@ -316,13 +324,15 @@ NtGdiBitBlt(
|
|||
}
|
||||
else
|
||||
{
|
||||
Dc_Attr = DCSrc->pDc_Attr;
|
||||
if (!Dc_Attr) Dc_Attr = &DCSrc->Dc_Attr;
|
||||
if (DCDest->w.bitsPerPixel == 1)
|
||||
{
|
||||
XlateObj = IntEngCreateMonoXlate(0, DestPalette, SourcePalette, DCSrc->Dc_Attr.crBackgroundClr);
|
||||
XlateObj = IntEngCreateMonoXlate(0, DestPalette, SourcePalette, Dc_Attr->crBackgroundClr);
|
||||
}
|
||||
else if (DCSrc->w.bitsPerPixel == 1)
|
||||
{
|
||||
XlateObj = IntEngCreateSrcMonoXlate(DestPalette, DCSrc->Dc_Attr.crBackgroundClr, DCSrc->Dc_Attr.crForegroundClr);
|
||||
XlateObj = IntEngCreateSrcMonoXlate(DestPalette, Dc_Attr->crBackgroundClr, Dc_Attr->crForegroundClr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -781,6 +791,7 @@ NtGdiStretchBlt(
|
|||
{
|
||||
PDC DCDest = NULL;
|
||||
PDC DCSrc = NULL;
|
||||
PDC_ATTR Dc_Attr = NULL;
|
||||
BITMAPOBJ *BitmapDest, *BitmapSrc;
|
||||
RECTL DestRect;
|
||||
RECTL SourceRect;
|
||||
|
@ -929,7 +940,9 @@ NtGdiStretchBlt(
|
|||
|
||||
if (UsesPattern)
|
||||
{
|
||||
BrushObj = BRUSHOBJ_LockBrush(DCDest->Dc_Attr.hbrush);
|
||||
Dc_Attr = DCDest->pDc_Attr;
|
||||
if (!Dc_Attr) Dc_Attr = &DCDest->Dc_Attr;
|
||||
BrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
|
||||
if (NULL == BrushObj)
|
||||
{
|
||||
if (UsesSource && hDCSrc != hDCDest)
|
||||
|
@ -1132,6 +1145,7 @@ NtGdiPatBlt(
|
|||
{
|
||||
PGDIBRUSHOBJ BrushObj;
|
||||
DC *dc = DC_LockDc(hDC);
|
||||
PDC_ATTR Dc_Attr;
|
||||
BOOL ret;
|
||||
|
||||
if (dc == NULL)
|
||||
|
@ -1139,6 +1153,8 @@ NtGdiPatBlt(
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
if (dc->IsIC)
|
||||
{
|
||||
DC_UnlockDc(dc);
|
||||
|
@ -1146,7 +1162,7 @@ NtGdiPatBlt(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BrushObj = BRUSHOBJ_LockBrush(dc->Dc_Attr.hbrush);
|
||||
BrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
|
||||
if (BrushObj == NULL)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
|
|
|
@ -139,8 +139,11 @@ IntGdiCreateBrushXlate(PDC Dc, GDIBRUSHOBJ *BrushObj, BOOLEAN *Failed)
|
|||
/* Special case: 1bpp pattern */
|
||||
if (Pattern->SurfObj.iBitmapFormat == BMF_1BPP)
|
||||
{
|
||||
PDC_ATTR Dc_Attr = Dc->pDc_Attr;
|
||||
if (!Dc_Attr) Dc_Attr = &Dc->Dc_Attr;
|
||||
|
||||
if (Dc->w.bitsPerPixel != 1)
|
||||
Result = IntEngCreateSrcMonoXlate(Dc->w.hPalette, Dc->Dc_Attr.crForegroundClr, Dc->Dc_Attr.crBackgroundClr);
|
||||
Result = IntEngCreateSrcMonoXlate(Dc->w.hPalette, Dc_Attr->crForegroundClr, Dc_Attr->crBackgroundClr);
|
||||
}
|
||||
else if (BrushObj->flAttrs & GDIBRUSH_IS_DIB)
|
||||
{
|
||||
|
|
|
@ -37,18 +37,27 @@
|
|||
void FASTCALL
|
||||
IntFixIsotropicMapping(PDC dc)
|
||||
{
|
||||
ULONG xdim = EngMulDiv(dc->Dc_Attr.szlViewportExt.cx, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzSize, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzRes) / dc->Dc_Attr.szlWindowExt.cx;
|
||||
ULONG ydim = EngMulDiv(dc->Dc_Attr.szlViewportExt.cy, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertSize, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertRes) / dc->Dc_Attr.szlWindowExt.cy;
|
||||
PDC_ATTR Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
ULONG xdim = EngMulDiv(Dc_Attr->szlViewportExt.cx,
|
||||
((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzSize,
|
||||
((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzRes) /
|
||||
Dc_Attr->szlWindowExt.cx;
|
||||
ULONG ydim = EngMulDiv(Dc_Attr->szlViewportExt.cy,
|
||||
((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertSize,
|
||||
((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertRes) /
|
||||
Dc_Attr->szlWindowExt.cy;
|
||||
|
||||
if (xdim > ydim)
|
||||
{
|
||||
dc->Dc_Attr.szlViewportExt.cx = dc->Dc_Attr.szlViewportExt.cx * abs(ydim / xdim);
|
||||
if (!dc->Dc_Attr.szlViewportExt.cx) dc->Dc_Attr.szlViewportExt.cx = 1;
|
||||
Dc_Attr->szlViewportExt.cx = Dc_Attr->szlViewportExt.cx * abs(ydim / xdim);
|
||||
if (!Dc_Attr->szlViewportExt.cx) Dc_Attr->szlViewportExt.cx = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dc->Dc_Attr.szlViewportExt.cy = dc->Dc_Attr.szlViewportExt.cy * abs(xdim / ydim);
|
||||
if (!dc->Dc_Attr.szlViewportExt.cy) dc->Dc_Attr.szlViewportExt.cy = 1;
|
||||
Dc_Attr->szlViewportExt.cy = Dc_Attr->szlViewportExt.cy * abs(xdim / ydim);
|
||||
if (!Dc_Attr->szlViewportExt.cy) Dc_Attr->szlViewportExt.cy = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,8 +170,11 @@ int
|
|||
FASTCALL
|
||||
IntGetGraphicsMode ( PDC dc )
|
||||
{
|
||||
PDC_ATTR Dc_Attr;
|
||||
ASSERT ( dc );
|
||||
return dc->Dc_Attr.iGraphicsMode;
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
return Dc_Attr->iGraphicsMode;
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
@ -209,6 +221,7 @@ STDCALL
|
|||
NtGdiGetGraphicsMode ( HDC hDC )
|
||||
{
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
int GraphicsMode; // default to failure
|
||||
|
||||
dc = DC_LockDc ( hDC );
|
||||
|
@ -217,8 +230,9 @@ NtGdiGetGraphicsMode ( HDC hDC )
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GraphicsMode = dc->Dc_Attr.iGraphicsMode;
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
GraphicsMode = Dc_Attr->iGraphicsMode;
|
||||
|
||||
DC_UnlockDc(dc);
|
||||
return GraphicsMode;
|
||||
|
@ -464,6 +478,7 @@ NtGdiOffsetViewportOrgEx(HDC hDC,
|
|||
LPPOINT UnsafePoint)
|
||||
{
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
dc = DC_LockDc ( hDC );
|
||||
|
@ -472,7 +487,9 @@ NtGdiOffsetViewportOrgEx(HDC hDC,
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
if (UnsafePoint)
|
||||
{
|
||||
_SEH_TRY
|
||||
|
@ -480,8 +497,8 @@ NtGdiOffsetViewportOrgEx(HDC hDC,
|
|||
ProbeForWrite(UnsafePoint,
|
||||
sizeof(POINT),
|
||||
1);
|
||||
UnsafePoint->x = dc->Dc_Attr.ptlViewportOrg.x;
|
||||
UnsafePoint->y = dc->Dc_Attr.ptlViewportOrg.y;
|
||||
UnsafePoint->x = Dc_Attr->ptlViewportOrg.x;
|
||||
UnsafePoint->y = Dc_Attr->ptlViewportOrg.y;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
|
@ -497,8 +514,8 @@ NtGdiOffsetViewportOrgEx(HDC hDC,
|
|||
}
|
||||
}
|
||||
|
||||
dc->Dc_Attr.ptlViewportOrg.x += XOffset;
|
||||
dc->Dc_Attr.ptlViewportOrg.y += YOffset;
|
||||
Dc_Attr->ptlViewportOrg.x += XOffset;
|
||||
Dc_Attr->ptlViewportOrg.y += YOffset;
|
||||
DC_UpdateXforms(dc);
|
||||
DC_UnlockDc(dc);
|
||||
return TRUE;
|
||||
|
@ -512,13 +529,16 @@ NtGdiOffsetWindowOrgEx(HDC hDC,
|
|||
LPPOINT Point)
|
||||
{
|
||||
PDC dc;
|
||||
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
dc = DC_LockDc(hDC);
|
||||
if (!dc)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
if (Point)
|
||||
{
|
||||
|
@ -529,8 +549,8 @@ NtGdiOffsetWindowOrgEx(HDC hDC,
|
|||
ProbeForWrite(Point,
|
||||
sizeof(POINT),
|
||||
1);
|
||||
Point->x = dc->Dc_Attr.ptlWindowOrg.x;
|
||||
Point->y = dc->Dc_Attr.ptlWindowOrg.y;
|
||||
Point->x = Dc_Attr->ptlWindowOrg.x;
|
||||
Point->y = Dc_Attr->ptlWindowOrg.y;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
|
@ -546,8 +566,8 @@ NtGdiOffsetWindowOrgEx(HDC hDC,
|
|||
}
|
||||
}
|
||||
|
||||
dc->Dc_Attr.ptlWindowOrg.x += XOffset;
|
||||
dc->Dc_Attr.ptlWindowOrg.y += YOffset;
|
||||
Dc_Attr->ptlWindowOrg.x += XOffset;
|
||||
Dc_Attr->ptlWindowOrg.y += YOffset;
|
||||
|
||||
DC_UpdateXforms(dc);
|
||||
DC_UnlockDc(dc);
|
||||
|
@ -588,6 +608,7 @@ NtGdiSetGraphicsMode(HDC hDC,
|
|||
{
|
||||
INT ret;
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
dc = DC_LockDc (hDC);
|
||||
if (!dc)
|
||||
|
@ -595,6 +616,8 @@ NtGdiSetGraphicsMode(HDC hDC,
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
}
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
/* One would think that setting the graphics mode to GM_COMPATIBLE
|
||||
* would also reset the world transformation matrix to the unity
|
||||
|
@ -609,8 +632,8 @@ NtGdiSetGraphicsMode(HDC hDC,
|
|||
return 0;
|
||||
}
|
||||
|
||||
ret = dc->Dc_Attr.iGraphicsMode;
|
||||
dc->Dc_Attr.iGraphicsMode = Mode;
|
||||
ret = Dc_Attr->iGraphicsMode;
|
||||
Dc_Attr->iGraphicsMode = Mode;
|
||||
DC_UnlockDc(dc);
|
||||
return ret;
|
||||
}
|
||||
|
@ -621,56 +644,58 @@ IntGdiSetMapMode(PDC dc,
|
|||
int MapMode)
|
||||
{
|
||||
int PrevMapMode;
|
||||
PDC_ATTR Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
PrevMapMode = dc->Dc_Attr.iMapMode;
|
||||
PrevMapMode = Dc_Attr->iMapMode;
|
||||
|
||||
if (MapMode != dc->Dc_Attr.iMapMode || (MapMode != MM_ISOTROPIC && MapMode != MM_ANISOTROPIC))
|
||||
if (MapMode != Dc_Attr->iMapMode || (MapMode != MM_ISOTROPIC && MapMode != MM_ANISOTROPIC))
|
||||
{
|
||||
dc->Dc_Attr.iMapMode = MapMode;
|
||||
Dc_Attr->iMapMode = MapMode;
|
||||
|
||||
switch (MapMode)
|
||||
{
|
||||
case MM_TEXT:
|
||||
dc->Dc_Attr.szlWindowExt.cx = 1;
|
||||
dc->Dc_Attr.szlWindowExt.cy = 1;
|
||||
dc->Dc_Attr.szlViewportExt.cx = 1;
|
||||
dc->Dc_Attr.szlViewportExt.cy = 1;
|
||||
Dc_Attr->szlWindowExt.cx = 1;
|
||||
Dc_Attr->szlWindowExt.cy = 1;
|
||||
Dc_Attr->szlViewportExt.cx = 1;
|
||||
Dc_Attr->szlViewportExt.cy = 1;
|
||||
break;
|
||||
|
||||
case MM_LOMETRIC:
|
||||
case MM_ISOTROPIC:
|
||||
dc->Dc_Attr.szlWindowExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzSize * 10;
|
||||
dc->Dc_Attr.szlWindowExt.cy = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertSize * 10;
|
||||
dc->Dc_Attr.szlViewportExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzRes;
|
||||
dc->Dc_Attr.szlViewportExt.cy = -((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertRes;
|
||||
Dc_Attr->szlWindowExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzSize * 10;
|
||||
Dc_Attr->szlWindowExt.cy = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertSize * 10;
|
||||
Dc_Attr->szlViewportExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzRes;
|
||||
Dc_Attr->szlViewportExt.cy = -((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertRes;
|
||||
break;
|
||||
|
||||
case MM_HIMETRIC:
|
||||
dc->Dc_Attr.szlWindowExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzSize * 100;
|
||||
dc->Dc_Attr.szlWindowExt.cy = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertSize * 100;
|
||||
dc->Dc_Attr.szlViewportExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzRes;
|
||||
dc->Dc_Attr.szlViewportExt.cy = -((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertRes;
|
||||
Dc_Attr->szlWindowExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzSize * 100;
|
||||
Dc_Attr->szlWindowExt.cy = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertSize * 100;
|
||||
Dc_Attr->szlViewportExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzRes;
|
||||
Dc_Attr->szlViewportExt.cy = -((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertRes;
|
||||
break;
|
||||
|
||||
case MM_LOENGLISH:
|
||||
dc->Dc_Attr.szlWindowExt.cx = EngMulDiv(1000, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzSize, 254);
|
||||
dc->Dc_Attr.szlWindowExt.cy = EngMulDiv(1000, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertSize, 254);
|
||||
dc->Dc_Attr.szlViewportExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzRes;
|
||||
dc->Dc_Attr.szlViewportExt.cy = -((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertRes;
|
||||
Dc_Attr->szlWindowExt.cx = EngMulDiv(1000, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzSize, 254);
|
||||
Dc_Attr->szlWindowExt.cy = EngMulDiv(1000, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertSize, 254);
|
||||
Dc_Attr->szlViewportExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzRes;
|
||||
Dc_Attr->szlViewportExt.cy = -((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertRes;
|
||||
break;
|
||||
|
||||
case MM_HIENGLISH:
|
||||
dc->Dc_Attr.szlWindowExt.cx = EngMulDiv(10000, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzSize, 254);
|
||||
dc->Dc_Attr.szlWindowExt.cy = EngMulDiv(10000, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertSize, 254);
|
||||
dc->Dc_Attr.szlViewportExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzRes;
|
||||
dc->Dc_Attr.szlViewportExt.cy = -((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertRes;
|
||||
Dc_Attr->szlWindowExt.cx = EngMulDiv(10000, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzSize, 254);
|
||||
Dc_Attr->szlWindowExt.cy = EngMulDiv(10000, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertSize, 254);
|
||||
Dc_Attr->szlViewportExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzRes;
|
||||
Dc_Attr->szlViewportExt.cy = -((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertRes;
|
||||
break;
|
||||
|
||||
case MM_TWIPS:
|
||||
dc->Dc_Attr.szlWindowExt.cx = EngMulDiv(14400, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzSize, 254);
|
||||
dc->Dc_Attr.szlWindowExt.cy = EngMulDiv(14400, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertSize, 254);
|
||||
dc->Dc_Attr.szlViewportExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzRes;
|
||||
dc->Dc_Attr.szlViewportExt.cy = -((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertRes;
|
||||
Dc_Attr->szlWindowExt.cx = EngMulDiv(14400, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzSize, 254);
|
||||
Dc_Attr->szlWindowExt.cy = EngMulDiv(14400, ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertSize, 254);
|
||||
Dc_Attr->szlViewportExt.cx = ((PGDIDEVICE)dc->pPDev)->GDIInfo.ulHorzRes;
|
||||
Dc_Attr->szlViewportExt.cy = -((PGDIDEVICE)dc->pPDev)->GDIInfo.ulVertRes;
|
||||
break;
|
||||
|
||||
case MM_ANISOTROPIC:
|
||||
|
@ -691,6 +716,7 @@ NtGdiSetViewportExtEx(HDC hDC,
|
|||
LPSIZE Size)
|
||||
{
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
dc = DC_LockDc(hDC);
|
||||
if ( !dc )
|
||||
|
@ -698,8 +724,10 @@ NtGdiSetViewportExtEx(HDC hDC,
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
switch (dc->Dc_Attr.iMapMode)
|
||||
switch (Dc_Attr->iMapMode)
|
||||
{
|
||||
case MM_HIENGLISH:
|
||||
case MM_HIMETRIC:
|
||||
|
@ -725,13 +753,13 @@ NtGdiSetViewportExtEx(HDC hDC,
|
|||
ProbeForWrite(Size,
|
||||
sizeof(SIZE),
|
||||
1);
|
||||
Size->cx = dc->Dc_Attr.szlViewportExt.cx;
|
||||
Size->cy = dc->Dc_Attr.szlViewportExt.cy;
|
||||
Size->cx = Dc_Attr->szlViewportExt.cx;
|
||||
Size->cy = Dc_Attr->szlViewportExt.cy;
|
||||
|
||||
dc->Dc_Attr.szlViewportExt.cx = XExtent;
|
||||
dc->Dc_Attr.szlViewportExt.cy = YExtent;
|
||||
Dc_Attr->szlViewportExt.cx = XExtent;
|
||||
Dc_Attr->szlViewportExt.cy = YExtent;
|
||||
|
||||
if (dc->Dc_Attr.iMapMode == MM_ISOTROPIC)
|
||||
if (Dc_Attr->iMapMode == MM_ISOTROPIC)
|
||||
IntFixIsotropicMapping(dc);
|
||||
}
|
||||
_SEH_HANDLE
|
||||
|
@ -763,6 +791,7 @@ NtGdiSetViewportOrgEx(HDC hDC,
|
|||
LPPOINT Point)
|
||||
{
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
dc = DC_LockDc(hDC);
|
||||
if (!dc)
|
||||
|
@ -770,6 +799,8 @@ NtGdiSetViewportOrgEx(HDC hDC,
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
if (Point)
|
||||
{
|
||||
|
@ -780,8 +811,8 @@ NtGdiSetViewportOrgEx(HDC hDC,
|
|||
ProbeForWrite(Point,
|
||||
sizeof(POINT),
|
||||
1);
|
||||
Point->x = dc->Dc_Attr.ptlViewportOrg.x;
|
||||
Point->y = dc->Dc_Attr.ptlViewportOrg.y;
|
||||
Point->x = Dc_Attr->ptlViewportOrg.x;
|
||||
Point->y = Dc_Attr->ptlViewportOrg.y;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
|
@ -797,8 +828,8 @@ NtGdiSetViewportOrgEx(HDC hDC,
|
|||
}
|
||||
}
|
||||
|
||||
dc->Dc_Attr.ptlViewportOrg.x = X;
|
||||
dc->Dc_Attr.ptlViewportOrg.y = Y;
|
||||
Dc_Attr->ptlViewportOrg.x = X;
|
||||
Dc_Attr->ptlViewportOrg.y = Y;
|
||||
|
||||
DC_UpdateXforms(dc);
|
||||
DC_UnlockDc(dc);
|
||||
|
@ -814,6 +845,7 @@ NtGdiSetWindowExtEx(HDC hDC,
|
|||
LPSIZE Size)
|
||||
{
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
dc = DC_LockDc(hDC);
|
||||
if (!dc)
|
||||
|
@ -821,8 +853,10 @@ NtGdiSetWindowExtEx(HDC hDC,
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
switch (dc->Dc_Attr.iMapMode)
|
||||
switch (Dc_Attr->iMapMode)
|
||||
{
|
||||
case MM_HIENGLISH:
|
||||
case MM_HIMETRIC:
|
||||
|
@ -843,8 +877,8 @@ NtGdiSetWindowExtEx(HDC hDC,
|
|||
ProbeForWrite(Size,
|
||||
sizeof(SIZE),
|
||||
1);
|
||||
Size->cx = dc->Dc_Attr.szlWindowExt.cx;
|
||||
Size->cy = dc->Dc_Attr.szlWindowExt.cy;
|
||||
Size->cx = Dc_Attr->szlWindowExt.cx;
|
||||
Size->cy = Dc_Attr->szlWindowExt.cy;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
|
@ -860,8 +894,8 @@ NtGdiSetWindowExtEx(HDC hDC,
|
|||
}
|
||||
}
|
||||
|
||||
dc->Dc_Attr.szlWindowExt.cx = XExtent;
|
||||
dc->Dc_Attr.szlWindowExt.cy = YExtent;
|
||||
Dc_Attr->szlWindowExt.cx = XExtent;
|
||||
Dc_Attr->szlWindowExt.cy = YExtent;
|
||||
|
||||
DC_UpdateXforms(dc);
|
||||
DC_UnlockDc(dc);
|
||||
|
@ -877,6 +911,7 @@ NtGdiSetWindowOrgEx(HDC hDC,
|
|||
LPPOINT Point)
|
||||
{
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
dc = DC_LockDc(hDC);
|
||||
if (!dc)
|
||||
|
@ -884,6 +919,8 @@ NtGdiSetWindowOrgEx(HDC hDC,
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
if (Point)
|
||||
{
|
||||
|
@ -894,8 +931,8 @@ NtGdiSetWindowOrgEx(HDC hDC,
|
|||
ProbeForWrite(Point,
|
||||
sizeof(POINT),
|
||||
1);
|
||||
Point->x = dc->Dc_Attr.ptlWindowOrg.x;
|
||||
Point->y = dc->Dc_Attr.ptlWindowOrg.y;
|
||||
Point->x = Dc_Attr->ptlWindowOrg.x;
|
||||
Point->y = Dc_Attr->ptlWindowOrg.y;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
|
@ -911,8 +948,8 @@ NtGdiSetWindowOrgEx(HDC hDC,
|
|||
}
|
||||
}
|
||||
|
||||
dc->Dc_Attr.ptlWindowOrg.x = X;
|
||||
dc->Dc_Attr.ptlWindowOrg.y = Y;
|
||||
Dc_Attr->ptlWindowOrg.x = X;
|
||||
Dc_Attr->ptlWindowOrg.y = Y;
|
||||
|
||||
DC_UpdateXforms(dc);
|
||||
DC_UnlockDc(dc);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/*
|
||||
* ReactOS W32 Subsystem
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
||||
|
@ -55,98 +54,6 @@ InitDcImpl(VOID)
|
|||
|
||||
/* FIXME: DCs should probably be thread safe */
|
||||
|
||||
/*
|
||||
* DC device-independent Get/SetXXX functions
|
||||
* (RJJ) swiped from WINE
|
||||
*/
|
||||
|
||||
#define DC_GET_VAL( func_type, func_name, dc_field ) \
|
||||
func_type STDCALL func_name( HDC hdc ) \
|
||||
{ \
|
||||
func_type ft; \
|
||||
PDC dc = DC_LockDc( hdc ); \
|
||||
if (!dc) \
|
||||
{ \
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE); \
|
||||
return 0; \
|
||||
} \
|
||||
ft = dc->dc_field; \
|
||||
DC_UnlockDc(dc); \
|
||||
return ft; \
|
||||
}
|
||||
|
||||
/* DC_GET_VAL_EX is used to define functions returning a POINT or a SIZE. It is
|
||||
* important that the function has the right signature, for the implementation
|
||||
* we can do whatever we want.
|
||||
*/
|
||||
#define DC_GET_VAL_EX( FuncName, ret_x, ret_y, type, ax, ay ) \
|
||||
VOID FASTCALL Int##FuncName ( PDC dc, LP##type pt) \
|
||||
{ \
|
||||
ASSERT(dc); \
|
||||
ASSERT(pt); \
|
||||
pt->ax = dc->ret_x; \
|
||||
pt->ay = dc->ret_y; \
|
||||
} \
|
||||
BOOL STDCALL NtGdi##FuncName ( HDC hdc, LP##type pt ) \
|
||||
{ \
|
||||
NTSTATUS Status = STATUS_SUCCESS; \
|
||||
type Safept; \
|
||||
PDC dc; \
|
||||
if(!pt) \
|
||||
{ \
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER); \
|
||||
return FALSE; \
|
||||
} \
|
||||
if(!(dc = DC_LockDc(hdc))) \
|
||||
{ \
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE); \
|
||||
return FALSE; \
|
||||
} \
|
||||
Int##FuncName( dc, &Safept); \
|
||||
DC_UnlockDc(dc); \
|
||||
_SEH_TRY \
|
||||
{ \
|
||||
ProbeForWrite(pt, \
|
||||
sizeof( type ), \
|
||||
1); \
|
||||
*pt = Safept; \
|
||||
} \
|
||||
_SEH_HANDLE \
|
||||
{ \
|
||||
Status = _SEH_GetExceptionCode(); \
|
||||
} \
|
||||
_SEH_END; \
|
||||
if(!NT_SUCCESS(Status)) \
|
||||
{ \
|
||||
SetLastNtError(Status); \
|
||||
return FALSE; \
|
||||
} \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define DC_SET_MODE( func_name, dc_field, min_val, max_val ) \
|
||||
INT STDCALL func_name( HDC hdc, INT mode ) \
|
||||
{ \
|
||||
INT prevMode; \
|
||||
PDC dc; \
|
||||
if ((mode < min_val) || (mode > max_val)) \
|
||||
{ \
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER); \
|
||||
return 0; \
|
||||
} \
|
||||
dc = DC_LockDc ( hdc ); \
|
||||
if ( !dc ) \
|
||||
{ \
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE); \
|
||||
return 0; \
|
||||
} \
|
||||
prevMode = dc->dc_field; \
|
||||
dc->dc_field = mode; \
|
||||
DC_UnlockDc ( dc ); \
|
||||
return prevMode; \
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- File Statics
|
||||
|
||||
// ----------------------------------------------------- Public Functions
|
||||
|
@ -162,6 +69,7 @@ HDC STDCALL
|
|||
NtGdiCreateCompatibleDC(HDC hDC)
|
||||
{
|
||||
PDC NewDC, OrigDC;
|
||||
PDC_ATTR nDc_Attr, oDc_Attr;
|
||||
HBITMAP hBitmap;
|
||||
HDC hNewDC, DisplayDC;
|
||||
HRGN hVisRgn;
|
||||
|
@ -192,7 +100,6 @@ NtGdiCreateCompatibleDC(HDC hDC)
|
|||
return NULL;
|
||||
}
|
||||
hNewDC = DC_AllocDC(&OrigDC->DriverName);
|
||||
|
||||
if (NULL == hNewDC)
|
||||
{
|
||||
DC_UnlockDc(OrigDC);
|
||||
|
@ -204,6 +111,11 @@ NtGdiCreateCompatibleDC(HDC hDC)
|
|||
}
|
||||
NewDC = DC_LockDc( hNewDC );
|
||||
|
||||
oDc_Attr = OrigDC->pDc_Attr;
|
||||
if(!oDc_Attr) oDc_Attr = &OrigDC->Dc_Attr;
|
||||
nDc_Attr = NewDC->pDc_Attr;
|
||||
if(!nDc_Attr) nDc_Attr = &NewDC->Dc_Attr;
|
||||
|
||||
/* Copy information from original DC to new DC */
|
||||
NewDC->hSelf = hNewDC;
|
||||
NewDC->IsIC = FALSE;
|
||||
|
@ -214,14 +126,10 @@ NtGdiCreateCompatibleDC(HDC hDC)
|
|||
NewDC->w.bitsPerPixel = OrigDC->w.bitsPerPixel;
|
||||
|
||||
/* DriverName is copied in the AllocDC routine */
|
||||
NewDC->Dc_Attr.ptlWindowOrg.x = OrigDC->Dc_Attr.ptlWindowOrg.x;
|
||||
NewDC->Dc_Attr.ptlWindowOrg.y = OrigDC->Dc_Attr.ptlWindowOrg.y;
|
||||
NewDC->Dc_Attr.szlWindowExt.cx = OrigDC->Dc_Attr.szlWindowExt.cx;
|
||||
NewDC->Dc_Attr.szlWindowExt.cy = OrigDC->Dc_Attr.szlWindowExt.cy;
|
||||
NewDC->Dc_Attr.ptlViewportOrg.x = OrigDC->Dc_Attr.ptlViewportOrg.x;
|
||||
NewDC->Dc_Attr.ptlViewportOrg.y = OrigDC->Dc_Attr.ptlViewportOrg.y;
|
||||
NewDC->Dc_Attr.szlViewportExt.cx = OrigDC->Dc_Attr.szlViewportExt.cx;
|
||||
NewDC->Dc_Attr.szlViewportExt.cy = OrigDC->Dc_Attr.szlViewportExt.cy;
|
||||
nDc_Attr->ptlWindowOrg = oDc_Attr->ptlWindowOrg;
|
||||
nDc_Attr->szlWindowExt = oDc_Attr->szlWindowExt;
|
||||
nDc_Attr->ptlViewportOrg = oDc_Attr->ptlViewportOrg;
|
||||
nDc_Attr->szlViewportExt = oDc_Attr->szlViewportExt;
|
||||
|
||||
/* Create default bitmap */
|
||||
if (!(hBitmap = IntGdiCreateBitmap( 1, 1, 1, NewDC->w.bitsPerPixel, NULL )))
|
||||
|
@ -238,15 +146,15 @@ NtGdiCreateCompatibleDC(HDC hDC)
|
|||
NewDC->w.flags = DC_MEMORY;
|
||||
NewDC->w.hBitmap = hBitmap;
|
||||
NewDC->w.hFirstBitmap = hBitmap;
|
||||
NewDC->pPDev = OrigDC->pPDev;
|
||||
NewDC->pPDev = OrigDC->pPDev;
|
||||
|
||||
NewDC->PalIndexed = OrigDC->PalIndexed;
|
||||
NewDC->w.hPalette = OrigDC->w.hPalette;
|
||||
NewDC->Dc_Attr.crForegroundClr = OrigDC->Dc_Attr.crForegroundClr;
|
||||
NewDC->Dc_Attr.lTextAlign = OrigDC->Dc_Attr.lTextAlign;
|
||||
NewDC->Dc_Attr.crBackgroundClr = OrigDC->Dc_Attr.crBackgroundClr;
|
||||
NewDC->Dc_Attr.jBkMode = OrigDC->Dc_Attr.jBkMode;
|
||||
NewDC->Dc_Attr.jROP2 = OrigDC->Dc_Attr.jROP2;
|
||||
nDc_Attr->crForegroundClr = oDc_Attr->crForegroundClr;
|
||||
nDc_Attr->lTextAlign = oDc_Attr->lTextAlign;
|
||||
nDc_Attr->crBackgroundClr = oDc_Attr->crBackgroundClr;
|
||||
nDc_Attr->jBkMode = oDc_Attr->jBkMode;
|
||||
nDc_Attr->jROP2 = oDc_Attr->jROP2;
|
||||
|
||||
DC_UnlockDc(NewDC);
|
||||
DC_UnlockDc(OrigDC);
|
||||
|
@ -260,8 +168,6 @@ NtGdiCreateCompatibleDC(HDC hDC)
|
|||
NtGdiDeleteObject(hVisRgn);
|
||||
|
||||
DC_InitDC(hNewDC);
|
||||
DCU_SynchDcAttrtoUser(hNewDC, -1);
|
||||
|
||||
return hNewDC;
|
||||
}
|
||||
|
||||
|
@ -815,6 +721,7 @@ IntGdiCreateDC(PUNICODE_STRING Driver,
|
|||
{
|
||||
HDC hNewDC;
|
||||
PDC NewDC;
|
||||
PDC_ATTR nDc_Attr;
|
||||
HDC hDC = NULL;
|
||||
HRGN hVisRgn;
|
||||
UNICODE_STRING StdDriver;
|
||||
|
@ -902,6 +809,9 @@ IntGdiCreateDC(PUNICODE_STRING Driver,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
nDc_Attr = NewDC->pDc_Attr;
|
||||
if(!nDc_Attr) nDc_Attr = &NewDC->Dc_Attr;
|
||||
|
||||
NewDC->DC_Type = DC_TYPE_DIRECT;
|
||||
NewDC->IsIC = CreateAsIC;
|
||||
|
||||
|
@ -918,7 +828,7 @@ IntGdiCreateDC(PUNICODE_STRING Driver,
|
|||
{
|
||||
NewDC->PalIndexed = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
NewDC->w.hPalette = PrimarySurface.DevInfo.hpalDefault;
|
||||
NewDC->Dc_Attr.jROP2 = R2_COPYPEN;
|
||||
nDc_Attr->jROP2 = R2_COPYPEN;
|
||||
|
||||
DC_UnlockDc( NewDC );
|
||||
|
||||
|
@ -933,7 +843,6 @@ IntGdiCreateDC(PUNICODE_STRING Driver,
|
|||
NtGdiSetTextAlign(hNewDC, TA_TOP);
|
||||
NtGdiSetBkColor(hNewDC, RGB(255, 255, 255));
|
||||
NtGdiSetBkMode(hNewDC, OPAQUE);
|
||||
DCU_SynchDcAttrtoUser(hNewDC, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -946,7 +855,6 @@ IntGdiCreateDC(PUNICODE_STRING Driver,
|
|||
NewDC->DC_Type = DC_TYPE_INFO;
|
||||
DC_UnlockDc( NewDC );
|
||||
}
|
||||
|
||||
return hNewDC;
|
||||
}
|
||||
|
||||
|
@ -1101,7 +1009,6 @@ NtGdiDeleteObjectApp(HANDLE DCHandle)
|
|||
|
||||
DC_UnlockDc( DCToDelete );
|
||||
DC_FreeDC ( DCHandle );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1129,15 +1036,13 @@ NtGdiEnumObjects(
|
|||
return 0;
|
||||
}
|
||||
|
||||
DC_GET_VAL( COLORREF, NtGdiGetBkColor, Dc_Attr.crBackgroundClr )
|
||||
DC_GET_VAL( INT, NtGdiGetBkMode, Dc_Attr.jBkMode )
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
NtGdiGetDCObject(HDC hDC, INT ObjectType)
|
||||
{
|
||||
HGDIOBJ SelObject;
|
||||
DC *dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
/* From Wine: GetCurrentObject does not SetLastError() on a null object */
|
||||
if(!hDC) return NULL;
|
||||
|
@ -1147,21 +1052,22 @@ NtGdiGetDCObject(HDC hDC, INT ObjectType)
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
switch(ObjectType)
|
||||
{
|
||||
case GDI_OBJECT_TYPE_EXTPEN:
|
||||
case GDI_OBJECT_TYPE_PEN:
|
||||
SelObject = dc->Dc_Attr.hpen;
|
||||
SelObject = Dc_Attr->hpen;
|
||||
break;
|
||||
case GDI_OBJECT_TYPE_BRUSH:
|
||||
SelObject = dc->Dc_Attr.hbrush;
|
||||
SelObject = Dc_Attr->hbrush;
|
||||
break;
|
||||
case GDI_OBJECT_TYPE_PALETTE:
|
||||
SelObject = dc->w.hPalette;
|
||||
break;
|
||||
case GDI_OBJECT_TYPE_FONT:
|
||||
SelObject = dc->Dc_Attr.hlfntNew;
|
||||
SelObject = Dc_Attr->hlfntNew;
|
||||
break;
|
||||
case GDI_OBJECT_TYPE_BITMAP:
|
||||
SelObject = dc->w.hBitmap;
|
||||
|
@ -1180,8 +1086,6 @@ NtGdiGetDCObject(HDC hDC, INT ObjectType)
|
|||
return SelObject;
|
||||
}
|
||||
|
||||
DC_GET_VAL_EX ( GetCurrentPositionEx, Dc_Attr.ptlCurrent.x, Dc_Attr.ptlCurrent.y, POINT, x, y )
|
||||
|
||||
BOOL FASTCALL
|
||||
IntGdiGetDCOrgEx(DC *dc, LPPOINT Point)
|
||||
{
|
||||
|
@ -1270,80 +1174,59 @@ NtGdiGetDCPoint( HDC hDC, UINT iPoint, PPOINTL Point)
|
|||
return Ret;
|
||||
}
|
||||
|
||||
COLORREF STDCALL
|
||||
NtGdiSetBkColor(HDC hDC, COLORREF color)
|
||||
{
|
||||
COLORREF oldColor;
|
||||
PDC dc;
|
||||
HBRUSH hBrush;
|
||||
|
||||
if (!(dc = DC_LockDc(hDC)))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return CLR_INVALID;
|
||||
}
|
||||
|
||||
oldColor = dc->Dc_Attr.crBackgroundClr;
|
||||
dc->Dc_Attr.crBackgroundClr = color;
|
||||
hBrush = dc->Dc_Attr.hbrush;
|
||||
DC_UnlockDc(dc);
|
||||
NtGdiSelectObject(hDC, hBrush);
|
||||
return oldColor;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
IntGdiCopyToSaveState(PDC dc, PDC newdc)
|
||||
{
|
||||
newdc->w.flags = dc->w.flags | DC_SAVED;
|
||||
newdc->Dc_Attr.hpen = dc->Dc_Attr.hpen;
|
||||
newdc->Dc_Attr.hbrush = dc->Dc_Attr.hbrush;
|
||||
newdc->Dc_Attr.hlfntNew = dc->Dc_Attr.hlfntNew;
|
||||
newdc->w.hBitmap = dc->w.hBitmap;
|
||||
newdc->w.hFirstBitmap = dc->w.hFirstBitmap;
|
||||
PDC_ATTR Dc_Attr, nDc_Attr;
|
||||
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
nDc_Attr = newdc->pDc_Attr;
|
||||
if(!nDc_Attr) nDc_Attr = &newdc->Dc_Attr;
|
||||
|
||||
newdc->w.flags = dc->w.flags | DC_SAVED;
|
||||
nDc_Attr->hpen = Dc_Attr->hpen;
|
||||
nDc_Attr->hbrush = Dc_Attr->hbrush;
|
||||
nDc_Attr->hlfntNew = Dc_Attr->hlfntNew;
|
||||
newdc->w.hBitmap = dc->w.hBitmap;
|
||||
newdc->w.hFirstBitmap = dc->w.hFirstBitmap;
|
||||
#if 0
|
||||
newdc->w.hDevice = dc->w.hDevice;
|
||||
newdc->w.hDevice = dc->w.hDevice;
|
||||
#endif
|
||||
newdc->PalIndexed = dc->PalIndexed;
|
||||
newdc->w.hPalette = dc->w.hPalette;
|
||||
newdc->w.totalExtent = dc->w.totalExtent;
|
||||
newdc->w.bitsPerPixel = dc->w.bitsPerPixel;
|
||||
newdc->Dc_Attr.jROP2 = dc->Dc_Attr.jROP2;
|
||||
newdc->Dc_Attr.jFillMode = dc->Dc_Attr.jFillMode;
|
||||
newdc->Dc_Attr.jStretchBltMode = dc->Dc_Attr.jStretchBltMode;
|
||||
newdc->Dc_Attr.lRelAbs = dc->Dc_Attr.lRelAbs;
|
||||
newdc->Dc_Attr.jBkMode = dc->Dc_Attr.jBkMode;
|
||||
newdc->Dc_Attr.crBackgroundClr = dc->Dc_Attr.crBackgroundClr;
|
||||
newdc->Dc_Attr.crForegroundClr = dc->Dc_Attr.crForegroundClr;
|
||||
newdc->Dc_Attr.ptlBrushOrigin.x = dc->Dc_Attr.ptlBrushOrigin.x;
|
||||
newdc->Dc_Attr.ptlBrushOrigin.y = dc->Dc_Attr.ptlBrushOrigin.y;
|
||||
newdc->Dc_Attr.lTextAlign = dc->Dc_Attr.lTextAlign;
|
||||
newdc->Dc_Attr.lTextExtra = dc->Dc_Attr.lTextExtra;
|
||||
newdc->Dc_Attr.cBreak = dc->Dc_Attr.cBreak;
|
||||
newdc->Dc_Attr.lBreakExtra = dc->Dc_Attr.lBreakExtra;
|
||||
newdc->Dc_Attr.iMapMode = dc->Dc_Attr.iMapMode;
|
||||
newdc->Dc_Attr.iGraphicsMode = dc->Dc_Attr.iGraphicsMode;
|
||||
newdc->PalIndexed = dc->PalIndexed;
|
||||
newdc->w.hPalette = dc->w.hPalette;
|
||||
newdc->w.totalExtent = dc->w.totalExtent;
|
||||
newdc->w.bitsPerPixel = dc->w.bitsPerPixel;
|
||||
nDc_Attr->jROP2 = Dc_Attr->jROP2;
|
||||
nDc_Attr->jFillMode = Dc_Attr->jFillMode;
|
||||
nDc_Attr->jStretchBltMode = Dc_Attr->jStretchBltMode;
|
||||
nDc_Attr->lRelAbs = Dc_Attr->lRelAbs;
|
||||
nDc_Attr->jBkMode = Dc_Attr->jBkMode;
|
||||
nDc_Attr->crBackgroundClr = Dc_Attr->crBackgroundClr;
|
||||
nDc_Attr->crForegroundClr = Dc_Attr->crForegroundClr;
|
||||
nDc_Attr->ptlBrushOrigin = Dc_Attr->ptlBrushOrigin;
|
||||
nDc_Attr->lTextAlign = Dc_Attr->lTextAlign;
|
||||
nDc_Attr->lTextExtra = Dc_Attr->lTextExtra;
|
||||
nDc_Attr->cBreak = Dc_Attr->cBreak;
|
||||
nDc_Attr->lBreakExtra = Dc_Attr->lBreakExtra;
|
||||
nDc_Attr->iMapMode = Dc_Attr->iMapMode;
|
||||
nDc_Attr->iGraphicsMode = Dc_Attr->iGraphicsMode;
|
||||
#if 0
|
||||
/* Apparently, the DC origin is not changed by [GS]etDCState */
|
||||
newdc->w.DCOrgX = dc->w.DCOrgX;
|
||||
newdc->w.DCOrgY = dc->w.DCOrgY;
|
||||
newdc->w.DCOrgX = dc->w.DCOrgX;
|
||||
newdc->w.DCOrgY = dc->w.DCOrgY;
|
||||
#endif
|
||||
newdc->Dc_Attr.ptlCurrent.x = dc->Dc_Attr.ptlCurrent.x;
|
||||
newdc->Dc_Attr.ptlCurrent.y = dc->Dc_Attr.ptlCurrent.y;
|
||||
newdc->w.ArcDirection = dc->w.ArcDirection;
|
||||
newdc->w.xformWorld2Wnd = dc->w.xformWorld2Wnd;
|
||||
newdc->w.xformWorld2Vport = dc->w.xformWorld2Vport;
|
||||
newdc->w.xformVport2World = dc->w.xformVport2World;
|
||||
newdc->w.vport2WorldValid = dc->w.vport2WorldValid;
|
||||
newdc->Dc_Attr.ptlWindowOrg.x = dc->Dc_Attr.ptlWindowOrg.x;
|
||||
newdc->Dc_Attr.ptlWindowOrg.y = dc->Dc_Attr.ptlWindowOrg.y;
|
||||
newdc->Dc_Attr.szlWindowExt.cx = dc->Dc_Attr.szlWindowExt.cx;
|
||||
newdc->Dc_Attr.szlWindowExt.cy = dc->Dc_Attr.szlWindowExt.cy;
|
||||
newdc->Dc_Attr.ptlViewportOrg.x = dc->Dc_Attr.ptlViewportOrg.x;
|
||||
newdc->Dc_Attr.ptlViewportOrg.y = dc->Dc_Attr.ptlViewportOrg.y;
|
||||
newdc->Dc_Attr.szlViewportExt.cx = dc->Dc_Attr.szlViewportExt.cx;
|
||||
newdc->Dc_Attr.szlViewportExt.cy = dc->Dc_Attr.szlViewportExt.cy;
|
||||
nDc_Attr->ptlCurrent = Dc_Attr->ptlCurrent;
|
||||
newdc->w.ArcDirection = dc->w.ArcDirection;
|
||||
newdc->w.xformWorld2Wnd = dc->w.xformWorld2Wnd;
|
||||
newdc->w.xformWorld2Vport = dc->w.xformWorld2Vport;
|
||||
newdc->w.xformVport2World = dc->w.xformVport2World;
|
||||
newdc->w.vport2WorldValid = dc->w.vport2WorldValid;
|
||||
nDc_Attr->ptlWindowOrg = Dc_Attr->ptlWindowOrg;
|
||||
nDc_Attr->szlWindowExt = Dc_Attr->szlWindowExt;
|
||||
nDc_Attr->ptlViewportOrg = Dc_Attr->ptlViewportOrg;
|
||||
nDc_Attr->szlViewportExt = Dc_Attr->szlViewportExt;
|
||||
|
||||
newdc->saveLevel = 0;
|
||||
newdc->IsIC = dc->IsIC;
|
||||
|
@ -1367,52 +1250,53 @@ VOID
|
|||
FASTCALL
|
||||
IntGdiCopyFromSaveState(PDC dc, PDC dcs, HDC hDC)
|
||||
{
|
||||
dc->w.flags = dcs->w.flags & ~DC_SAVED;
|
||||
PDC_ATTR Dc_Attr, sDc_Attr;
|
||||
|
||||
dc->w.hFirstBitmap = dcs->w.hFirstBitmap;
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
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;
|
||||
|
||||
#if 0
|
||||
dc->w.hDevice = dcs->w.hDevice;
|
||||
dc->w.hDevice = dcs->w.hDevice;
|
||||
#endif
|
||||
|
||||
dc->w.totalExtent = dcs->w.totalExtent;
|
||||
dc->Dc_Attr.jROP2 = dcs->Dc_Attr.jROP2;
|
||||
dc->Dc_Attr.jFillMode = dcs->Dc_Attr.jFillMode;
|
||||
dc->Dc_Attr.jStretchBltMode = dcs->Dc_Attr.jStretchBltMode;
|
||||
dc->Dc_Attr.lRelAbs = dcs->Dc_Attr.lRelAbs;
|
||||
dc->Dc_Attr.jBkMode = dcs->Dc_Attr.jBkMode;
|
||||
dc->Dc_Attr.crBackgroundClr = dcs->Dc_Attr.crBackgroundClr;
|
||||
dc->Dc_Attr.crForegroundClr = dcs->Dc_Attr.crForegroundClr;
|
||||
dc->Dc_Attr.ptlBrushOrigin.x = dcs->Dc_Attr.ptlBrushOrigin.x;
|
||||
dc->Dc_Attr.ptlBrushOrigin.y = dcs->Dc_Attr.ptlBrushOrigin.y;
|
||||
dc->Dc_Attr.lTextAlign = dcs->Dc_Attr.lTextAlign;
|
||||
dc->Dc_Attr.lTextExtra = dcs->Dc_Attr.lTextExtra;
|
||||
dc->Dc_Attr.cBreak = dcs->Dc_Attr.cBreak;
|
||||
dc->Dc_Attr.lBreakExtra = dcs->Dc_Attr.lBreakExtra;
|
||||
dc->Dc_Attr.iMapMode = dcs->Dc_Attr.iMapMode;
|
||||
dc->Dc_Attr.iGraphicsMode = dcs->Dc_Attr.iGraphicsMode;
|
||||
dc->w.totalExtent = dcs->w.totalExtent;
|
||||
Dc_Attr->jROP2 = sDc_Attr->jROP2;
|
||||
Dc_Attr->jFillMode = sDc_Attr->jFillMode;
|
||||
Dc_Attr->jStretchBltMode = sDc_Attr->jStretchBltMode;
|
||||
Dc_Attr->lRelAbs = sDc_Attr->lRelAbs;
|
||||
Dc_Attr->jBkMode = sDc_Attr->jBkMode;
|
||||
Dc_Attr->crBackgroundClr = sDc_Attr->crBackgroundClr;
|
||||
Dc_Attr->crForegroundClr = sDc_Attr->crForegroundClr;
|
||||
Dc_Attr->ptlBrushOrigin = sDc_Attr->ptlBrushOrigin;
|
||||
|
||||
Dc_Attr->lTextAlign = sDc_Attr->lTextAlign;
|
||||
Dc_Attr->lTextExtra = sDc_Attr->lTextExtra;
|
||||
Dc_Attr->cBreak = sDc_Attr->cBreak;
|
||||
Dc_Attr->lBreakExtra = sDc_Attr->lBreakExtra;
|
||||
Dc_Attr->iMapMode = sDc_Attr->iMapMode;
|
||||
Dc_Attr->iGraphicsMode = sDc_Attr->iGraphicsMode;
|
||||
#if 0
|
||||
/* Apparently, the DC origin is not changed by [GS]etDCState */
|
||||
dc->w.DCOrgX = dcs->w.DCOrgX;
|
||||
dc->w.DCOrgY = dcs->w.DCOrgY;
|
||||
dc->w.DCOrgX = dcs->w.DCOrgX;
|
||||
dc->w.DCOrgY = dcs->w.DCOrgY;
|
||||
#endif
|
||||
dc->Dc_Attr.ptlCurrent.x = dcs->Dc_Attr.ptlCurrent.x;
|
||||
dc->Dc_Attr.ptlCurrent.y = dcs->Dc_Attr.ptlCurrent.y;
|
||||
dc->w.ArcDirection = dcs->w.ArcDirection;
|
||||
|
||||
dc->w.xformWorld2Wnd = dcs->w.xformWorld2Wnd;
|
||||
dc->w.xformWorld2Vport = dcs->w.xformWorld2Vport;
|
||||
dc->w.xformVport2World = dcs->w.xformVport2World;
|
||||
dc->w.vport2WorldValid = dcs->w.vport2WorldValid;
|
||||
dc->Dc_Attr.ptlWindowOrg.x = dcs->Dc_Attr.ptlWindowOrg.x;
|
||||
dc->Dc_Attr.ptlWindowOrg.y = dcs->Dc_Attr.ptlWindowOrg.y;
|
||||
dc->Dc_Attr.szlWindowExt.cx = dcs->Dc_Attr.szlWindowExt.cx;
|
||||
dc->Dc_Attr.szlWindowExt.cy = dcs->Dc_Attr.szlWindowExt.cy;
|
||||
dc->Dc_Attr.ptlViewportOrg.x = dcs->Dc_Attr.ptlViewportOrg.x;
|
||||
dc->Dc_Attr.ptlViewportOrg.y = dcs->Dc_Attr.ptlViewportOrg.y;
|
||||
dc->Dc_Attr.szlViewportExt.cx = dcs->Dc_Attr.szlViewportExt.cx;
|
||||
dc->Dc_Attr.szlViewportExt.cy = dcs->Dc_Attr.szlViewportExt.cy;
|
||||
dc->PalIndexed = dcs->PalIndexed;
|
||||
Dc_Attr->ptlCurrent = sDc_Attr->ptlCurrent;
|
||||
dc->w.ArcDirection = dcs->w.ArcDirection;
|
||||
dc->w.xformWorld2Wnd = dcs->w.xformWorld2Wnd;
|
||||
dc->w.xformWorld2Vport = dcs->w.xformWorld2Vport;
|
||||
dc->w.xformVport2World = dcs->w.xformVport2World;
|
||||
dc->w.vport2WorldValid = dcs->w.vport2WorldValid;
|
||||
Dc_Attr->ptlWindowOrg = sDc_Attr->ptlWindowOrg;
|
||||
Dc_Attr->szlWindowExt = sDc_Attr->szlWindowExt;
|
||||
Dc_Attr->ptlViewportOrg = sDc_Attr->ptlViewportOrg;
|
||||
Dc_Attr->szlViewportExt = sDc_Attr->szlViewportExt;
|
||||
dc->PalIndexed = dcs->PalIndexed;
|
||||
|
||||
if (!(dc->w.flags & DC_MEMORY))
|
||||
{
|
||||
|
@ -1449,12 +1333,12 @@ IntGdiCopyFromSaveState(PDC dc, PDC dcs, HDC hDC)
|
|||
if(!hDC) return; // Not a MemoryDC or SaveLevel DC, return.
|
||||
|
||||
NtGdiSelectObject( hDC, dcs->w.hBitmap );
|
||||
NtGdiSelectObject( hDC, dcs->Dc_Attr.hbrush );
|
||||
NtGdiSelectObject( hDC, dcs->Dc_Attr.hlfntNew );
|
||||
NtGdiSelectObject( hDC, dcs->Dc_Attr.hpen );
|
||||
NtGdiSelectObject( hDC, sDc_Attr->hbrush );
|
||||
NtGdiSelectObject( hDC, sDc_Attr->hlfntNew );
|
||||
NtGdiSelectObject( hDC, sDc_Attr->hpen );
|
||||
|
||||
NtGdiSetBkColor( hDC, dcs->Dc_Attr.crBackgroundClr);
|
||||
NtGdiSetTextColor( hDC, dcs->Dc_Attr.crForegroundClr);
|
||||
NtGdiSetBkColor( hDC, sDc_Attr->crBackgroundClr);
|
||||
NtGdiSetTextColor( hDC, sDc_Attr->crForegroundClr);
|
||||
|
||||
NtUserSelectPalette( hDC, dcs->w.hPalette, FALSE );
|
||||
|
||||
|
@ -1489,7 +1373,6 @@ IntGdiGetDCState(HDC hDC)
|
|||
newdc->hSelf = hnewdc;
|
||||
IntGdiCopyToSaveState( dc, newdc);
|
||||
|
||||
// DCU_SyncDcAttrtoUser(newdc, -1);
|
||||
DC_UnlockDc( newdc );
|
||||
DC_UnlockDc( dc );
|
||||
return hnewdc;
|
||||
|
@ -1745,9 +1628,6 @@ NtGdiGetDeviceCaps(HDC hDC,
|
|||
return ret;
|
||||
}
|
||||
|
||||
DC_GET_VAL( INT, NtGdiGetMapMode, Dc_Attr.iMapMode )
|
||||
DC_GET_VAL( INT, NtGdiGetPolyFillMode, Dc_Attr.jFillMode )
|
||||
|
||||
INT
|
||||
FASTCALL
|
||||
IntGdiGetObject(IN HANDLE Handle,
|
||||
|
@ -1853,15 +1733,6 @@ NtGdiExtGetObjectW(IN HANDLE hGdiObj,
|
|||
return iRetCount;
|
||||
}
|
||||
|
||||
DC_GET_VAL( INT, NtGdiGetROP2, Dc_Attr.jROP2 )
|
||||
DC_GET_VAL( INT, NtGdiGetStretchBltMode, Dc_Attr.jStretchBltMode )
|
||||
DC_GET_VAL( UINT, NtGdiGetTextAlign, Dc_Attr.lTextAlign )
|
||||
DC_GET_VAL( COLORREF, NtGdiGetTextColor, Dc_Attr.crForegroundClr )
|
||||
DC_GET_VAL_EX( GetViewportExtEx, Dc_Attr.szlViewportExt.cx, Dc_Attr.szlViewportExt.cy, SIZE, cx, cy )
|
||||
DC_GET_VAL_EX( GetViewportOrgEx, Dc_Attr.ptlViewportOrg.x, Dc_Attr.ptlViewportOrg.y, POINT, x, y )
|
||||
DC_GET_VAL_EX( GetWindowExtEx, Dc_Attr.szlWindowExt.cx, Dc_Attr.szlWindowExt.cy, SIZE, cx, cy )
|
||||
DC_GET_VAL_EX( GetWindowOrgEx, Dc_Attr.ptlWindowOrg.x, Dc_Attr.ptlWindowOrg.y, POINT, x, y )
|
||||
|
||||
BOOL
|
||||
APIENTRY
|
||||
NtGdiResetDC(
|
||||
|
@ -2003,6 +1874,7 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
|||
HGDIOBJ objOrg = NULL; // default to failure
|
||||
BITMAPOBJ *pb;
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
PGDIBRUSHOBJ pen;
|
||||
PGDIBRUSHOBJ brush;
|
||||
XLATEOBJ *XlateObj;
|
||||
|
@ -2027,7 +1899,9 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
objectType = GDIOBJ_GetObjectType(hGDIObj);
|
||||
|
||||
switch (objectType)
|
||||
|
@ -2048,8 +1922,8 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
|||
break;
|
||||
}
|
||||
|
||||
objOrg = (HGDIOBJ)dc->Dc_Attr.hpen;
|
||||
dc->Dc_Attr.hpen = hGDIObj;
|
||||
objOrg = (HGDIOBJ)Dc_Attr->hpen;
|
||||
Dc_Attr->hpen = hGDIObj;
|
||||
if (dc->XlatePen != NULL)
|
||||
EngDeleteXlate(dc->XlatePen);
|
||||
dc->XlatePen = XlateObj;
|
||||
|
@ -2071,8 +1945,8 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
|||
break;
|
||||
}
|
||||
|
||||
objOrg = (HGDIOBJ)dc->Dc_Attr.hbrush;
|
||||
dc->Dc_Attr.hbrush = hGDIObj;
|
||||
objOrg = (HGDIOBJ)Dc_Attr->hbrush;
|
||||
Dc_Attr->hbrush = hGDIObj;
|
||||
if (dc->XlateBrush != NULL)
|
||||
EngDeleteXlate(dc->XlateBrush);
|
||||
dc->XlateBrush = XlateObj;
|
||||
|
@ -2081,8 +1955,8 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
|||
case GDI_OBJECT_TYPE_FONT:
|
||||
if(NT_SUCCESS(TextIntRealizeFont((HFONT)hGDIObj)))
|
||||
{
|
||||
objOrg = (HGDIOBJ)dc->Dc_Attr.hlfntNew;
|
||||
dc->Dc_Attr.hlfntNew = (HFONT) hGDIObj;
|
||||
objOrg = (HGDIOBJ)Dc_Attr->hlfntNew;
|
||||
Dc_Attr->hlfntNew = (HFONT) hGDIObj;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2118,8 +1992,8 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
|||
}
|
||||
|
||||
/* Reselect brush and pen to regenerate the XLATEOBJs. */
|
||||
NtGdiSelectObject ( hDC, dc->Dc_Attr.hbrush );
|
||||
NtGdiSelectObject ( hDC, dc->Dc_Attr.hpen );
|
||||
NtGdiSelectObject ( hDC, Dc_Attr->hbrush );
|
||||
NtGdiSelectObject ( hDC, Dc_Attr->hpen );
|
||||
|
||||
DC_UnlockDc ( dc );
|
||||
hVisRgn = NtGdiCreateRectRgn ( 0, 0, pb->SurfObj.sizlBitmap.cx, pb->SurfObj.sizlBitmap.cy );
|
||||
|
@ -2143,7 +2017,6 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
// DCU_SyncDcAttrtoUser(dc, -1);
|
||||
DC_UnlockDc( dc );
|
||||
return objOrg;
|
||||
}
|
||||
|
@ -2192,7 +2065,9 @@ NtGdiGetDCDword(
|
|||
)
|
||||
{
|
||||
BOOL Ret = TRUE;
|
||||
DC *dc;
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
DWORD SafeResult = 0;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
|
@ -2208,19 +2083,21 @@ NtGdiGetDCDword(
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
switch (u)
|
||||
{
|
||||
case GdiGetJournal:
|
||||
break;
|
||||
case GdiGetRelAbs:
|
||||
SafeResult = dc->Dc_Attr.lRelAbs;
|
||||
SafeResult = Dc_Attr->lRelAbs;
|
||||
break;
|
||||
case GdiGetBreakExtra:
|
||||
SafeResult = dc->Dc_Attr.lBreakExtra;
|
||||
SafeResult = Dc_Attr->lBreakExtra;
|
||||
break;
|
||||
case GdiGerCharBreak:
|
||||
SafeResult = dc->Dc_Attr.cBreak;
|
||||
SafeResult = Dc_Attr->cBreak;
|
||||
break;
|
||||
case GdiGetArcDirection:
|
||||
SafeResult = dc->w.ArcDirection;
|
||||
|
@ -2233,10 +2110,10 @@ NtGdiGetDCDword(
|
|||
SafeResult = dc->DC_Type;
|
||||
break;
|
||||
case GdiGetMapMode:
|
||||
SafeResult = dc->Dc_Attr.iMapMode;
|
||||
SafeResult = Dc_Attr->iMapMode;
|
||||
break;
|
||||
case GdiGetTextCharExtra:
|
||||
SafeResult = dc->Dc_Attr.lTextExtra;
|
||||
SafeResult = Dc_Attr->lTextExtra;
|
||||
break;
|
||||
default:
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
|
@ -2281,7 +2158,9 @@ NtGdiGetAndSetDCDword(
|
|||
)
|
||||
{
|
||||
BOOL Ret = TRUE;
|
||||
DC *dc;
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
DWORD SafeResult = 0;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
|
@ -2297,23 +2176,25 @@ NtGdiGetAndSetDCDword(
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
switch (u)
|
||||
{
|
||||
case GdtGetSetCopyCount:
|
||||
break;
|
||||
case GdiGetSetTextAlign:
|
||||
SafeResult = dc->Dc_Attr.lTextAlign;
|
||||
dc->Dc_Attr.lTextAlign = dwIn;
|
||||
dc->Dc_Attr.flTextAlign = dwIn;
|
||||
SafeResult = Dc_Attr->lTextAlign;
|
||||
Dc_Attr->lTextAlign = dwIn;
|
||||
// Dc_Attr->flTextAlign = dwIn; // Flags!
|
||||
break;
|
||||
case GdiGetSetRelAbs:
|
||||
SafeResult = dc->Dc_Attr.lRelAbs;
|
||||
dc->Dc_Attr.lRelAbs = dwIn;
|
||||
SafeResult = Dc_Attr->lRelAbs;
|
||||
Dc_Attr->lRelAbs = dwIn;
|
||||
break;
|
||||
case GdiGetSetTextCharExtra:
|
||||
SafeResult = dc->Dc_Attr.lTextExtra;
|
||||
dc->Dc_Attr.lTextExtra = dwIn;
|
||||
SafeResult = Dc_Attr->lTextExtra;
|
||||
Dc_Attr->lTextExtra = dwIn;
|
||||
break;
|
||||
case GdiGetSetSelectFont:
|
||||
break;
|
||||
|
@ -2364,18 +2245,13 @@ NtGdiGetAndSetDCDword(
|
|||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
DC_SET_MODE( NtGdiSetBkMode, Dc_Attr.jBkMode, TRANSPARENT, OPAQUE )
|
||||
DC_SET_MODE( NtGdiSetPolyFillMode, Dc_Attr.jFillMode, ALTERNATE, WINDING )
|
||||
DC_SET_MODE( NtGdiSetROP2, Dc_Attr.jROP2, R2_BLACK, R2_WHITE )
|
||||
DC_SET_MODE( NtGdiSetStretchBltMode, Dc_Attr.jStretchBltMode, BLACKONWHITE, HALFTONE )
|
||||
|
||||
// ---------------------------------------------------- Private Interface
|
||||
|
||||
HDC FASTCALL
|
||||
DC_AllocDC(PUNICODE_STRING Driver)
|
||||
{
|
||||
PDC NewDC;
|
||||
PDC_ATTR Dc_Attr;
|
||||
HDC hDC;
|
||||
PWSTR Buf = NULL;
|
||||
|
||||
|
@ -2408,7 +2284,9 @@ DC_AllocDC(PUNICODE_STRING Driver)
|
|||
RtlCopyMemory(&NewDC->DriverName, Driver, sizeof(UNICODE_STRING));
|
||||
NewDC->DriverName.Buffer = Buf;
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -2421,31 +2299,31 @@ DC_AllocDC(PUNICODE_STRING Driver)
|
|||
NewDC->w.vport2WorldValid = TRUE;
|
||||
|
||||
// Setup syncing bits for the dcattr data packets.
|
||||
NewDC->Dc_Attr.flXform = DEVICE_TO_PAGE_INVALID;
|
||||
Dc_Attr->flXform = DEVICE_TO_PAGE_INVALID;
|
||||
|
||||
NewDC->Dc_Attr.ulDirty_ = 0; // Server side
|
||||
Dc_Attr->ulDirty_ = 0; // Server side
|
||||
|
||||
NewDC->Dc_Attr.iMapMode = MM_TEXT;
|
||||
Dc_Attr->iMapMode = MM_TEXT;
|
||||
|
||||
NewDC->Dc_Attr.szlWindowExt.cx = 1; // Float to Int,,, WRONG!
|
||||
NewDC->Dc_Attr.szlWindowExt.cy = 1;
|
||||
NewDC->Dc_Attr.szlViewportExt.cx = 1;
|
||||
NewDC->Dc_Attr.szlViewportExt.cy = 1;
|
||||
Dc_Attr->szlWindowExt.cx = 1; // Float to Int,,, WRONG!
|
||||
Dc_Attr->szlWindowExt.cy = 1;
|
||||
Dc_Attr->szlViewportExt.cx = 1;
|
||||
Dc_Attr->szlViewportExt.cy = 1;
|
||||
|
||||
NewDC->Dc_Attr.crForegroundClr = 0;
|
||||
NewDC->Dc_Attr.ulForegroundClr = 0;
|
||||
Dc_Attr->crForegroundClr = 0;
|
||||
Dc_Attr->ulForegroundClr = 0;
|
||||
|
||||
NewDC->Dc_Attr.ulBackgroundClr = 0xffffff;
|
||||
NewDC->Dc_Attr.crBackgroundClr = 0xffffff;
|
||||
Dc_Attr->ulBackgroundClr = 0xffffff;
|
||||
Dc_Attr->crBackgroundClr = 0xffffff;
|
||||
|
||||
NewDC->Dc_Attr.ulPenClr = RGB( 0, 0, 0 );
|
||||
NewDC->Dc_Attr.crPenClr = RGB( 0, 0, 0 );
|
||||
Dc_Attr->ulPenClr = RGB( 0, 0, 0 );
|
||||
Dc_Attr->crPenClr = RGB( 0, 0, 0 );
|
||||
|
||||
NewDC->Dc_Attr.ulBrushClr = RGB( 255, 255, 255 ); // Do this way too.
|
||||
NewDC->Dc_Attr.crBrushClr = RGB( 255, 255, 255 );
|
||||
Dc_Attr->ulBrushClr = RGB( 255, 255, 255 ); // Do this way too.
|
||||
Dc_Attr->crBrushClr = RGB( 255, 255, 255 );
|
||||
|
||||
NewDC->Dc_Attr.hlfntNew = NtGdiGetStockObject(SYSTEM_FONT);
|
||||
TextIntRealizeFont(NewDC->Dc_Attr.hlfntNew);
|
||||
Dc_Attr->hlfntNew = NtGdiGetStockObject(SYSTEM_FONT);
|
||||
TextIntRealizeFont(Dc_Attr->hlfntNew);
|
||||
|
||||
NewDC->w.hPalette = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
|
||||
|
@ -2595,16 +2473,18 @@ DC_UpdateXforms(PDC dc)
|
|||
{
|
||||
XFORM xformWnd2Vport;
|
||||
FLOAT scaleX, scaleY;
|
||||
PDC_ATTR Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
/* Construct a transformation to do the window-to-viewport conversion */
|
||||
scaleX = (dc->Dc_Attr.szlWindowExt.cx ? (FLOAT)dc->Dc_Attr.szlViewportExt.cx / (FLOAT)dc->Dc_Attr.szlWindowExt.cx : 0.0f);
|
||||
scaleY = (dc->Dc_Attr.szlWindowExt.cy ? (FLOAT)dc->Dc_Attr.szlViewportExt.cy / (FLOAT)dc->Dc_Attr.szlWindowExt.cy : 0.0f);
|
||||
scaleX = (Dc_Attr->szlWindowExt.cx ? (FLOAT)Dc_Attr->szlViewportExt.cx / (FLOAT)Dc_Attr->szlWindowExt.cx : 0.0f);
|
||||
scaleY = (Dc_Attr->szlWindowExt.cy ? (FLOAT)Dc_Attr->szlViewportExt.cy / (FLOAT)Dc_Attr->szlWindowExt.cy : 0.0f);
|
||||
xformWnd2Vport.eM11 = scaleX;
|
||||
xformWnd2Vport.eM12 = 0.0;
|
||||
xformWnd2Vport.eM21 = 0.0;
|
||||
xformWnd2Vport.eM22 = scaleY;
|
||||
xformWnd2Vport.eDx = (FLOAT)dc->Dc_Attr.ptlViewportOrg.x - scaleX * (FLOAT)dc->Dc_Attr.ptlWindowOrg.x;
|
||||
xformWnd2Vport.eDy = (FLOAT)dc->Dc_Attr.ptlViewportOrg.y - scaleY * (FLOAT)dc->Dc_Attr.ptlWindowOrg.y;
|
||||
xformWnd2Vport.eDx = (FLOAT)Dc_Attr->ptlViewportOrg.x - scaleX * (FLOAT)Dc_Attr->ptlWindowOrg.x;
|
||||
xformWnd2Vport.eDy = (FLOAT)Dc_Attr->ptlViewportOrg.y - scaleY * (FLOAT)Dc_Attr->ptlWindowOrg.y;
|
||||
|
||||
/* Combine with the world transformation */
|
||||
IntGdiCombineTransform(&dc->w.xformWorld2Vport, &dc->w.xformWorld2Wnd, &xformWnd2Vport);
|
||||
|
|
|
@ -4,6 +4,107 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/*
|
||||
* DC device-independent Get/SetXXX functions
|
||||
* (RJJ) swiped from WINE
|
||||
*/
|
||||
|
||||
#define DC_GET_VAL( func_type, func_name, dc_field ) \
|
||||
func_type STDCALL func_name( HDC hdc ) \
|
||||
{ \
|
||||
func_type ft; \
|
||||
PDC dc = DC_LockDc( hdc ); \
|
||||
PDC_ATTR Dc_Attr; \
|
||||
if (!dc) \
|
||||
{ \
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE); \
|
||||
return 0; \
|
||||
} \
|
||||
Dc_Attr = dc->pDc_Attr; \
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr; \
|
||||
ft = Dc_Attr->dc_field; \
|
||||
DC_UnlockDc(dc); \
|
||||
return ft; \
|
||||
}
|
||||
|
||||
/* DC_GET_VAL_EX is used to define functions returning a POINT or a SIZE. It is
|
||||
* important that the function has the right signature, for the implementation
|
||||
* we can do whatever we want.
|
||||
*/
|
||||
#define DC_GET_VAL_EX( FuncName, ret_x, ret_y, type, ax, ay ) \
|
||||
VOID FASTCALL Int##FuncName ( PDC dc, LP##type pt) \
|
||||
{ \
|
||||
PDC_ATTR Dc_Attr; \
|
||||
ASSERT(dc); \
|
||||
ASSERT(pt); \
|
||||
Dc_Attr = dc->pDc_Attr; \
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr; \
|
||||
pt->ax = Dc_Attr->ret_x; \
|
||||
pt->ay = Dc_Attr->ret_y; \
|
||||
} \
|
||||
BOOL STDCALL NtGdi##FuncName ( HDC hdc, LP##type pt ) \
|
||||
{ \
|
||||
NTSTATUS Status = STATUS_SUCCESS; \
|
||||
type Safept; \
|
||||
PDC dc; \
|
||||
if(!pt) \
|
||||
{ \
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER); \
|
||||
return FALSE; \
|
||||
} \
|
||||
if(!(dc = DC_LockDc(hdc))) \
|
||||
{ \
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE); \
|
||||
return FALSE; \
|
||||
} \
|
||||
Int##FuncName( dc, &Safept); \
|
||||
DC_UnlockDc(dc); \
|
||||
_SEH_TRY \
|
||||
{ \
|
||||
ProbeForWrite(pt, \
|
||||
sizeof( type ), \
|
||||
1); \
|
||||
*pt = Safept; \
|
||||
} \
|
||||
_SEH_HANDLE \
|
||||
{ \
|
||||
Status = _SEH_GetExceptionCode(); \
|
||||
} \
|
||||
_SEH_END; \
|
||||
if(!NT_SUCCESS(Status)) \
|
||||
{ \
|
||||
SetLastNtError(Status); \
|
||||
return FALSE; \
|
||||
} \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define DC_SET_MODE( func_name, dc_field, min_val, max_val ) \
|
||||
INT STDCALL func_name( HDC hdc, INT mode ) \
|
||||
{ \
|
||||
INT prevMode; \
|
||||
PDC dc; \
|
||||
PDC_ATTR Dc_Attr; \
|
||||
if ((mode < min_val) || (mode > max_val)) \
|
||||
{ \
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER); \
|
||||
return 0; \
|
||||
} \
|
||||
dc = DC_LockDc ( hdc ); \
|
||||
if ( !dc ) \
|
||||
{ \
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE); \
|
||||
return 0; \
|
||||
} \
|
||||
Dc_Attr = dc->pDc_Attr; \
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr; \
|
||||
prevMode = Dc_Attr->dc_field; \
|
||||
Dc_Attr->dc_field = mode; \
|
||||
DC_UnlockDc ( dc ); \
|
||||
return prevMode; \
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
VOID
|
||||
CopytoUserDcAttr(PDC dc, PDC_ATTR Dc_Attr, FLONG Dirty)
|
||||
|
@ -46,7 +147,9 @@ CopytoUserDcAttr(PDC dc, PDC_ATTR Dc_Attr, FLONG Dirty)
|
|||
Dc_Attr->szlViewportExt = dc->Dc_Attr.szlViewportExt;
|
||||
|
||||
Dc_Attr->ulDirty_ = dc->Dc_Attr.ulDirty_; //Copy flags! We may have set them.
|
||||
|
||||
|
||||
MmCopyToCaller(Dc_Attr, &dc->Dc_Attr, sizeof(DC_ATTR));
|
||||
|
||||
XForm2MatrixS( &Dc_Attr->mxWorldToDevice, &dc->w.xformWorld2Vport);
|
||||
XForm2MatrixS( &Dc_Attr->mxDevicetoWorld, &dc->w.xformVport2World);
|
||||
XForm2MatrixS( &Dc_Attr->mxWorldToPage, &dc->w.xformWorld2Wnd);
|
||||
|
@ -80,3 +183,48 @@ DCU_SynchDcAttrtoUser(HDC hDC, FLONG Dirty)
|
|||
}
|
||||
|
||||
|
||||
DC_GET_VAL( INT, NtGdiGetMapMode, iMapMode )
|
||||
DC_GET_VAL( INT, NtGdiGetPolyFillMode, jFillMode )
|
||||
DC_GET_VAL( COLORREF, NtGdiGetBkColor, crBackgroundClr )
|
||||
DC_GET_VAL( INT, NtGdiGetBkMode, jBkMode )
|
||||
DC_GET_VAL( INT, NtGdiGetROP2, jROP2 )
|
||||
DC_GET_VAL( INT, NtGdiGetStretchBltMode, jStretchBltMode )
|
||||
DC_GET_VAL( UINT, NtGdiGetTextAlign, lTextAlign )
|
||||
DC_GET_VAL( COLORREF, NtGdiGetTextColor, crForegroundClr )
|
||||
|
||||
DC_GET_VAL_EX( GetViewportExtEx, szlViewportExt.cx, szlViewportExt.cy, SIZE, cx, cy )
|
||||
DC_GET_VAL_EX( GetViewportOrgEx, ptlViewportOrg.x, ptlViewportOrg.y, POINT, x, y )
|
||||
DC_GET_VAL_EX( GetWindowExtEx, szlWindowExt.cx, szlWindowExt.cy, SIZE, cx, cy )
|
||||
DC_GET_VAL_EX( GetWindowOrgEx, ptlWindowOrg.x, ptlWindowOrg.y, POINT, x, y )
|
||||
DC_GET_VAL_EX ( GetCurrentPositionEx, ptlCurrent.x, ptlCurrent.y, POINT, x, y )
|
||||
|
||||
DC_SET_MODE( NtGdiSetBkMode, jBkMode, TRANSPARENT, OPAQUE )
|
||||
DC_SET_MODE( NtGdiSetPolyFillMode, jFillMode, ALTERNATE, WINDING )
|
||||
DC_SET_MODE( NtGdiSetROP2, jROP2, R2_BLACK, R2_WHITE )
|
||||
DC_SET_MODE( NtGdiSetStretchBltMode, jStretchBltMode, BLACKONWHITE, HALFTONE )
|
||||
|
||||
|
||||
|
||||
COLORREF STDCALL
|
||||
NtGdiSetBkColor(HDC hDC, COLORREF color)
|
||||
{
|
||||
COLORREF oldColor;
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
HBRUSH hBrush;
|
||||
|
||||
if (!(dc = DC_LockDc(hDC)))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return CLR_INVALID;
|
||||
}
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
oldColor = Dc_Attr->crBackgroundClr;
|
||||
Dc_Attr->crBackgroundClr = color;
|
||||
hBrush = Dc_Attr->hbrush;
|
||||
DC_UnlockDc(dc);
|
||||
NtGdiSelectObject(hDC, hBrush);
|
||||
return oldColor;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
&BrushInst.BrushObject, \
|
||||
x, y, (x)+1, y, \
|
||||
&RectBounds, \
|
||||
ROP2_TO_MIX(dc->Dc_Attr.jROP2));
|
||||
ROP2_TO_MIX(Dc_Attr->jROP2));
|
||||
|
||||
#define PUTLINE(x1,y1,x2,y2,BrushInst) \
|
||||
ret = ret && IntEngLineTo(&BitmapObj->SurfObj, \
|
||||
|
@ -39,7 +39,7 @@
|
|||
&BrushInst.BrushObject, \
|
||||
x1, y1, x2, y2, \
|
||||
&RectBounds, \
|
||||
ROP2_TO_MIX(dc->Dc_Attr.jROP2));
|
||||
ROP2_TO_MIX(Dc_Attr->jROP2));
|
||||
|
||||
BOOL FASTCALL
|
||||
IntGdiPolygon(PDC dc,
|
||||
|
@ -52,6 +52,7 @@ IntGdiPolygon(PDC dc,
|
|||
BOOL ret = FALSE; // default to failure
|
||||
RECTL DestRect;
|
||||
int CurrentPoint;
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
ASSERT(dc); // caller's responsibility to pass a valid dc
|
||||
|
||||
|
@ -61,6 +62,9 @@ IntGdiPolygon(PDC dc,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
|
||||
/* FIXME - BitmapObj can be NULL!!!! don't assert but handle this case gracefully! */
|
||||
ASSERT(BitmapObj);
|
||||
|
@ -91,16 +95,16 @@ IntGdiPolygon(PDC dc,
|
|||
}
|
||||
|
||||
/* Now fill the polygon with the current brush. */
|
||||
FillBrushObj = BRUSHOBJ_LockBrush(dc->Dc_Attr.hbrush);
|
||||
FillBrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
|
||||
if (FillBrushObj && !(FillBrushObj->flAttrs & GDIBRUSH_IS_NULL))
|
||||
{
|
||||
IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush);
|
||||
ret = FillPolygon ( dc, BitmapObj, &FillBrushInst.BrushObject, ROP2_TO_MIX(dc->Dc_Attr.jROP2), UnsafePoints, Count, DestRect );
|
||||
ret = FillPolygon ( dc, BitmapObj, &FillBrushInst.BrushObject, ROP2_TO_MIX(Dc_Attr->jROP2), UnsafePoints, Count, DestRect );
|
||||
}
|
||||
BRUSHOBJ_UnlockBrush(FillBrushObj);
|
||||
|
||||
/* get BRUSHOBJ from current pen. */
|
||||
PenBrushObj = PENOBJ_LockPen(dc->Dc_Attr.hpen);
|
||||
PenBrushObj = PENOBJ_LockPen(Dc_Attr->hpen);
|
||||
// Draw the Polygon Edges with the current pen ( if not a NULL pen )
|
||||
if (PenBrushObj && !(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL))
|
||||
{
|
||||
|
@ -123,7 +127,7 @@ IntGdiPolygon(PDC dc,
|
|||
UnsafePoints[i+1].x, /* To */
|
||||
UnsafePoints[i+1].y,
|
||||
&DestRect,
|
||||
ROP2_TO_MIX(dc->Dc_Attr.jROP2)); /* MIX */
|
||||
ROP2_TO_MIX(Dc_Attr->jROP2)); /* MIX */
|
||||
if (!ret) break;
|
||||
}
|
||||
/* Close the polygon */
|
||||
|
@ -137,7 +141,7 @@ IntGdiPolygon(PDC dc,
|
|||
UnsafePoints[0].x, /* To */
|
||||
UnsafePoints[0].y,
|
||||
&DestRect,
|
||||
ROP2_TO_MIX(dc->Dc_Attr.jROP2)); /* MIX */
|
||||
ROP2_TO_MIX(Dc_Attr->jROP2)); /* MIX */
|
||||
}
|
||||
}
|
||||
PENOBJ_UnlockPen(PenBrushObj);
|
||||
|
@ -199,6 +203,7 @@ NtGdiEllipse(
|
|||
BITMAPOBJ *BitmapObj;
|
||||
RECTL RectBounds;
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
BOOL ret = TRUE, Cond1, Cond2;
|
||||
|
||||
/*
|
||||
|
@ -228,7 +233,10 @@ NtGdiEllipse(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
FillBrush = BRUSHOBJ_LockBrush(dc->Dc_Attr.hbrush);
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
FillBrush = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
|
||||
if (NULL == FillBrush)
|
||||
{
|
||||
DC_UnlockDc(dc);
|
||||
|
@ -236,7 +244,7 @@ NtGdiEllipse(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
PenBrush = PENOBJ_LockPen(dc->Dc_Attr.hpen);
|
||||
PenBrush = PENOBJ_LockPen(Dc_Attr->hpen);
|
||||
if (NULL == PenBrush)
|
||||
{
|
||||
BRUSHOBJ_UnlockBrush(FillBrush);
|
||||
|
@ -629,6 +637,7 @@ NtGdiPie(HDC hDC,
|
|||
{
|
||||
#ifdef TODO
|
||||
PDC dc;
|
||||
PDC_ATTR;
|
||||
RECTL RectBounds;
|
||||
SURFOBJ *SurfObj;
|
||||
BRUSHOBJ PenBrushObj;
|
||||
|
@ -663,7 +672,10 @@ NtGdiPie(HDC hDC,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
FillBrushObj = BRUSHOBJ_LockBrush(dc->Dc_Attr.hbrush);
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
FillBrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
|
||||
if (NULL == FillBrushObj)
|
||||
{
|
||||
DC_UnlockDc(dc);
|
||||
|
@ -686,7 +698,7 @@ NtGdiPie(HDC hDC,
|
|||
RectBounds.bottom = Bottom;
|
||||
|
||||
SurfObj = (SURFOBJ*) AccessUserObject((ULONG)dc->Surface);
|
||||
HPenToBrushObj(&PenBrushObj, dc->Dc_Attr.hpen);
|
||||
HPenToBrushObj(&PenBrushObj, Dc_Attr->hpen);
|
||||
|
||||
/* Number of points for the circle is 4 * sqrt(2) * Radius, start
|
||||
and end line have at most Radius points, so allocate at least
|
||||
|
@ -1020,11 +1032,15 @@ IntRectangle(PDC dc,
|
|||
BOOL ret = FALSE; // default to failure
|
||||
RECTL DestRect;
|
||||
MIX Mix;
|
||||
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
ASSERT ( dc ); // caller's responsibility to set this up
|
||||
/* FIXME - BitmapObj can be NULL!!! Don't assert but handle this case gracefully! */
|
||||
ASSERT ( BitmapObj );
|
||||
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
if ( PATH_IsPathOpen(dc->w.path) )
|
||||
{
|
||||
ret = PATH_Rectangle ( dc, LeftRect, TopRect, RightRect, BottomRect );
|
||||
|
@ -1041,7 +1057,7 @@ IntRectangle(PDC dc,
|
|||
DestRect.top = TopRect;
|
||||
DestRect.bottom = BottomRect;
|
||||
|
||||
FillBrushObj = BRUSHOBJ_LockBrush(dc->Dc_Attr.hbrush);
|
||||
FillBrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
|
||||
|
||||
if ( FillBrushObj )
|
||||
{
|
||||
|
@ -1065,7 +1081,7 @@ IntRectangle(PDC dc,
|
|||
BRUSHOBJ_UnlockBrush(FillBrushObj);
|
||||
|
||||
/* get BRUSHOBJ from current pen. */
|
||||
PenBrushObj = PENOBJ_LockPen(dc->Dc_Attr.hpen);
|
||||
PenBrushObj = PENOBJ_LockPen(Dc_Attr->hpen);
|
||||
if (PenBrushObj == NULL)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
|
@ -1081,7 +1097,7 @@ IntRectangle(PDC dc,
|
|||
|
||||
if (!(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL))
|
||||
{
|
||||
Mix = ROP2_TO_MIX(dc->Dc_Attr.jROP2);
|
||||
Mix = ROP2_TO_MIX(Dc_Attr->jROP2);
|
||||
ret = ret && IntEngLineTo(&BitmapObj->SurfObj,
|
||||
dc->CombinedClip,
|
||||
&PenBrushInst.BrushObject,
|
||||
|
@ -1164,6 +1180,7 @@ IntRoundRect(
|
|||
int xCurveDiameter,
|
||||
int yCurveDiameter)
|
||||
{
|
||||
PDC_ATTR Dc_Attr;
|
||||
BITMAPOBJ *BitmapObj;
|
||||
PGDIBRUSHOBJ PenBrushObj, FillBrushObj;
|
||||
GDIBRUSHINST FillBrushInst, PenBrushInst;
|
||||
|
@ -1184,6 +1201,8 @@ IntRoundRect(
|
|||
if ( PATH_IsPathOpen(dc->w.path) )
|
||||
return PATH_RoundRect ( dc, left, top, right, bottom,
|
||||
xCurveDiameter, yCurveDiameter );
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
xradius = xCurveDiameter >> 1;
|
||||
yradius = yCurveDiameter >> 1;
|
||||
|
@ -1206,7 +1225,7 @@ IntRoundRect(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
FillBrushObj = BRUSHOBJ_LockBrush(dc->Dc_Attr.hbrush);
|
||||
FillBrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
|
||||
if (FillBrushObj)
|
||||
{
|
||||
if (FillBrushObj->flAttrs & GDIBRUSH_IS_NULL)
|
||||
|
@ -1221,7 +1240,7 @@ IntRoundRect(
|
|||
}
|
||||
}
|
||||
|
||||
PenBrushObj = PENOBJ_LockPen(dc->Dc_Attr.hpen);
|
||||
PenBrushObj = PENOBJ_LockPen(Dc_Attr->hpen);
|
||||
if (PenBrushObj)
|
||||
{
|
||||
if (PenBrushObj->flAttrs & GDIBRUSH_IS_NULL)
|
||||
|
|
|
@ -19,7 +19,13 @@ FASTCALL
|
|||
GdiFlushUserBatch(HDC hDC, PGDIBATCHHDR pHdr)
|
||||
{
|
||||
PDC dc = NULL;
|
||||
if (hDC) dc = DC_LockDc(hDC);
|
||||
PDC_ATTR Dc_Attr = NULL;
|
||||
if (hDC)
|
||||
{
|
||||
dc = DC_LockDc(hDC);
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
}
|
||||
// The thread is approaching the end of sunset.
|
||||
switch(pHdr->Cmd)
|
||||
{
|
||||
|
@ -35,7 +41,7 @@ GdiFlushUserBatch(HDC hDC, PGDIBATCHHDR pHdr)
|
|||
{
|
||||
if (!dc) break;
|
||||
PGDIBSSETBRHORG pgSBO = (PGDIBSSETBRHORG) pHdr;
|
||||
dc->Dc_Attr.ptlBrushOrigin = pgSBO->ptlBrushOrigin;
|
||||
Dc_Attr->ptlBrushOrigin = pgSBO->ptlBrushOrigin;
|
||||
break;
|
||||
}
|
||||
case GdiBCExtSelClipRgn:
|
||||
|
|
|
@ -32,14 +32,15 @@ IntGdiMoveToEx(DC *dc,
|
|||
LPPOINT Point)
|
||||
{
|
||||
BOOL PathIsOpen;
|
||||
|
||||
PDC_ATTR Dc_Attr = dc->pDc_Attr;
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
if ( Point )
|
||||
{
|
||||
Point->x = dc->Dc_Attr.ptlCurrent.x;
|
||||
Point->y = dc->Dc_Attr.ptlCurrent.y;
|
||||
Point->x = Dc_Attr->ptlCurrent.x;
|
||||
Point->y = Dc_Attr->ptlCurrent.y;
|
||||
}
|
||||
dc->Dc_Attr.ptlCurrent.x = X;
|
||||
dc->Dc_Attr.ptlCurrent.y = Y;
|
||||
Dc_Attr->ptlCurrent.x = X;
|
||||
Dc_Attr->ptlCurrent.y = Y;
|
||||
|
||||
PathIsOpen = PATH_IsPathOpen(dc->w.path);
|
||||
|
||||
|
@ -60,6 +61,9 @@ IntGdiLineTo(DC *dc,
|
|||
GDIBRUSHINST PenBrushInst;
|
||||
RECTL Bounds;
|
||||
POINT Points[2];
|
||||
PDC_ATTR Dc_Attr = dc->pDc_Attr;
|
||||
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
if (PATH_IsPathOpen(dc->w.path))
|
||||
{
|
||||
|
@ -67,8 +71,8 @@ IntGdiLineTo(DC *dc,
|
|||
if (Ret)
|
||||
{
|
||||
// FIXME - PATH_LineTo should maybe do this...
|
||||
dc->Dc_Attr.ptlCurrent.x = XEnd;
|
||||
dc->Dc_Attr.ptlCurrent.y = YEnd;
|
||||
Dc_Attr->ptlCurrent.x = XEnd;
|
||||
Dc_Attr->ptlCurrent.y = YEnd;
|
||||
}
|
||||
return Ret;
|
||||
}
|
||||
|
@ -81,8 +85,8 @@ IntGdiLineTo(DC *dc,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
Points[0].x = dc->Dc_Attr.ptlCurrent.x;
|
||||
Points[0].y = dc->Dc_Attr.ptlCurrent.y;
|
||||
Points[0].x = Dc_Attr->ptlCurrent.x;
|
||||
Points[0].y = Dc_Attr->ptlCurrent.y;
|
||||
Points[1].x = XEnd;
|
||||
Points[1].y = YEnd;
|
||||
|
||||
|
@ -100,7 +104,7 @@ IntGdiLineTo(DC *dc,
|
|||
Bounds.bottom = max(Points[0].y, Points[1].y);
|
||||
|
||||
/* get BRUSHOBJ from current pen. */
|
||||
PenBrushObj = PENOBJ_LockPen( dc->Dc_Attr.hpen );
|
||||
PenBrushObj = PENOBJ_LockPen( Dc_Attr->hpen );
|
||||
/* FIXME - PenBrushObj can be NULL!!!! Don't assert here! */
|
||||
ASSERT(PenBrushObj);
|
||||
|
||||
|
@ -113,7 +117,7 @@ IntGdiLineTo(DC *dc,
|
|||
Points[0].x, Points[0].y,
|
||||
Points[1].x, Points[1].y,
|
||||
&Bounds,
|
||||
ROP2_TO_MIX(dc->Dc_Attr.jROP2));
|
||||
ROP2_TO_MIX(Dc_Attr->jROP2));
|
||||
}
|
||||
|
||||
BITMAPOBJ_UnlockBitmap ( BitmapObj );
|
||||
|
@ -122,8 +126,8 @@ IntGdiLineTo(DC *dc,
|
|||
|
||||
if (Ret)
|
||||
{
|
||||
dc->Dc_Attr.ptlCurrent.x = XEnd;
|
||||
dc->Dc_Attr.ptlCurrent.y = YEnd;
|
||||
Dc_Attr->ptlCurrent.x = XEnd;
|
||||
Dc_Attr->ptlCurrent.y = YEnd;
|
||||
}
|
||||
|
||||
return Ret;
|
||||
|
@ -163,7 +167,9 @@ IntGdiPolyBezierTo(DC *dc,
|
|||
DWORD Count)
|
||||
{
|
||||
BOOL ret = FALSE; // default to failure
|
||||
PDC_ATTR Dc_Attr = dc->pDc_Attr;
|
||||
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
if ( PATH_IsPathOpen(dc->w.path) )
|
||||
ret = PATH_PolyBezierTo ( dc, pt, Count );
|
||||
else /* We'll do it using PolyBezier */
|
||||
|
@ -172,8 +178,8 @@ IntGdiPolyBezierTo(DC *dc,
|
|||
npt = ExAllocatePoolWithTag(PagedPool, sizeof(POINT) * (Count + 1), TAG_BEZIER);
|
||||
if ( npt )
|
||||
{
|
||||
npt[0].x = dc->Dc_Attr.ptlCurrent.x;
|
||||
npt[0].y = dc->Dc_Attr.ptlCurrent.y;
|
||||
npt[0].x = Dc_Attr->ptlCurrent.x;
|
||||
npt[0].y = Dc_Attr->ptlCurrent.y;
|
||||
memcpy(npt + 1, pt, sizeof(POINT) * Count);
|
||||
ret = IntGdiPolyBezier(dc, npt, Count+1);
|
||||
ExFreePool(npt);
|
||||
|
@ -181,8 +187,8 @@ IntGdiPolyBezierTo(DC *dc,
|
|||
}
|
||||
if ( ret )
|
||||
{
|
||||
dc->Dc_Attr.ptlCurrent.x = pt[Count-1].x;
|
||||
dc->Dc_Attr.ptlCurrent.y = pt[Count-1].y;
|
||||
Dc_Attr->ptlCurrent.x = pt[Count-1].x;
|
||||
Dc_Attr->ptlCurrent.y = pt[Count-1].y;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -199,12 +205,14 @@ IntGdiPolyline(DC *dc,
|
|||
LPPOINT Points;
|
||||
BOOL Ret = TRUE;
|
||||
LONG i;
|
||||
|
||||
PDC_ATTR Dc_Attr = dc->pDc_Attr;
|
||||
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
if (PATH_IsPathOpen(dc->w.path))
|
||||
return PATH_Polyline(dc, pt, Count);
|
||||
|
||||
/* Get BRUSHOBJ from current pen. */
|
||||
PenBrushObj = PENOBJ_LockPen(dc->Dc_Attr.hpen);
|
||||
PenBrushObj = PENOBJ_LockPen(Dc_Attr->hpen);
|
||||
/* FIXME - PenBrushObj can be NULL! Don't assert here! */
|
||||
ASSERT(PenBrushObj);
|
||||
|
||||
|
@ -230,7 +238,7 @@ IntGdiPolyline(DC *dc,
|
|||
IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);
|
||||
Ret = IntEngPolyline(&BitmapObj->SurfObj, dc->CombinedClip,
|
||||
&PenBrushInst.BrushObject, Points, Count,
|
||||
ROP2_TO_MIX(dc->Dc_Attr.jROP2));
|
||||
ROP2_TO_MIX(Dc_Attr->jROP2));
|
||||
|
||||
BITMAPOBJ_UnlockBitmap(BitmapObj);
|
||||
EngFreeMem(Points);
|
||||
|
@ -252,7 +260,9 @@ IntGdiPolylineTo(DC *dc,
|
|||
DWORD Count)
|
||||
{
|
||||
BOOL ret = FALSE; // default to failure
|
||||
PDC_ATTR Dc_Attr = dc->pDc_Attr;
|
||||
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
if(PATH_IsPathOpen(dc->w.path))
|
||||
{
|
||||
ret = PATH_PolylineTo(dc, pt, Count);
|
||||
|
@ -262,8 +272,8 @@ IntGdiPolylineTo(DC *dc,
|
|||
POINT *pts = ExAllocatePoolWithTag(PagedPool, sizeof(POINT) * (Count + 1), TAG_SHAPE);
|
||||
if ( pts )
|
||||
{
|
||||
pts[0].x = dc->Dc_Attr.ptlCurrent.x;
|
||||
pts[0].y = dc->Dc_Attr.ptlCurrent.y;
|
||||
pts[0].x = Dc_Attr->ptlCurrent.x;
|
||||
pts[0].y = Dc_Attr->ptlCurrent.y;
|
||||
memcpy( pts + 1, pt, sizeof(POINT) * Count);
|
||||
ret = IntGdiPolyline(dc, pts, Count + 1);
|
||||
ExFreePool(pts);
|
||||
|
@ -271,8 +281,8 @@ IntGdiPolylineTo(DC *dc,
|
|||
}
|
||||
if ( ret )
|
||||
{
|
||||
dc->Dc_Attr.ptlCurrent.x = pt[Count-1].x;
|
||||
dc->Dc_Attr.ptlCurrent.y = pt[Count-1].y;
|
||||
Dc_Attr->ptlCurrent.x = pt[Count-1].x;
|
||||
Dc_Attr->ptlCurrent.y = pt[Count-1].y;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -417,9 +427,12 @@ NtGdiPolyDraw(
|
|||
BOOL result = FALSE;
|
||||
POINT lastmove;
|
||||
unsigned int i;
|
||||
|
||||
PDC_ATTR Dc_Attr = NULL;
|
||||
|
||||
dc = DC_LockDc(hdc);
|
||||
if(!dc) return FALSE;
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
_SEH_TRY
|
||||
{
|
||||
|
@ -436,8 +449,8 @@ NtGdiPolyDraw(
|
|||
}
|
||||
|
||||
/* if no moveto occurs, we will close the figure here */
|
||||
lastmove.x = dc->Dc_Attr.ptlCurrent.x;
|
||||
lastmove.y = dc->Dc_Attr.ptlCurrent.y;
|
||||
lastmove.x = Dc_Attr->ptlCurrent.x;
|
||||
lastmove.y = Dc_Attr->ptlCurrent.y;
|
||||
|
||||
/* now let's draw */
|
||||
for( i = 0; i < cCount; i++ )
|
||||
|
@ -445,16 +458,16 @@ NtGdiPolyDraw(
|
|||
if( lpbTypes[i] == PT_MOVETO )
|
||||
{
|
||||
IntGdiMoveToEx( dc, lppt[i].x, lppt[i].y, NULL );
|
||||
lastmove.x = dc->Dc_Attr.ptlCurrent.x;
|
||||
lastmove.y = dc->Dc_Attr.ptlCurrent.y;
|
||||
lastmove.x = Dc_Attr->ptlCurrent.x;
|
||||
lastmove.y = Dc_Attr->ptlCurrent.y;
|
||||
}
|
||||
else if( lpbTypes[i] & PT_LINETO )
|
||||
IntGdiLineTo( dc, lppt[i].x, lppt[i].y );
|
||||
else if( lpbTypes[i] & PT_BEZIERTO )
|
||||
{
|
||||
POINT pts[4];
|
||||
pts[0].x = dc->Dc_Attr.ptlCurrent.x;
|
||||
pts[0].y = dc->Dc_Attr.ptlCurrent.y;
|
||||
pts[0].x = Dc_Attr->ptlCurrent.x;
|
||||
pts[0].y = Dc_Attr->ptlCurrent.y;
|
||||
RtlCopyMemory(pts + 1, &lppt[i], sizeof(POINT) * 3);
|
||||
IntGdiPolyBezier(dc, pts, 4);
|
||||
i += 2;
|
||||
|
|
|
@ -265,12 +265,14 @@ NtGdiPathToRegion(HDC hDC)
|
|||
GdiPath *pPath;
|
||||
HRGN hrgnRval = 0;
|
||||
DC *pDc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
DPRINT("Enter %s\n", __FUNCTION__);
|
||||
|
||||
pDc = DC_LockDc(hDC);
|
||||
if(!pDc) return NULL;
|
||||
|
||||
Dc_Attr = pDc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &pDc->Dc_Attr;
|
||||
pPath = &pDc->w.path;
|
||||
|
||||
if(pPath->state!=PATH_Closed)
|
||||
|
@ -281,7 +283,7 @@ NtGdiPathToRegion(HDC hDC)
|
|||
else
|
||||
{
|
||||
/* FIXME: Should we empty the path even if conversion failed? */
|
||||
if(PATH_PathToRegion(pPath, pDc->Dc_Attr.jFillMode, &hrgnRval))
|
||||
if(PATH_PathToRegion(pPath, Dc_Attr->jFillMode, &hrgnRval))
|
||||
PATH_EmptyPath(pPath);
|
||||
}
|
||||
|
||||
|
@ -351,9 +353,11 @@ BOOL STDCALL NtGdiSelectClipPath(HDC hDC,
|
|||
HRGN hrgnPath;
|
||||
BOOL success = FALSE;
|
||||
PDC dc = DC_LockDc ( hDC );
|
||||
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
if( !dc ) return FALSE;
|
||||
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
/* Check that path is closed */
|
||||
if( dc->w.path.state != PATH_Closed )
|
||||
{
|
||||
|
@ -361,7 +365,7 @@ BOOL STDCALL NtGdiSelectClipPath(HDC hDC,
|
|||
return FALSE;
|
||||
}
|
||||
/* Construct a region from the path */
|
||||
else if( PATH_PathToRegion( &dc->w.path, dc->Dc_Attr.jFillMode, &hrgnPath ) )
|
||||
else if( PATH_PathToRegion( &dc->w.path, Dc_Attr->jFillMode, &hrgnPath ) )
|
||||
{
|
||||
success = IntGdiExtSelectClipRgn( dc, hrgnPath, Mode ) != ERROR;
|
||||
NtGdiDeleteObject( hrgnPath );
|
||||
|
@ -394,6 +398,9 @@ PATH_FillPath( PDC dc, GdiPath *pPath )
|
|||
POINT ptViewportOrg, ptWindowOrg;
|
||||
XFORM xform;
|
||||
HRGN hrgn;
|
||||
PDC_ATTR Dc_Attr = dc->pDc_Attr;
|
||||
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
if( pPath->state != PATH_Closed )
|
||||
{
|
||||
|
@ -401,7 +408,7 @@ PATH_FillPath( PDC dc, GdiPath *pPath )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if( PATH_PathToRegion( pPath, dc->Dc_Attr.jFillMode, &hrgn ))
|
||||
if( PATH_PathToRegion( pPath, Dc_Attr->jFillMode, &hrgn ))
|
||||
{
|
||||
/* Since PaintRgn interprets the region as being in logical coordinates
|
||||
* but the points we store for the path are already in device
|
||||
|
@ -412,11 +419,11 @@ PATH_FillPath( PDC dc, GdiPath *pPath )
|
|||
*/
|
||||
|
||||
/* Save the information about the old mapping mode */
|
||||
mapMode = dc->Dc_Attr.iMapMode;
|
||||
ptViewportExt = dc->Dc_Attr.szlViewportExt;
|
||||
ptViewportOrg = dc->Dc_Attr.ptlViewportOrg;
|
||||
ptWindowExt = dc->Dc_Attr.szlWindowExt;
|
||||
ptWindowOrg = dc->Dc_Attr.ptlWindowOrg;
|
||||
mapMode = Dc_Attr->iMapMode;
|
||||
ptViewportExt = Dc_Attr->szlViewportExt;
|
||||
ptViewportOrg = Dc_Attr->ptlViewportOrg;
|
||||
ptWindowExt = Dc_Attr->szlWindowExt;
|
||||
ptWindowOrg = Dc_Attr->ptlWindowOrg;
|
||||
|
||||
/* Save world transform
|
||||
* NB: The Windows documentation on world transforms would lead one to
|
||||
|
@ -428,31 +435,31 @@ PATH_FillPath( PDC dc, GdiPath *pPath )
|
|||
|
||||
/* Set MM_TEXT */
|
||||
IntGdiSetMapMode( dc, MM_TEXT );
|
||||
dc->Dc_Attr.ptlViewportOrg.x = 0;
|
||||
dc->Dc_Attr.ptlViewportOrg.y = 0;
|
||||
dc->Dc_Attr.ptlWindowOrg.x = 0;
|
||||
dc->Dc_Attr.ptlWindowOrg.y = 0;
|
||||
Dc_Attr->ptlViewportOrg.x = 0;
|
||||
Dc_Attr->ptlViewportOrg.y = 0;
|
||||
Dc_Attr->ptlWindowOrg.x = 0;
|
||||
Dc_Attr->ptlWindowOrg.y = 0;
|
||||
|
||||
graphicsMode = dc->Dc_Attr.iGraphicsMode;
|
||||
dc->Dc_Attr.iGraphicsMode = GM_ADVANCED;
|
||||
graphicsMode = Dc_Attr->iGraphicsMode;
|
||||
Dc_Attr->iGraphicsMode = GM_ADVANCED;
|
||||
IntGdiModifyWorldTransform( dc, &xform, MWT_IDENTITY );
|
||||
dc->Dc_Attr.iGraphicsMode = graphicsMode;
|
||||
Dc_Attr->iGraphicsMode = graphicsMode;
|
||||
|
||||
/* Paint the region */
|
||||
IntGdiPaintRgn( dc, hrgn );
|
||||
NtGdiDeleteObject( hrgn );
|
||||
/* Restore the old mapping mode */
|
||||
IntGdiSetMapMode( dc, mapMode );
|
||||
dc->Dc_Attr.szlViewportExt = ptViewportExt;
|
||||
dc->Dc_Attr.ptlViewportOrg = ptViewportOrg;
|
||||
dc->Dc_Attr.szlWindowExt = ptWindowExt;
|
||||
dc->Dc_Attr.ptlWindowOrg = ptWindowOrg;
|
||||
Dc_Attr->szlViewportExt = ptViewportExt;
|
||||
Dc_Attr->ptlViewportOrg = ptViewportOrg;
|
||||
Dc_Attr->szlWindowExt = ptWindowExt;
|
||||
Dc_Attr->ptlWindowOrg = ptWindowOrg;
|
||||
|
||||
/* Go to GM_ADVANCED temporarily to restore the world transform */
|
||||
graphicsMode = dc->Dc_Attr.iGraphicsMode;
|
||||
dc->Dc_Attr.iGraphicsMode = GM_ADVANCED;
|
||||
graphicsMode = Dc_Attr->iGraphicsMode;
|
||||
Dc_Attr->iGraphicsMode = GM_ADVANCED;
|
||||
IntGdiModifyWorldTransform( dc, &xform, MWT_MAX+1 );
|
||||
dc->Dc_Attr.iGraphicsMode = graphicsMode;
|
||||
Dc_Attr->iGraphicsMode = graphicsMode;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -1091,6 +1098,8 @@ PATH_PolyPolyline ( PDC dc, const POINT* pts, const DWORD* counts, DWORD polylin
|
|||
BOOL PATH_CheckCorners(DC *dc, POINT corners[], INT x1, INT y1, INT x2, INT y2)
|
||||
{
|
||||
INT temp;
|
||||
PDC_ATTR Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
/* Convert points to device coordinates */
|
||||
corners[0].x=x1;
|
||||
|
@ -1115,7 +1124,7 @@ BOOL PATH_CheckCorners(DC *dc, POINT corners[], INT x1, INT y1, INT x2, INT y2)
|
|||
}
|
||||
|
||||
/* In GM_COMPATIBLE, don't include bottom and right edges */
|
||||
if(dc->Dc_Attr.iGraphicsMode==GM_COMPATIBLE)
|
||||
if(Dc_Attr->iGraphicsMode==GM_COMPATIBLE)
|
||||
{
|
||||
corners[1].x--;
|
||||
corners[1].y--;
|
||||
|
@ -1471,14 +1480,15 @@ BOOL FASTCALL PATH_StrokePath(DC *dc, GdiPath *pPath)
|
|||
SIZE szViewportExt, szWindowExt;
|
||||
DWORD mapMode, graphicsMode;
|
||||
XFORM xform;
|
||||
PDC_ATTR Dc_Attr = dc->pDc_Attr;
|
||||
|
||||
DPRINT("Enter %s\n", __FUNCTION__);
|
||||
|
||||
if(pPath->state != PATH_Closed)
|
||||
return FALSE;
|
||||
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
/* Save the mapping mode info */
|
||||
mapMode=dc->Dc_Attr.iMapMode;
|
||||
mapMode = Dc_Attr->iMapMode;
|
||||
IntGetViewportExtEx(dc, &szViewportExt);
|
||||
IntGetViewportOrgEx(dc, &ptViewportOrg);
|
||||
IntGetWindowExtEx(dc, &szWindowExt);
|
||||
|
@ -1486,15 +1496,15 @@ BOOL FASTCALL PATH_StrokePath(DC *dc, GdiPath *pPath)
|
|||
xform = dc->w.xformWorld2Wnd;
|
||||
|
||||
/* Set MM_TEXT */
|
||||
dc->Dc_Attr.iMapMode = MM_TEXT;
|
||||
dc->Dc_Attr.ptlViewportOrg.x = 0;
|
||||
dc->Dc_Attr.ptlViewportOrg.y = 0;
|
||||
dc->Dc_Attr.ptlWindowOrg.x = 0;
|
||||
dc->Dc_Attr.ptlWindowOrg.y = 0;
|
||||
graphicsMode = dc->Dc_Attr.iGraphicsMode;
|
||||
dc->Dc_Attr.iGraphicsMode = GM_ADVANCED;
|
||||
Dc_Attr->iMapMode = MM_TEXT;
|
||||
Dc_Attr->ptlViewportOrg.x = 0;
|
||||
Dc_Attr->ptlViewportOrg.y = 0;
|
||||
Dc_Attr->ptlWindowOrg.x = 0;
|
||||
Dc_Attr->ptlWindowOrg.y = 0;
|
||||
graphicsMode = Dc_Attr->iGraphicsMode;
|
||||
Dc_Attr->iGraphicsMode = GM_ADVANCED;
|
||||
IntGdiModifyWorldTransform(dc, &xform, MWT_IDENTITY);
|
||||
dc->Dc_Attr.iGraphicsMode = graphicsMode;
|
||||
Dc_Attr->iGraphicsMode = graphicsMode;
|
||||
|
||||
/* Allocate enough memory for the worst case without beziers (one PT_MOVETO
|
||||
* and the rest PT_LINETO with PT_CLOSEFIGURE at the end) plus some buffer
|
||||
|
@ -1599,16 +1609,16 @@ end:
|
|||
if(pLinePts)ExFreePool(pLinePts);
|
||||
|
||||
/* Restore the old mapping mode */
|
||||
dc->Dc_Attr.iMapMode = mapMode;
|
||||
dc->Dc_Attr.szlWindowExt.cx = szWindowExt.cx;
|
||||
dc->Dc_Attr.szlWindowExt.cy = szWindowExt.cy;
|
||||
dc->Dc_Attr.ptlWindowOrg.x = ptWindowOrg.x;
|
||||
dc->Dc_Attr.ptlWindowOrg.y = ptWindowOrg.y;
|
||||
Dc_Attr->iMapMode = mapMode;
|
||||
Dc_Attr->szlWindowExt.cx = szWindowExt.cx;
|
||||
Dc_Attr->szlWindowExt.cy = szWindowExt.cy;
|
||||
Dc_Attr->ptlWindowOrg.x = ptWindowOrg.x;
|
||||
Dc_Attr->ptlWindowOrg.y = ptWindowOrg.y;
|
||||
|
||||
dc->Dc_Attr.szlViewportExt.cx = szViewportExt.cx;
|
||||
dc->Dc_Attr.szlViewportExt.cy = szViewportExt.cy;
|
||||
dc->Dc_Attr.ptlViewportOrg.x = ptViewportOrg.x;
|
||||
dc->Dc_Attr.ptlViewportOrg.y = ptViewportOrg.y;
|
||||
Dc_Attr->szlViewportExt.cx = szViewportExt.cx;
|
||||
Dc_Attr->szlViewportExt.cy = szViewportExt.cy;
|
||||
Dc_Attr->ptlViewportOrg.x = ptViewportOrg.x;
|
||||
Dc_Attr->ptlViewportOrg.y = ptViewportOrg.y;
|
||||
|
||||
/* Restore the world transform */
|
||||
dc->w.xformWorld2Wnd = xform;
|
||||
|
|
|
@ -560,7 +560,7 @@ FillPolygon(
|
|||
FILL_EDGE_LIST *list = 0;
|
||||
FILL_EDGE *ActiveHead = 0;
|
||||
int ScanLine;
|
||||
|
||||
PDC_ATTR Dc_Attr = dc->pDc_Attr;
|
||||
void
|
||||
(STDCALL *FillScanLine)(
|
||||
PDC dc,
|
||||
|
@ -570,6 +570,8 @@ FillPolygon(
|
|||
BRUSHOBJ *BrushObj,
|
||||
MIX RopMode );
|
||||
|
||||
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
//DPRINT("FillPolygon\n");
|
||||
|
||||
/* Create Edge List. */
|
||||
|
@ -578,7 +580,7 @@ FillPolygon(
|
|||
if (NULL == list)
|
||||
return FALSE;
|
||||
|
||||
if ( WINDING == dc->Dc_Attr.jFillMode )
|
||||
if ( WINDING == Dc_Attr->jFillMode )
|
||||
FillScanLine = POLYGONFILL_FillScanLineWinding;
|
||||
else /* default */
|
||||
FillScanLine = POLYGONFILL_FillScanLineAlternate;
|
||||
|
|
|
@ -1935,17 +1935,20 @@ BOOL FASTCALL REGION_LPTODP(HDC hdc, HRGN hDest, HRGN hSrc)
|
|||
DC * dc = DC_LockDc(hdc);
|
||||
RECT tmpRect;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
if(!dc)
|
||||
return ret;
|
||||
|
||||
if(dc->Dc_Attr.iMapMode == MM_TEXT) // Requires only a translation
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
if(Dc_Attr->iMapMode == MM_TEXT) // Requires only a translation
|
||||
{
|
||||
if(NtGdiCombineRgn(hDest, hSrc, 0, RGN_COPY) == ERROR)
|
||||
goto done;
|
||||
|
||||
NtGdiOffsetRgn(hDest, dc->Dc_Attr.ptlViewportOrg.x - dc->Dc_Attr.ptlWindowOrg.x,
|
||||
dc->Dc_Attr.ptlViewportOrg.y - dc->Dc_Attr.ptlWindowOrg.y);
|
||||
NtGdiOffsetRgn(hDest, Dc_Attr->ptlViewportOrg.x - Dc_Attr->ptlWindowOrg.x,
|
||||
Dc_Attr->ptlViewportOrg.y - Dc_Attr->ptlWindowOrg.y);
|
||||
ret = TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
@ -1963,10 +1966,10 @@ BOOL FASTCALL REGION_LPTODP(HDC hdc, HRGN hDest, HRGN hSrc)
|
|||
for(pCurRect = (PRECT)srcObj->Buffer; pCurRect < pEndRect; pCurRect++)
|
||||
{
|
||||
tmpRect = *pCurRect;
|
||||
tmpRect.left = XLPTODP(dc, tmpRect.left);
|
||||
tmpRect.top = YLPTODP(dc, tmpRect.top);
|
||||
tmpRect.right = XLPTODP(dc, tmpRect.right);
|
||||
tmpRect.bottom = YLPTODP(dc, tmpRect.bottom);
|
||||
tmpRect.left = XLPTODP(Dc_Attr, tmpRect.left);
|
||||
tmpRect.top = YLPTODP(Dc_Attr, tmpRect.top);
|
||||
tmpRect.right = XLPTODP(Dc_Attr, tmpRect.right);
|
||||
tmpRect.bottom = YLPTODP(Dc_Attr, tmpRect.bottom);
|
||||
|
||||
if(tmpRect.left > tmpRect.right)
|
||||
{ INT tmp = tmpRect.left; tmpRect.left = tmpRect.right; tmpRect.right = tmp; }
|
||||
|
@ -2639,10 +2642,13 @@ IntGdiPaintRgn(PDC dc, HRGN hRgn)
|
|||
GDIBRUSHINST BrushInst;
|
||||
POINTL BrushOrigin;
|
||||
BITMAPOBJ *BitmapObj;
|
||||
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
if( !dc )
|
||||
return FALSE;
|
||||
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
if(!(tmpVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0)))
|
||||
{
|
||||
DC_UnlockDc( dc );
|
||||
|
@ -2675,12 +2681,12 @@ IntGdiPaintRgn(PDC dc, HRGN hRgn)
|
|||
(PRECTL)visrgn->Buffer,
|
||||
(PRECTL)&visrgn->rdh.rcBound );
|
||||
ASSERT( ClipRegion );
|
||||
pBrush = BRUSHOBJ_LockBrush(dc->Dc_Attr.hbrush);
|
||||
pBrush = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
|
||||
ASSERT(pBrush);
|
||||
IntGdiInitBrushInstance(&BrushInst, pBrush, dc->XlateBrush);
|
||||
|
||||
BrushOrigin.x = dc->Dc_Attr.ptlBrushOrigin.x;
|
||||
BrushOrigin.y = dc->Dc_Attr.ptlBrushOrigin.y;
|
||||
BrushOrigin.x = Dc_Attr->ptlBrushOrigin.x;
|
||||
BrushOrigin.y = Dc_Attr->ptlBrushOrigin.y;
|
||||
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
|
||||
/* FIXME - Handle BitmapObj == NULL !!!! */
|
||||
|
||||
|
|
|
@ -1541,6 +1541,7 @@ NtGdiExtTextOut(
|
|||
*/
|
||||
|
||||
DC *dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
SURFOBJ *SurfObj;
|
||||
BITMAPOBJ *BitmapObj = NULL;
|
||||
int error, glyph_index, n, i;
|
||||
|
@ -1593,6 +1594,9 @@ NtGdiExtTextOut(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
/* Check if String is valid */
|
||||
if ((Count > 0xFFFF) || (Count > 0 && UnsafeString == NULL))
|
||||
{
|
||||
|
@ -1669,7 +1673,7 @@ NtGdiExtTextOut(
|
|||
{
|
||||
goto fail;
|
||||
}
|
||||
hBrushFg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, dc->Dc_Attr.crForegroundClr), 0);
|
||||
hBrushFg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, Dc_Attr->crForegroundClr), 0);
|
||||
if ( !hBrushFg )
|
||||
{
|
||||
goto fail;
|
||||
|
@ -1680,9 +1684,9 @@ NtGdiExtTextOut(
|
|||
goto fail;
|
||||
}
|
||||
IntGdiInitBrushInstance(&BrushFgInst, BrushFg, NULL);
|
||||
if ((fuOptions & ETO_OPAQUE) || dc->Dc_Attr.jBkMode == OPAQUE)
|
||||
if ((fuOptions & ETO_OPAQUE) || Dc_Attr->jBkMode == OPAQUE)
|
||||
{
|
||||
hBrushBg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, dc->Dc_Attr.crBackgroundClr), 0);
|
||||
hBrushBg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, Dc_Attr->crBackgroundClr), 0);
|
||||
if ( !hBrushBg )
|
||||
{
|
||||
goto fail;
|
||||
|
@ -1730,13 +1734,13 @@ NtGdiExtTextOut(
|
|||
}
|
||||
else
|
||||
{
|
||||
if (dc->Dc_Attr.jBkMode == OPAQUE)
|
||||
if (Dc_Attr->jBkMode == OPAQUE)
|
||||
{
|
||||
fuOptions |= ETO_OPAQUE;
|
||||
}
|
||||
}
|
||||
|
||||
TextObj = TEXTOBJ_LockText(dc->Dc_Attr.hlfntNew);
|
||||
TextObj = TEXTOBJ_LockText(Dc_Attr->hlfntNew);
|
||||
if(TextObj == NULL)
|
||||
{
|
||||
goto fail;
|
||||
|
@ -1799,9 +1803,9 @@ NtGdiExtTextOut(
|
|||
* Process the vertical alignment and determine the yoff.
|
||||
*/
|
||||
|
||||
if (dc->Dc_Attr.lTextAlign & TA_BASELINE)
|
||||
if (Dc_Attr->lTextAlign & TA_BASELINE)
|
||||
yoff = 0;
|
||||
else if (dc->Dc_Attr.lTextAlign & TA_BOTTOM)
|
||||
else if (Dc_Attr->lTextAlign & TA_BOTTOM)
|
||||
yoff = -face->size->metrics.descender >> 6;
|
||||
else /* TA_TOP */
|
||||
yoff = face->size->metrics.ascender >> 6;
|
||||
|
@ -1813,7 +1817,7 @@ NtGdiExtTextOut(
|
|||
* Process the horizontal alignment and modify XStart accordingly.
|
||||
*/
|
||||
|
||||
if (dc->Dc_Attr.lTextAlign & (TA_RIGHT | TA_CENTER))
|
||||
if (Dc_Attr->lTextAlign & (TA_RIGHT | TA_CENTER))
|
||||
{
|
||||
ULONGLONG TextWidth = 0;
|
||||
LPCWSTR TempText = String;
|
||||
|
@ -1877,7 +1881,7 @@ NtGdiExtTextOut(
|
|||
|
||||
previous = 0;
|
||||
|
||||
if (dc->Dc_Attr.lTextAlign & TA_RIGHT)
|
||||
if (Dc_Attr->lTextAlign & TA_RIGHT)
|
||||
{
|
||||
RealXStart -= TextWidth;
|
||||
}
|
||||
|
@ -2146,6 +2150,7 @@ NtGdiGetCharABCWidthsW(
|
|||
LPABC SafeBuff;
|
||||
LPABCFLOAT SafeBuffF = NULL;
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
PTEXTOBJ TextObj;
|
||||
PFONTGDI FontGDI;
|
||||
FT_Face face;
|
||||
|
@ -2190,7 +2195,9 @@ NtGdiGetCharABCWidthsW(
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
hFont = dc->Dc_Attr.hlfntNew;
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
hFont = Dc_Attr->hlfntNew;
|
||||
TextObj = TEXTOBJ_LockText(hFont);
|
||||
DC_UnlockDc(dc);
|
||||
|
||||
|
@ -2312,6 +2319,7 @@ NtGdiGetCharWidthW(
|
|||
LPINT SafeBuff;
|
||||
PFLOAT SafeBuffF = NULL;
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
PTEXTOBJ TextObj;
|
||||
PFONTGDI FontGDI;
|
||||
FT_Face face;
|
||||
|
@ -2355,7 +2363,9 @@ NtGdiGetCharWidthW(
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
hFont = dc->Dc_Attr.hlfntNew;
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
hFont = Dc_Attr->hlfntNew;
|
||||
TextObj = TEXTOBJ_LockText(hFont);
|
||||
DC_UnlockDc(dc);
|
||||
|
||||
|
@ -2452,6 +2462,7 @@ NtGdiGetGlyphIndicesW(
|
|||
IN DWORD iMode)
|
||||
{
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
PTEXTOBJ TextObj;
|
||||
PFONTGDI FontGDI;
|
||||
HFONT hFont = 0;
|
||||
|
@ -2471,7 +2482,9 @@ NtGdiGetGlyphIndicesW(
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return GDI_ERROR;
|
||||
}
|
||||
hFont = dc->Dc_Attr.hlfntNew;
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
hFont = Dc_Attr->hlfntNew;
|
||||
TextObj = TEXTOBJ_LockText(hFont);
|
||||
DC_UnlockDc(dc);
|
||||
if (!TextObj)
|
||||
|
@ -2604,6 +2617,7 @@ NtGdiGetGlyphOutline(
|
|||
{
|
||||
static const FT_Matrix identityMat = {(1 << 16), 0, 0, (1 << 16)};
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
PTEXTOBJ TextObj;
|
||||
PFONTGDI FontGDI;
|
||||
HFONT hFont = 0;
|
||||
|
@ -2638,8 +2652,10 @@ NtGdiGetGlyphOutline(
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return GDI_ERROR;
|
||||
}
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
eM11 = dc->w.xformWorld2Vport.eM11;
|
||||
hFont = dc->Dc_Attr.hlfntNew;
|
||||
hFont = Dc_Attr->hlfntNew;
|
||||
TextObj = TEXTOBJ_LockText(hFont);
|
||||
DC_UnlockDc(dc);
|
||||
if (!TextObj)
|
||||
|
@ -3249,6 +3265,7 @@ NtGdiGetOutlineTextMetricsInternalW (HDC hDC,
|
|||
TMDIFF *Tmd)
|
||||
{
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
PTEXTOBJ TextObj;
|
||||
PFONTGDI FontGDI;
|
||||
HFONT hFont = 0;
|
||||
|
@ -3262,7 +3279,9 @@ NtGdiGetOutlineTextMetricsInternalW (HDC hDC,
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
}
|
||||
hFont = dc->Dc_Attr.hlfntNew;
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
hFont = Dc_Attr->hlfntNew;
|
||||
TextObj = TEXTOBJ_LockText(hFont);
|
||||
DC_UnlockDc(dc);
|
||||
if (TextObj == NULL)
|
||||
|
@ -3588,6 +3607,7 @@ NtGdiGetTextExtentExW(
|
|||
)
|
||||
{
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
LPWSTR String;
|
||||
SIZE Size;
|
||||
NTSTATUS Status;
|
||||
|
@ -3661,7 +3681,9 @@ NtGdiGetTextExtentExW(
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
TextObj = TEXTOBJ_LockText(dc->Dc_Attr.hlfntNew);
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
TextObj = TEXTOBJ_LockText(Dc_Attr->hlfntNew);
|
||||
if ( TextObj )
|
||||
{
|
||||
Result = TextIntGetTextExtentPoint(dc, TextObj, String, Count, MaxExtent,
|
||||
|
@ -3743,6 +3765,7 @@ NtGdiGetTextExtentPoint32(HDC hDC,
|
|||
LPSIZE UnsafeSize)
|
||||
{
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
LPWSTR String;
|
||||
SIZE Size;
|
||||
NTSTATUS Status;
|
||||
|
@ -3789,7 +3812,9 @@ NtGdiGetTextExtentPoint32(HDC hDC,
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
TextObj = TEXTOBJ_LockText(dc->Dc_Attr.hlfntNew);
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
TextObj = TEXTOBJ_LockText(Dc_Attr->hlfntNew);
|
||||
if ( TextObj != NULL )
|
||||
{
|
||||
Result = TextIntGetTextExtentPoint (
|
||||
|
@ -3866,6 +3891,7 @@ NtGdiGetTextMetricsW(
|
|||
)
|
||||
{
|
||||
PDC dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
PTEXTOBJ TextObj;
|
||||
PFONTGDI FontGDI;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
@ -3888,8 +3914,9 @@ NtGdiGetTextMetricsW(
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TextObj = TEXTOBJ_LockText(dc->Dc_Attr.hlfntNew);
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
TextObj = TEXTOBJ_LockText(Dc_Attr->hlfntNew);
|
||||
if (NULL != TextObj)
|
||||
{
|
||||
FontGDI = ObjToGDI(TextObj->Font, FONT);
|
||||
|
@ -4003,6 +4030,7 @@ NtGdiSetTextAlign(HDC hDC,
|
|||
{
|
||||
UINT prevAlign;
|
||||
DC *dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
dc = DC_LockDc(hDC);
|
||||
if (!dc)
|
||||
|
@ -4010,8 +4038,10 @@ NtGdiSetTextAlign(HDC hDC,
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return GDI_ERROR;
|
||||
}
|
||||
prevAlign = dc->Dc_Attr.lTextAlign;
|
||||
dc->Dc_Attr.lTextAlign = Mode;
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
prevAlign = Dc_Attr->lTextAlign;
|
||||
Dc_Attr->lTextAlign = Mode;
|
||||
DC_UnlockDc( dc );
|
||||
return prevAlign;
|
||||
}
|
||||
|
@ -4023,6 +4053,7 @@ NtGdiSetTextColor(HDC hDC,
|
|||
{
|
||||
COLORREF oldColor;
|
||||
PDC dc = DC_LockDc(hDC);
|
||||
PDC_ATTR Dc_Attr;
|
||||
HBRUSH hBrush;
|
||||
|
||||
if (!dc)
|
||||
|
@ -4030,10 +4061,12 @@ NtGdiSetTextColor(HDC hDC,
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return CLR_INVALID;
|
||||
}
|
||||
Dc_Attr = dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
|
||||
|
||||
oldColor = dc->Dc_Attr.crForegroundClr;
|
||||
dc->Dc_Attr.crForegroundClr = color;
|
||||
hBrush = dc->Dc_Attr.hbrush;
|
||||
oldColor = Dc_Attr->crForegroundClr;
|
||||
Dc_Attr->crForegroundClr = color;
|
||||
hBrush = Dc_Attr->hbrush;
|
||||
DC_UnlockDc( dc );
|
||||
NtGdiSelectObject(hDC, hBrush);
|
||||
return oldColor;
|
||||
|
@ -4058,6 +4091,7 @@ NtGdiGetFontData(
|
|||
DWORD Size)
|
||||
{
|
||||
PDC Dc;
|
||||
PDC_ATTR Dc_Attr;
|
||||
HFONT hFont;
|
||||
PTEXTOBJ TextObj;
|
||||
PFONTGDI FontGdi;
|
||||
|
@ -4069,7 +4103,9 @@ NtGdiGetFontData(
|
|||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return GDI_ERROR;
|
||||
}
|
||||
hFont = Dc->Dc_Attr.hlfntNew;
|
||||
Dc_Attr = Dc->pDc_Attr;
|
||||
if(!Dc_Attr) Dc_Attr = &Dc->Dc_Attr;
|
||||
hFont = Dc_Attr->hlfntNew;
|
||||
TextObj = TEXTOBJ_LockText(hFont);
|
||||
DC_UnlockDc(Dc);
|
||||
|
||||
|
|
Loading…
Reference in a new issue