From bccb44324c1651356f6404929d13830add0ddc81 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Sat, 4 Aug 2007 07:37:27 +0000 Subject: [PATCH] Dc.c : - Update Get/SetDCBrush/PenColor code. * Added dcattr sync flags to Set functions. * if'ed out, does compile. Painting.c : - Update LP to DP to LP code. * Added update flags for Xforms, the best way I understand them. * if'ed out. - Moved Fixme line down and above GetDCObject. svn path=/trunk/; revision=28150 --- reactos/dll/win32/gdi32/objects/dc.c | 48 ++++++++++++++++++++++ reactos/dll/win32/gdi32/objects/painting.c | 33 ++++++++++++--- reactos/include/psdk/wingdi.h | 4 ++ 3 files changed, 80 insertions(+), 5 deletions(-) diff --git a/reactos/dll/win32/gdi32/objects/dc.c b/reactos/dll/win32/gdi32/objects/dc.c index 0cbc60df0b8..1e2d4d0ec9a 100644 --- a/reactos/dll/win32/gdi32/objects/dc.c +++ b/reactos/dll/win32/gdi32/objects/dc.c @@ -544,6 +544,12 @@ GetDCBrushColor( HDC hdc ) { +#if 0 + PDC_ATTR Dc_Attr; + + if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return CLR_INVALID; + return (COLORREF) Dc_Attr->ulPenClr; +#endif return NtUserGetDCBrushColor(hdc); } @@ -556,6 +562,12 @@ GetDCPenColor( HDC hdc ) { +#if 0 + PDC_ATTR Dc_Attr; + + if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return CLR_INVALID; + return (COLORREF) Dc_Attr->ulPenClr; +#endif return NtUserGetDCPenColor(hdc); } @@ -569,6 +581,24 @@ SetDCBrushColor( COLORREF crColor ) { +#if 0 + PDC_ATTR Dc_Attr; + COLORREF OldColor = CLR_INVALID; + + if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return OldColor; + else + { + OldColor = (COLORREF) Dc_Attr->ulBrushClr; + Dc_Attr->ulBrushClr = (ULONG) crColor; + + if ( Dc_Attr->crBrushClr != crColor ) // if same, don't force a copy. + { + Dc_Attr->ulDirty_ |= DIRTY_FILL; + Dc_Attr->crBrushClr = crColor; + } + } + return OldColor; +#endif return NtUserSetDCBrushColor(hdc, crColor); } @@ -582,6 +612,24 @@ SetDCPenColor( COLORREF crColor ) { +#if 0 + PDC_ATTR Dc_Attr; + COLORREF OldColor = CLR_INVALID; + + if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return OldColor; + else + { + OldColor = (COLORREF) Dc_Attr->ulPenClr; + Dc_Attr->ulPenClr = (ULONG) crColor; + + if ( Dc_Attr->crPenClr != crColor ) + { + Dc_Attr->ulDirty_ |= DIRTY_LINE; + Dc_Attr->crPenClr = crColor; + } + } + return OldColor; +#endif return NtUserSetDCPenColor(hdc, crColor); } diff --git a/reactos/dll/win32/gdi32/objects/painting.c b/reactos/dll/win32/gdi32/objects/painting.c index 6cb531c12c7..5a56201bf33 100644 --- a/reactos/dll/win32/gdi32/objects/painting.c +++ b/reactos/dll/win32/gdi32/objects/painting.c @@ -18,7 +18,6 @@ __asm fistp out #endif -#if 0 /* FIXME: enable this as soon as we have working usermode gdi */ LONG FASTCALL EFtoF( EFLOAT_S * efp) @@ -93,14 +92,26 @@ BOOL STDCALL DPtoLP ( HDC hDC, LPPOINT Points, INT Count ) { +#if 0 INT i; PDC_ATTR Dc_Attr; if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr)) return FALSE; - for ( i = 0; i < Count; i++ ) - CoordCnvP ( &Dc_Attr->mxDevicetoWorld, &Points[i] ); + if (Dc_Attr->flXform & ( DEVICE_TO_WORLD_INVALID | // Force a full recalibration! + PAGE_XLATE_CHANGED | // Changes or Updates have been made, + PAGE_EXTENTS_CHANGED | // do processing in kernel space. + WORLD_XFORM_CHANGED ) +#endif + return NtGdiTransformPoints( hDC, Points, Points, Count, 0); // Last is 0 or 2 +#if 0 + else + { + for ( i = 0; i < Count; i++ ) + CoordCnvP ( &Dc_Attr->mxDevicetoWorld, &Points[i] ); + } return TRUE; +#endif } @@ -108,16 +119,28 @@ BOOL STDCALL LPtoDP ( HDC hDC, LPPOINT Points, INT Count ) { +#if 0 INT i; PDC_ATTR Dc_Attr; if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr)) return FALSE; - for ( i = 0; i < Count; i++ ) - CoordCnvP ( &Dc_Attr->mxWorldToDevice, &Points[i] ); + if (Dc_Attr->flXform & ( PAGE_XLATE_CHANGED | // Check for Changes and Updates + PAGE_EXTENTS_CHANGED | + WORLD_XFORM_CHANGED ) +#endif + return NtGdiTransformPoints( hDC, Points, Points, Count, 0); +#if 0 + else + { + for ( i = 0; i < Count; i++ ) + CoordCnvP ( &Dc_Attr->mxWorldToDevice, &Points[i] ); + } return TRUE; +#endif } +#if 0 /* FIXME: enable this as soon as we have working usermode gdi */ // Will move to dc.c HGDIOBJ diff --git a/reactos/include/psdk/wingdi.h b/reactos/include/psdk/wingdi.h index 67988122d0e..35feb209fb7 100644 --- a/reactos/include/psdk/wingdi.h +++ b/reactos/include/psdk/wingdi.h @@ -2753,6 +2753,10 @@ HGDIOBJ WINAPI GetCurrentObject(HDC,UINT); BOOL WINAPI GetCurrentPositionEx(HDC,LPPOINT); HCURSOR WINAPI GetCursor(void); BOOL WINAPI GetDCOrgEx(HDC,LPPOINT); +#if (_WIN32_WINNT >= 0x0500) +COLORREF WINAPI GetDCBrushColor(HDC); +COLORREF WINAPI GetDCPenColor(HDC); +#endif int WINAPI GetDeviceCaps(HDC,int); BOOL WINAPI GetDeviceGammaRamp(HDC,PVOID); UINT WINAPI GetDIBColorTable(HDC,UINT,UINT,RGBQUAD*);