Author: jimtabor
Date: Sun Nov 18 16:51:34 2007
New Revision: 30546
URL:
http://svn.reactos.org/svn/reactos?rev=30546&view=rev
Log:
Complete move to Dc_Attr in win32k. Tested Qemu Linux, Xp with AbiWord.
Modified:
trunk/reactos/subsystems/win32/win32k/include/gdifloat.h
trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
trunk/reactos/subsystems/win32/win32k/objects/bitblt.c
trunk/reactos/subsystems/win32/win32k/objects/brush.c
trunk/reactos/subsystems/win32/win32k/objects/coord.c
trunk/reactos/subsystems/win32/win32k/objects/dc.c
trunk/reactos/subsystems/win32/win32k/objects/dcutil.c
trunk/reactos/subsystems/win32/win32k/objects/fillshap.c
trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c
trunk/reactos/subsystems/win32/win32k/objects/line.c
trunk/reactos/subsystems/win32/win32k/objects/path.c
trunk/reactos/subsystems/win32/win32k/objects/polyfill.c
trunk/reactos/subsystems/win32/win32k/objects/region.c
trunk/reactos/subsystems/win32/win32k/objects/text.c
Modified: trunk/reactos/subsystems/win32/win32k/include/gdifloat.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/gdifloat.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/gdifloat.h Sun Nov 18 16:51:34 2007
@@ -83,28 +83,28 @@
#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
+
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c Sun Nov 18 16:51:34 2007
@@ -158,6 +158,9 @@
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 @@
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.
Modified: trunk/reactos/subsystems/win32/win32k/objects/bitblt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitblt.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitblt.c Sun Nov 18 16:51:34 2007
@@ -42,6 +42,7 @@
{
PDC DCDest = NULL;
PDC DCSrc = NULL;
+ PDC_ATTR Dc_Attr = NULL;
BITMAPOBJ *BitmapDest, *BitmapSrc;
RECTL DestRect, SourceRect;
BOOL Status;
@@ -87,6 +88,9 @@
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 @@
{
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 @@
{
PDC DCDest = NULL;
PDC DCSrc = NULL;
+ PDC_ATTR Dc_Attr = NULL;
BITMAPOBJ *BitmapDest, *BitmapSrc;
RECTL DestRect;
POINTL SourcePoint, BrushOrigin;
@@ -235,6 +240,9 @@
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 @@
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 @@
}
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 @@
{
PDC DCDest = NULL;
PDC DCSrc = NULL;
+ PDC_ATTR Dc_Attr = NULL;
BITMAPOBJ *BitmapDest, *BitmapSrc;
RECTL DestRect;
RECTL SourceRect;
@@ -929,7 +940,9 @@
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 @@
{
PGDIBRUSHOBJ BrushObj;
DC *dc = DC_LockDc(hDC);
+ PDC_ATTR Dc_Attr;
BOOL ret;
if (dc == NULL)
@@ -1139,6 +1153,8 @@
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 @@
return TRUE;
}
- BrushObj = BRUSHOBJ_LockBrush(dc->Dc_Attr.hbrush);
+ BrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush);
if (BrushObj == NULL)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
Modified: trunk/reactos/subsystems/win32/win32k/objects/brush.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/brush.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/brush.c Sun Nov 18 16:51:34 2007
@@ -139,8 +139,11 @@
/* 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)
{
Modified: trunk/reactos/subsystems/win32/win32k/objects/coord.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/coord.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/coord.c Sun Nov 18 16:51:34 2007
@@ -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 @@
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 @@
NtGdiGetGraphicsMode ( HDC hDC )
{
PDC dc;
+ PDC_ATTR Dc_Attr;
int GraphicsMode; // default to failure
dc = DC_LockDc ( hDC );
@@ -217,8 +230,9 @@
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 @@
LPPOINT UnsafePoint)
{
PDC dc;
+ PDC_ATTR Dc_Attr;
NTSTATUS Status = STATUS_SUCCESS;
dc = DC_LockDc ( hDC );
@@ -472,7 +487,9 @@
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 @@
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 @@
}
}
- 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 @@
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 @@
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 @@
}
}
- 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 @@
{
INT ret;
PDC dc;
+ PDC_ATTR Dc_Attr;
dc = DC_LockDc (hDC);
if (!dc)
@@ -595,6 +616,8 @@
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 @@
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 @@
int MapMode)
{
int PrevMapMode;
-
- PrevMapMode = dc->Dc_Attr.iMapMode;
-
- if (MapMode != dc->Dc_Attr.iMapMode || (MapMode != MM_ISOTROPIC && MapMode
!= MM_ANISOTROPIC))
- {
- dc->Dc_Attr.iMapMode = MapMode;
+ PDC_ATTR Dc_Attr = dc->pDc_Attr;
+ if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+
+ PrevMapMode = Dc_Attr->iMapMode;
+
+ if (MapMode != Dc_Attr->iMapMode || (MapMode != MM_ISOTROPIC && MapMode !=
MM_ANISOTROPIC))
+ {
+ 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 @@
LPSIZE Size)
{
PDC dc;
+ PDC_ATTR Dc_Attr;
dc = DC_LockDc(hDC);
if ( !dc )
@@ -698,8 +724,10 @@
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
-
- switch (dc->Dc_Attr.iMapMode)
+ Dc_Attr = dc->pDc_Attr;
+ if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+
+ switch (Dc_Attr->iMapMode)
{
case MM_HIENGLISH:
case MM_HIMETRIC:
@@ -725,13 +753,13 @@
ProbeForWrite(Size,
sizeof(SIZE),
1);
- Size->cx = dc->Dc_Attr.szlViewportExt.cx;
- Size->cy = dc->Dc_Attr.szlViewportExt.cy;
-
- dc->Dc_Attr.szlViewportExt.cx = XExtent;
- dc->Dc_Attr.szlViewportExt.cy = YExtent;
-
- if (dc->Dc_Attr.iMapMode == MM_ISOTROPIC)
+ Size->cx = Dc_Attr->szlViewportExt.cx;
+ Size->cy = Dc_Attr->szlViewportExt.cy;
+
+ Dc_Attr->szlViewportExt.cx = XExtent;
+ Dc_Attr->szlViewportExt.cy = YExtent;
+
+ if (Dc_Attr->iMapMode == MM_ISOTROPIC)
IntFixIsotropicMapping(dc);
}
_SEH_HANDLE
@@ -763,6 +791,7 @@
LPPOINT Point)
{
PDC dc;
+ PDC_ATTR Dc_Attr;
dc = DC_LockDc(hDC);
if (!dc)
@@ -770,6 +799,8 @@
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 @@
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 @@
}
}
- 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 @@
LPSIZE Size)
{
PDC dc;
+ PDC_ATTR Dc_Attr;
dc = DC_LockDc(hDC);
if (!dc)
@@ -821,8 +853,10 @@
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
-
- switch (dc->Dc_Attr.iMapMode)
+ Dc_Attr = dc->pDc_Attr;
+ if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+
+ switch (Dc_Attr->iMapMode)
{
case MM_HIENGLISH:
case MM_HIMETRIC:
@@ -843,8 +877,8 @@
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 @@
}
}
- 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 @@
LPPOINT Point)
{
PDC dc;
+ PDC_ATTR Dc_Attr;
dc = DC_LockDc(hDC);
if (!dc)
@@ -884,6 +919,8 @@
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 @@
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 @@
}
}
- 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);
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c Sun Nov 18 16:51:34 2007
@@ -1,4 +1,3 @@
-
/*
* ReactOS W32 Subsystem
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
@@ -55,98 +54,6 @@
/* 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 @@
NtGdiCreateCompatibleDC(HDC hDC)
{
PDC NewDC, OrigDC;
+ PDC_ATTR nDc_Attr, oDc_Attr;
HBITMAP hBitmap;
HDC hNewDC, DisplayDC;
HRGN hVisRgn;
@@ -192,7 +100,6 @@
return NULL;
}
hNewDC = DC_AllocDC(&OrigDC->DriverName);
-
if (NULL == hNewDC)
{
DC_UnlockDc(OrigDC);
@@ -204,6 +111,11 @@
}
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 @@
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 @@
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 @@
NtGdiDeleteObject(hVisRgn);
DC_InitDC(hNewDC);
- DCU_SynchDcAttrtoUser(hNewDC, -1);
-
return hNewDC;
}
@@ -815,6 +721,7 @@
{
HDC hNewDC;
PDC NewDC;
+ PDC_ATTR nDc_Attr;
HDC hDC = NULL;
HRGN hVisRgn;
UNICODE_STRING StdDriver;
@@ -902,6 +809,9 @@
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 @@
{
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 @@
NtGdiSetTextAlign(hNewDC, TA_TOP);
NtGdiSetBkColor(hNewDC, RGB(255, 255, 255));
NtGdiSetBkMode(hNewDC, OPAQUE);
- DCU_SynchDcAttrtoUser(hNewDC, -1);
}
else
{
@@ -946,7 +855,6 @@
NewDC->DC_Type = DC_TYPE_INFO;
DC_UnlockDc( NewDC );
}
-
return hNewDC;
}
@@ -1101,7 +1009,6 @@
DC_UnlockDc( DCToDelete );
DC_FreeDC ( DCHandle );
-
return TRUE;
}
@@ -1129,15 +1036,13 @@
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 @@
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;
@@ -1179,8 +1085,6 @@
DC_UnlockDc(dc);
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 @@
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 @@
FASTCALL
IntGdiCopyFromSaveState(PDC dc, PDC dcs, HDC hDC)
{
- dc->w.flags = dcs->w.flags & ~DC_SAVED;
-
- dc->w.hFirstBitmap = dcs->w.hFirstBitmap;
+ PDC_ATTR Dc_Attr, sDc_Attr;
+
+ 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 @@
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 );
-
- NtGdiSetBkColor( hDC, dcs->Dc_Attr.crBackgroundClr);
- NtGdiSetTextColor( hDC, dcs->Dc_Attr.crForegroundClr);
+ NtGdiSelectObject( hDC, sDc_Attr->hbrush );
+ NtGdiSelectObject( hDC, sDc_Attr->hlfntNew );
+ NtGdiSelectObject( hDC, sDc_Attr->hpen );
+
+ NtGdiSetBkColor( hDC, sDc_Attr->crBackgroundClr);
+ NtGdiSetTextColor( hDC, sDc_Attr->crForegroundClr);
NtUserSelectPalette( hDC, dcs->w.hPalette, FALSE );
@@ -1489,7 +1373,6 @@
newdc->hSelf = hnewdc;
IntGdiCopyToSaveState( dc, newdc);
-// DCU_SyncDcAttrtoUser(newdc, -1);
DC_UnlockDc( newdc );
DC_UnlockDc( dc );
return hnewdc;
@@ -1744,9 +1627,6 @@
DC_UnlockDc( dc );
return ret;
}
-
-DC_GET_VAL( INT, NtGdiGetMapMode, Dc_Attr.iMapMode )
-DC_GET_VAL( INT, NtGdiGetPolyFillMode, Dc_Attr.jFillMode )
INT
FASTCALL
@@ -1852,15 +1732,6 @@
// Return the count
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
@@ -2003,6 +1874,7 @@
HGDIOBJ objOrg = NULL; // default to failure
BITMAPOBJ *pb;
PDC dc;
+ PDC_ATTR Dc_Attr;
PGDIBRUSHOBJ pen;
PGDIBRUSHOBJ brush;
XLATEOBJ *XlateObj;
@@ -2027,7 +1899,9 @@
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 @@
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 @@
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 @@
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 @@
}
/* 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 @@
default:
break;
}
-// DCU_SyncDcAttrtoUser(dc, -1);
DC_UnlockDc( dc );
return objOrg;
}
@@ -2192,7 +2065,9 @@
)
{
BOOL Ret = TRUE;
- DC *dc;
+ PDC dc;
+ PDC_ATTR Dc_Attr;
+
DWORD SafeResult = 0;
NTSTATUS Status = STATUS_SUCCESS;
@@ -2208,19 +2083,21 @@
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 @@
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 @@
)
{
BOOL Ret = TRUE;
- DC *dc;
+ PDC dc;
+ PDC_ATTR Dc_Attr;
+
DWORD SafeResult = 0;
NTSTATUS Status = STATUS_SUCCESS;
@@ -2297,23 +2176,25 @@
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 @@
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 @@
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 @@
NewDC->w.vport2WorldValid = TRUE;
// Setup syncing bits for the dcattr data packets.
- NewDC->Dc_Attr.flXform = DEVICE_TO_PAGE_INVALID;
-
- NewDC->Dc_Attr.ulDirty_ = 0; // Server side
-
- NewDC->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;
-
- NewDC->Dc_Attr.crForegroundClr = 0;
- NewDC->Dc_Attr.ulForegroundClr = 0;
-
- NewDC->Dc_Attr.ulBackgroundClr = 0xffffff;
- NewDC->Dc_Attr.crBackgroundClr = 0xffffff;
-
- NewDC->Dc_Attr.ulPenClr = RGB( 0, 0, 0 );
- NewDC->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 );
-
- NewDC->Dc_Attr.hlfntNew = NtGdiGetStockObject(SYSTEM_FONT);
- TextIntRealizeFont(NewDC->Dc_Attr.hlfntNew);
+ Dc_Attr->flXform = DEVICE_TO_PAGE_INVALID;
+
+ Dc_Attr->ulDirty_ = 0; // Server side
+
+ Dc_Attr->iMapMode = MM_TEXT;
+
+ Dc_Attr->szlWindowExt.cx = 1; // Float to Int,,, WRONG!
+ Dc_Attr->szlWindowExt.cy = 1;
+ Dc_Attr->szlViewportExt.cx = 1;
+ Dc_Attr->szlViewportExt.cy = 1;
+
+ Dc_Attr->crForegroundClr = 0;
+ Dc_Attr->ulForegroundClr = 0;
+
+ Dc_Attr->ulBackgroundClr = 0xffffff;
+ Dc_Attr->crBackgroundClr = 0xffffff;
+
+ Dc_Attr->ulPenClr = RGB( 0, 0, 0 );
+ Dc_Attr->crPenClr = RGB( 0, 0, 0 );
+
+ Dc_Attr->ulBrushClr = RGB( 255, 255, 255 ); // Do this way too.
+ Dc_Attr->crBrushClr = RGB( 255, 255, 255 );
+
+ Dc_Attr->hlfntNew = NtGdiGetStockObject(SYSTEM_FONT);
+ TextIntRealizeFont(Dc_Attr->hlfntNew);
NewDC->w.hPalette = NtGdiGetStockObject(DEFAULT_PALETTE);
@@ -2595,16 +2473,18 @@
{
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);
Modified: trunk/reactos/subsystems/win32/win32k/objects/dcutil.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dcutil.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dcutil.c Sun Nov 18 16:51:34 2007
@@ -3,6 +3,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
@@ -46,7 +147,9 @@
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 @@
}
+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;
+}
+
Modified: trunk/reactos/subsystems/win32/win32k/objects/fillshap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/fillshap.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/fillshap.c Sun Nov 18 16:51:34 2007
@@ -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 @@
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 @@
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 @@
}
/* 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 @@
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 @@
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 @@
BITMAPOBJ *BitmapObj;
RECTL RectBounds;
PDC dc;
+ PDC_ATTR Dc_Attr;
BOOL ret = TRUE, Cond1, Cond2;
/*
@@ -228,7 +233,10 @@
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 @@
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 @@
{
#ifdef TODO
PDC dc;
+ PDC_ATTR;
RECTL RectBounds;
SURFOBJ *SurfObj;
BRUSHOBJ PenBrushObj;
@@ -663,7 +672,10 @@
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 @@
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,10 +1032,14 @@
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) )
{
@@ -1041,7 +1057,7 @@
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 @@
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 @@
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 @@
int xCurveDiameter,
int yCurveDiameter)
{
+ PDC_ATTR Dc_Attr;
BITMAPOBJ *BitmapObj;
PGDIBRUSHOBJ PenBrushObj, FillBrushObj;
GDIBRUSHINST FillBrushInst, PenBrushInst;
@@ -1184,6 +1201,8 @@
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 @@
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 @@
}
}
- PenBrushObj = PENOBJ_LockPen(dc->Dc_Attr.hpen);
+ PenBrushObj = PENOBJ_LockPen(Dc_Attr->hpen);
if (PenBrushObj)
{
if (PenBrushObj->flAttrs & GDIBRUSH_IS_NULL)
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c Sun Nov 18 16:51:34 2007
@@ -19,7 +19,13 @@
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 @@
{
if (!dc) break;
PGDIBSSETBRHORG pgSBO = (PGDIBSSETBRHORG) pHdr;
- dc->Dc_Attr.ptlBrushOrigin = pgSBO->ptlBrushOrigin;
+ Dc_Attr->ptlBrushOrigin = pgSBO->ptlBrushOrigin;
break;
}
case GdiBCExtSelClipRgn:
Modified: trunk/reactos/subsystems/win32/win32k/objects/line.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/line.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/line.c Sun Nov 18 16:51:34 2007
@@ -32,14 +32,15 @@
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;
- }
- dc->Dc_Attr.ptlCurrent.x = X;
- dc->Dc_Attr.ptlCurrent.y = Y;
+ Point->x = Dc_Attr->ptlCurrent.x;
+ Point->y = Dc_Attr->ptlCurrent.y;
+ }
+ Dc_Attr->ptlCurrent.x = X;
+ Dc_Attr->ptlCurrent.y = Y;
PathIsOpen = PATH_IsPathOpen(dc->w.path);
@@ -60,6 +61,9 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
}
/* 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 @@
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;
Modified: trunk/reactos/subsystems/win32/win32k/objects/path.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/path.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/path.c Sun Nov 18 16:51:34 2007
@@ -265,12 +265,14 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
*/
/* 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 @@
/* 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;
-
- graphicsMode = dc->Dc_Attr.iGraphicsMode;
- dc->Dc_Attr.iGraphicsMode = GM_ADVANCED;
+ 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;
/* 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 @@
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 @@
}
/* 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 @@
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 @@
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 @@
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->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->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_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;
Modified: trunk/reactos/subsystems/win32/win32k/objects/polyfill.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/polyfill.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/polyfill.c Sun Nov 18 16:51:34 2007
@@ -560,7 +560,7 @@
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 @@
BRUSHOBJ *BrushObj,
MIX RopMode );
+ if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+
//DPRINT("FillPolygon\n");
/* Create Edge List. */
@@ -578,7 +580,7 @@
if (NULL == list)
return FALSE;
- if ( WINDING == dc->Dc_Attr.jFillMode )
+ if ( WINDING == Dc_Attr->jFillMode )
FillScanLine = POLYGONFILL_FillScanLineWinding;
else /* default */
FillScanLine = POLYGONFILL_FillScanLineAlternate;
Modified: trunk/reactos/subsystems/win32/win32k/objects/region.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/region.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/region.c Sun Nov 18 16:51:34 2007
@@ -1935,17 +1935,20 @@
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 @@
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 @@
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 @@
(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 !!!! */
Modified: trunk/reactos/subsystems/win32/win32k/objects/text.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/text.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/text.c Sun Nov 18 16:51:34 2007
@@ -1541,6 +1541,7 @@
*/
DC *dc;
+ PDC_ATTR Dc_Attr;
SURFOBJ *SurfObj;
BITMAPOBJ *BitmapObj = NULL;
int error, glyph_index, n, i;
@@ -1593,6 +1594,9 @@
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 @@
{
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 @@
goto fail;
}
IntGdiInitBrushInstance(&BrushFgInst, BrushFg, NULL);
- if ((fuOptions & ETO_OPAQUE) || dc->Dc_Attr.jBkMode == OPAQUE)
- {
- hBrushBg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj,
dc->Dc_Attr.crBackgroundClr), 0);
+ if ((fuOptions & ETO_OPAQUE) || Dc_Attr->jBkMode == OPAQUE)
+ {
+ hBrushBg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj,
Dc_Attr->crBackgroundClr), 0);
if ( !hBrushBg )
{
goto fail;
@@ -1730,13 +1734,13 @@
}
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 @@
* 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 @@
* 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 @@
previous = 0;
- if (dc->Dc_Attr.lTextAlign & TA_RIGHT)
+ if (Dc_Attr->lTextAlign & TA_RIGHT)
{
RealXStart -= TextWidth;
}
@@ -2146,6 +2150,7 @@
LPABC SafeBuff;
LPABCFLOAT SafeBuffF = NULL;
PDC dc;
+ PDC_ATTR Dc_Attr;
PTEXTOBJ TextObj;
PFONTGDI FontGDI;
FT_Face face;
@@ -2190,7 +2195,9 @@
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 @@
LPINT SafeBuff;
PFLOAT SafeBuffF = NULL;
PDC dc;
+ PDC_ATTR Dc_Attr;
PTEXTOBJ TextObj;
PFONTGDI FontGDI;
FT_Face face;
@@ -2355,7 +2363,9 @@
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 @@
IN DWORD iMode)
{
PDC dc;
+ PDC_ATTR Dc_Attr;
PTEXTOBJ TextObj;
PFONTGDI FontGDI;
HFONT hFont = 0;
@@ -2471,7 +2482,9 @@
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 @@
{
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 @@
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 @@
TMDIFF *Tmd)
{
PDC dc;
+ PDC_ATTR Dc_Attr;
PTEXTOBJ TextObj;
PFONTGDI FontGDI;
HFONT hFont = 0;
@@ -3262,7 +3279,9 @@
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 @@
)
{
PDC dc;
+ PDC_ATTR Dc_Attr;
LPWSTR String;
SIZE Size;
NTSTATUS Status;
@@ -3661,7 +3681,9 @@
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 @@
LPSIZE UnsafeSize)
{
PDC dc;
+ PDC_ATTR Dc_Attr;
LPWSTR String;
SIZE Size;
NTSTATUS Status;
@@ -3789,7 +3812,9 @@
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 @@
)
{
PDC dc;
+ PDC_ATTR Dc_Attr;
PTEXTOBJ TextObj;
PFONTGDI FontGDI;
NTSTATUS Status = STATUS_SUCCESS;
@@ -3888,8 +3914,9 @@
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 @@
{
UINT prevAlign;
DC *dc;
+ PDC_ATTR Dc_Attr;
dc = DC_LockDc(hDC);
if (!dc)
@@ -4010,8 +4038,10 @@
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 @@
{
COLORREF oldColor;
PDC dc = DC_LockDc(hDC);
+ PDC_ATTR Dc_Attr;
HBRUSH hBrush;
if (!dc)
@@ -4030,10 +4061,12 @@
SetLastWin32Error(ERROR_INVALID_HANDLE);
return CLR_INVALID;
}
-
- oldColor = dc->Dc_Attr.crForegroundClr;
- dc->Dc_Attr.crForegroundClr = color;
- hBrush = dc->Dc_Attr.hbrush;
+ Dc_Attr = dc->pDc_Attr;
+ if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+
+ oldColor = Dc_Attr->crForegroundClr;
+ Dc_Attr->crForegroundClr = color;
+ hBrush = Dc_Attr->hbrush;
DC_UnlockDc( dc );
NtGdiSelectObject(hDC, hBrush);
return oldColor;
@@ -4058,6 +4091,7 @@
DWORD Size)
{
PDC Dc;
+ PDC_ATTR Dc_Attr;
HFONT hFont;
PTEXTOBJ TextObj;
PFONTGDI FontGdi;
@@ -4069,7 +4103,9 @@
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);