Author: tkreuzer Date: Tue Mar 24 05:58:14 2009 New Revision: 40201
URL: http://svn.reactos.org/svn/reactos?rev=40201&view=rev Log: Remove DC_GET_VAL macro and friends. They were defining functions that we didn't use, except 4, but those were also quite useless, as the only returned a value from the dc structure that you pass in. same for IntGetGraphicsMode. Also remove IntGetViewportExtEx and replace it with DC_vUpdateViewportExt
Modified: trunk/reactos/subsystems/win32/win32k/include/coord.h trunk/reactos/subsystems/win32/win32k/include/dc.h trunk/reactos/subsystems/win32/win32k/objects/coord.c trunk/reactos/subsystems/win32/win32k/objects/dcutil.c trunk/reactos/subsystems/win32/win32k/objects/fillshap.c trunk/reactos/subsystems/win32/win32k/objects/path.c
Modified: trunk/reactos/subsystems/win32/win32k/include/coord.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/coord.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/coord.h [iso-8859-1] Tue Mar 24 05:58:14 2009 @@ -9,10 +9,6 @@ #define CoordLPtoDP(dc, pp) XFORMOBJ_bApplyXform((XFORMOBJ*)&(dc)->dclevel.mxWorldToDevice, XF_LTOL, 1, pp, pp); #define XForm2MatrixS(m, x) XFORMOBJ_iSetXform((XFORMOBJ*)m, (XFORML*)x) #define MatrixS2XForm(x, m) XFORMOBJ_iGetXform((XFORMOBJ*)m, (XFORML*)x) - -int -FASTCALL -IntGetGraphicsMode ( PDC dc );
int APIENTRY IntGdiSetMapMode(PDC, int);
Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Tue Mar 24 05:58:14 2009 @@ -248,15 +248,11 @@
VOID FASTCALL DC_UpdateXforms(PDC dc); BOOL FASTCALL DC_InvertXform(const XFORM *xformSrc, XFORM *xformDest); +VOID FASTCALL DC_vUpdateViewportExt(PDC pdc);
BOOL FASTCALL DCU_SyncDcAttrtoUser(PDC); BOOL FASTCALL DCU_SynchDcAttrtoUser(HDC); VOID FASTCALL DCU_SetDcUndeletable(HDC); - -VOID FASTCALL IntGetViewportExtEx(PDC dc, LPSIZE pt); -VOID FASTCALL IntGetViewportOrgEx(PDC dc, LPPOINT pt); -VOID FASTCALL IntGetWindowExtEx(PDC dc, LPSIZE pt); -VOID FASTCALL IntGetWindowOrgEx(PDC dc, LPPOINT pt);
COLORREF FASTCALL IntGdiSetBkColor (HDC hDC, COLORREF Color); INT FASTCALL IntGdiSetBkMode(HDC hDC, INT backgroundMode);
Modified: trunk/reactos/subsystems/win32/win32k/objects/coord.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] Tue Mar 24 05:58:14 2009 @@ -119,17 +119,6 @@ return Ret; }
-// FIXME: remove me! -int -FASTCALL -IntGetGraphicsMode(PDC dc) -{ - PDC_ATTR pdcattr; - ASSERT(dc); - pdcattr = dc->pdcattr; - return pdcattr->iGraphicsMode; -} - // FIXME: Don't use floating point in the kernel BOOL FASTCALL @@ -262,7 +251,8 @@
Size = Count * sizeof(POINT);
- Points = (LPPOINT)ExAllocatePoolWithTag(PagedPool, Size, TAG_COORD); + // FIXME: It would be wise to have a small stack buffer as optimization + Points = ExAllocatePoolWithTag(PagedPool, Size, TAG_COORD); if (!Points) { DC_UnlockDc(dc); @@ -1129,7 +1119,7 @@ DC_UnlockDc(pdc); }
- +// FIXME: remove me BOOL FASTCALL IntGdiGetDCOrg(PDC pDc, PPOINTL ppt) { @@ -1137,6 +1127,7 @@ return TRUE; }
+// FIXME: remove me BOOL APIENTRY GdiGetDCOrgEx(HDC hDC, PPOINTL ppt, PRECTL prc) { @@ -1152,14 +1143,11 @@ return TRUE; }
-BOOL FASTCALL -IntGetAspectRatioFilter(PDC pDC, LPSIZE AspectRatio) -{ - PDC_ATTR pdcattr; - - pdcattr = pDC->pdcattr; - - if ( pdcattr->flFontMapper & 1 ) // TRUE assume 1. +static +VOID FASTCALL +DC_vGetAspectRatioFilter(PDC pDC, LPSIZE AspectRatio) +{ + if (pDC->pdcattr->flFontMapper & 1) // TRUE assume 1. { // "This specifies that Windows should only match fonts that have the // same aspect ratio as the display.", Programming Windows, Fifth Ed. @@ -1171,12 +1159,11 @@ AspectRatio->cx = 0; AspectRatio->cy = 0; } - return TRUE; }
VOID FASTCALL -IntGetViewportExtEx(PDC pdc, LPSIZE pSize) +DC_vUpdateViewportExt(PDC pdc) { PDC_ATTR pdcattr;
@@ -1195,9 +1182,6 @@ /* Update xforms, CHECKME: really done here? */ DC_UpdateXforms(pdc); } - - /* Copy the viewport extension */ - *pSize = pdcattr->szlViewportExt; }
BOOL APIENTRY @@ -1207,7 +1191,7 @@ PPOINTL Point) { BOOL Ret = TRUE; - DC *dc; + DC *pdc; POINTL SafePoint; SIZE Size; NTSTATUS Status = STATUS_SUCCESS; @@ -1218,10 +1202,8 @@ return FALSE; }
- RtlZeroMemory(&SafePoint, sizeof(POINT)); - - dc = DC_LockDc(hDC); - if (!dc) + pdc = DC_LockDc(hDC); + if (!pdc) { SetLastWin32Error(ERROR_INVALID_HANDLE); return FALSE; @@ -1230,31 +1212,30 @@ switch (iPoint) { case GdiGetViewPortExt: - IntGetViewportExtEx(dc, &Size); - SafePoint.x = Size.cx; - SafePoint.y = Size.cy; + DC_vUpdateViewportExt(pdc); + SafePoint.x = pdc->pdcattr->szlViewportExt.cx; + SafePoint.y = pdc->pdcattr->szlViewportExt.cy; break;
case GdiGetWindowExt: - IntGetWindowExtEx(dc, &Size); - SafePoint.x = Size.cx; - SafePoint.y = Size.cy; + SafePoint.x = pdc->pdcattr->szlWindowExt.cx; + SafePoint.y = pdc->pdcattr->szlWindowExt.cy; break;
case GdiGetViewPortOrg: - IntGetViewportOrgEx(dc, &SafePoint); + SafePoint = pdc->pdcattr->ptlViewportOrg; break;
case GdiGetWindowOrg: - IntGetWindowOrgEx(dc, &SafePoint); + SafePoint = pdc->pdcattr->ptlWindowOrg; break;
case GdiGetDCOrg: - Ret = IntGdiGetDCOrg(dc, &SafePoint); + SafePoint = pdc->ptlDCOrig; break;
case GdiGetAspectRatioFilter: - Ret = IntGetAspectRatioFilter(dc, &Size); + DC_vGetAspectRatioFilter(pdc, &Size); SafePoint.x = Size.cx; SafePoint.y = Size.cy; break; @@ -1269,9 +1250,7 @@ { _SEH2_TRY { - ProbeForWrite(Point, - sizeof(POINT), - 1); + ProbeForWrite(Point, sizeof(POINT), 1); *Point = SafePoint; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) @@ -1279,16 +1258,15 @@ Status = _SEH2_GetExceptionCode(); } _SEH2_END; - } - - if (!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - DC_UnlockDc(dc); - return FALSE; - } - - DC_UnlockDc(dc); + + if (!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + Ret = FALSE; + } + } + + DC_UnlockDc(pdc); return Ret; }
Modified: trunk/reactos/subsystems/win32/win32k/objects/dcutil.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] Tue Mar 24 05:58:14 2009 @@ -3,126 +3,6 @@
#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 APIENTRY func_name( HDC hdc ) \ -{ \ - func_type ft; \ - PDC dc = DC_LockDc( hdc ); \ - PDC_ATTR pdcattr; \ - if (!dc) \ - { \ - SetLastWin32Error(ERROR_INVALID_HANDLE); \ - return 0; \ - } \ - pdcattr = dc->pdcattr; \ - ft = pdcattr->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 pdcattr; \ - ASSERT(dc); \ - ASSERT(pt); \ - pdcattr = dc->pdcattr; \ - pt->ax = pdcattr->ret_x; \ - pt->ay = pdcattr->ret_y; \ -} - -#if 0 -BOOL APIENTRY 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); \ - _SEH2_TRY \ - { \ - ProbeForWrite(pt, \ - sizeof( type ), \ - 1); \ - *pt = Safept; \ - } \ - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) \ - { \ - Status = _SEH2_GetExceptionCode(); \ - } \ - _SEH2_END; \ - if(!NT_SUCCESS(Status)) \ - { \ - SetLastNtError(Status); \ - return FALSE; \ - } \ - return TRUE; \ -} -#endif - -#define DC_SET_MODE( func_name, dc_field, min_val, max_val ) \ -INT APIENTRY func_name( HDC hdc, INT mode ) \ -{ \ - INT prevMode; \ - PDC dc; \ - PDC_ATTR pdcattr; \ - 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; \ - } \ - pdcattr = dc->pdcattr; \ - prevMode = pdcattr->dc_field; \ - pdcattr->dc_field = mode; \ - DC_UnlockDc ( dc ); \ - return prevMode; \ -} - - -DC_GET_VAL( INT, IntGdiGetMapMode, iMapMode ) -DC_GET_VAL( INT, IntGdiGetPolyFillMode, jFillMode ) -DC_GET_VAL( COLORREF, IntGdiGetBkColor, crBackgroundClr ) -DC_GET_VAL( INT, IntGdiGetBkMode, jBkMode ) -DC_GET_VAL( INT, IntGdiGetROP2, jROP2 ) -DC_GET_VAL( INT, IntGdiGetStretchBltMode, jStretchBltMode ) -DC_GET_VAL( UINT, IntGdiGetTextAlign, lTextAlign ) -DC_GET_VAL( COLORREF, IntGdiGetTextColor, crForegroundClr ) - -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_SET_MODE( IntGdiSetPolyFillMode, jFillMode, ALTERNATE, WINDING ) -DC_SET_MODE( IntGdiSetROP2, jROP2, R2_BLACK, R2_WHITE ) -DC_SET_MODE( IntGdiSetStretchBltMode, jStretchBltMode, BLACKONWHITE, HALFTONE ) - -
COLORREF FASTCALL IntGdiSetBkColor(HDC hDC, COLORREF color)
Modified: trunk/reactos/subsystems/win32/win32k/objects/fillshap.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] Tue Mar 24 05:58:14 2009 @@ -566,7 +566,7 @@ DestRect.bottom += dc->ptlDCOrig.y;
/* In GM_COMPATIBLE, don't include bottom and right edges */ - if (IntGetGraphicsMode(dc) == GM_COMPATIBLE) + if (pdcattr->iGraphicsMode == GM_COMPATIBLE) { DestRect.right--; DestRect.bottom--;
Modified: trunk/reactos/subsystems/win32/win32k/objects/path.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] Tue Mar 24 05:58:14 2009 @@ -350,7 +350,7 @@ }
/* In GM_COMPATIBLE, don't include bottom and right edges */ - if ( IntGetGraphicsMode(dc) == GM_COMPATIBLE ) + if (dc->pdcattr->iGraphicsMode == GM_COMPATIBLE) { corners[1].x--; corners[1].y--; @@ -606,7 +606,7 @@ }
/* In GM_COMPATIBLE, don't include bottom and right edges */ - if ( IntGetGraphicsMode(dc) == GM_COMPATIBLE ) + if (dc->pdcattr->iGraphicsMode == GM_COMPATIBLE ) { corners[1].x--; corners[1].y--; @@ -1343,11 +1343,13 @@
/* Save the mapping mode info */ mapMode = pdcattr->iMapMode; - IntGetViewportExtEx(dc, &szViewportExt); - IntGetViewportOrgEx(dc, &ptViewportOrg); - IntGetWindowExtEx(dc, &szWindowExt); - IntGetWindowOrgEx(dc, &ptWindowOrg); - + + DC_vUpdateViewportExt(dc); + szViewportExt = dc->pdcattr->szlViewportExt; + ptViewportOrg = dc->pdcattr->ptlViewportOrg; + szWindowExt = dc->pdcattr->szlWindowExt; + ptWindowOrg = dc->pdcattr->ptlWindowOrg; + MatrixS2XForm(&xform, &dc->dclevel.mxWorldToPage);
/* Set MM_TEXT */