Author: jimtabor Date: Tue Nov 27 08:40:50 2007 New Revision: 30809
URL: http://svn.reactos.org/svn/reactos?rev=30809&view=rev Log: Implement SetTextJustification. Add code for Window and Viewport Org and Ext. Setup SetRectRgn and added rgn_attr types.
Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c trunk/reactos/dll/win32/gdi32/objects/dc.c trunk/reactos/dll/win32/gdi32/objects/region.c trunk/reactos/dll/win32/gdi32/objects/text.c trunk/reactos/include/reactos/win32k/ntgdihdl.h
Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubs.... ============================================================================== --- trunk/reactos/dll/win32/gdi32/misc/stubs.c (original) +++ trunk/reactos/dll/win32/gdi32/misc/stubs.c Tue Nov 27 08:40:50 2007 @@ -79,77 +79,6 @@ */ BOOL STDCALL -SetRectRgn(HRGN hrgn, - int nLeftRect, - int nTopRect, - int nRightRect, - int nBottomRect) -{ - /* FIXME metadc stuff */ - return NtGdiSetRectRgn(hrgn, nLeftRect, nTopRect, nRightRect, nBottomRect); -} - -/* - * @unimplemented - */ -BOOL -STDCALL -SetViewportExtEx(HDC hdc, - int nXExtent, - int nYExtent, - LPSIZE lpSize) -{ - /* FIXME share memory */ - return NtGdiSetViewportExtEx(hdc, nXExtent, nYExtent, lpSize); -} - -/* - * @unimplemented - */ -BOOL -STDCALL -SetWindowOrgEx(HDC hdc, - int X, - int Y, - LPPOINT lpPoint) -{ - /* FIXME share memory */ - return NtGdiSetWindowOrgEx(hdc,X,Y,lpPoint); -} - -/* - * @unimplemented - */ -BOOL -STDCALL -SetWindowExtEx(HDC hdc, - int nXExtent, - int nYExtent, - LPSIZE lpSize) -{ - /* FIXME share memory */ - return NtGdiSetWindowExtEx(hdc, nXExtent, nYExtent, lpSize); -} - -/* - * @unimplemented - */ -BOOL -STDCALL -SetViewportOrgEx(HDC hdc, - int X, - int Y, - LPPOINT lpPoint) -{ - /* FIXME share memory */ - return NtGdiSetViewportOrgEx(hdc,X,Y,lpPoint); -} - -/* - * @unimplemented - */ -BOOL -STDCALL PtInRegion(IN HRGN hrgn, int x, int y) @@ -396,22 +325,6 @@ UNIMPLEMENTED; SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return 0; -} - -/* - * @unimplemented - */ -BOOL -STDCALL -SetTextJustification( - HDC a0, - int a1, - int a2 - ) -{ - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; }
/*
Modified: trunk/reactos/dll/win32/gdi32/objects/dc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/dc.... ============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/dc.c (original) +++ trunk/reactos/dll/win32/gdi32/objects/dc.c Tue Nov 27 08:40:50 2007 @@ -867,7 +867,7 @@ } if (pLDC->iType == LDC_EMFLDC) { - if return EMFDRV_SetBkColor( hDC, crColor ); + return EMFDRV_SetBkColor( hDC, crColor ); } } } @@ -924,7 +924,7 @@ } if (pLDC->iType == LDC_EMFLDC) { - if return EMFDRV_SetBkMode( hdc, iBkMode ) + return EMFDRV_SetBkMode( hdc, iBkMode ) } } } @@ -973,7 +973,7 @@ } if (pLDC->iType == LDC_EMFLDC) { - if return EMFDRV_SetPolyFillMode( hdc, iPolyFillMode ) + return EMFDRV_SetPolyFillMode( hdc, iPolyFillMode ) } } } @@ -1258,6 +1258,240 @@ //return NtGdiGetDCPoint( hdc, GdiGetWindowOrg, lpPoint ); }
+/* + * @unimplemented + */ +BOOL +STDCALL +SetViewportExtEx(HDC hdc, + int nXExtent, + int nYExtent, + LPSIZE lpSize) +{ +#if 0 + PDC_ATTR Dc_Attr; +#if 0 + if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) + { + if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) + return MFDRV_SetViewportExtEx(); + else + { + PLDC pLDC = GdiGetLDC(hdc); + if ( !pLDC ) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + if (pLDC->iType == LDC_EMFLDC) + { + return EMFDRV_SetViewportExtEx(); + } + } + } +#endif + if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE; + + if (lpSize) + { + lpSize->cx = Dc_Attr->szlWindowExt.cx; + lpSize->cy = Dc_Attr->szlWindowExt.cy; + } + + if ((Dc_Attr->iMapMode == MM_ISOTROPIC) && (Dc_Attr->iMapMode == MM_ANISOTROPIC)) + { + if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hdc) + { + if (Dc_Attr->ulDirty_ & DC_FONTTEXT_DIRTY) + { + NtGdiFlush(); // Sync up Dc_Attr from Kernel space. + Dc_Attr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY); + } + } + + Dc_Attr->flXform |= (PAGE_EXTENTS_CHANGED|INVALIDATE_ATTRIBUTES|DEVICE_TO_WORLD_INVALID); + Dc_Attr->szlWindowExt.cx = nXExtent; + Dc_Attr->szlWindowExt.cy = nYExtent; + } + return TRUE; +#endif + return NtGdiSetViewportExtEx(hdc, nXExtent, nYExtent, lpSize); +} + +/* + * @unimplemented + */ +BOOL +STDCALL +SetWindowOrgEx(HDC hdc, + int X, + int Y, + LPPOINT lpPoint) +{ +#if 0 + PDC_ATTR Dc_Attr; +#if 0 + if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) + { + if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) + return MFDRV_SetWindowOrgEx(); + else + { + PLDC pLDC = GdiGetLDC(hdc); + if ( !pLDC ) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + if (pLDC->iType == LDC_EMFLDC) + { + return EMFDRV_SetWindowOrgEx(); + } + } + } +#endif + if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE; + + if (lpPoint) + { + lpPoint->x = Dc_Attr->ptlWindowOrg.x; + lpPoint->y = Dc_Attr->ptlWindowOrg.y; + } + + if ((Dc_Attr->ptlWindowOrg.x == X) && (Dc_Attr->ptlWindowOrg.y == Y)) + return TRUE; + + if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hdc) + { + if (Dc_Attr->ulDirty_ & DC_FONTTEXT_DIRTY) + { + NtGdiFlush(); // Sync up Dc_Attr from Kernel space. + Dc_Attr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY); + } + } + + Dc_Attr->flXform |= (PAGE_XLATE_CHANGED|DEVICE_TO_WORLD_INVALID); + Dc_Attr->ptlWindowOrg.x = X; + Dc_Attr->ptlWindowOrg.y = Y; + return TRUE; +#endif + return NtGdiSetWindowOrgEx(hdc,X,Y,lpPoint); +} + +/* + * @unimplemented + */ +BOOL +STDCALL +SetWindowExtEx(HDC hdc, + int nXExtent, + int nYExtent, + LPSIZE lpSize) +{ +#if 0 + PDC_ATTR Dc_Attr; +#if 0 + if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) + { + if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) + return MFDRV_SetWindowExtEx(); + else + { + PLDC pLDC = GdiGetLDC(hdc); + if ( !pLDC ) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + if (pLDC->iType == LDC_EMFLDC) + { + return EMFDRV_SetWindowExtEx(); + } + } + } +#endif + if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE; + + if (lpSize) + { + lpSize->cx = Dc_Attr->szlWindowExt.cx; + lpSize->cy = Dc_Attr->szlWindowExt.cy; + } + + if ((Dc_Attr->iMapMode == MM_ISOTROPIC) && (Dc_Attr->iMapMode == MM_ANISOTROPIC)) + { + if ((Dc_Attr->szlWindowExt.cx == nXExtent) && (Dc_Attr->szlWindowExt.cy == nYExtent)) + return TRUE; + + if ((!nXExtent) && (!nYExtent)) return FALSE; + + if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hdc) + { + if (Dc_Attr->ulDirty_ & DC_FONTTEXT_DIRTY) + { + NtGdiFlush(); // Sync up Dc_Attr from Kernel space. + Dc_Attr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY); + } + } + + Dc_Attr->flXform |= (PAGE_EXTENTS_CHANGED|INVALIDATE_ATTRIBUTES|DEVICE_TO_WORLD_INVALID); + Dc_Attr->szlWindowExt.cx = nXExtent; + Dc_Attr->szlWindowExt.cy = nYExtent; + } + return TRUE; +#endif + return NtGdiSetWindowExtEx(hdc, nXExtent, nYExtent, lpSize); +} + +/* + * @unimplemented + */ +BOOL +STDCALL +SetViewportOrgEx(HDC hdc, + int X, + int Y, + LPPOINT lpPoint) +{ +#if 0 + PDC_ATTR Dc_Attr; +#if 0 + if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) + { + if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) + return MFDRV_SetViewportOrgEx(); + else + { + PLDC pLDC = GdiGetLDC(hdc); + if ( !pLDC ) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + if (pLDC->iType == LDC_EMFLDC) + { + return EMFDRV_SetViewportOrgEx(); + } + } + } +#endif + if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE; + + if (lpPoint) + { + lpPoint->x = Dc_Attr->ptlViewportOrg.x; + lpPoint->y = Dc_Attr->ptlViewportOrg.y; + } + Dc_Attr->flXform |= (PAGE_XLATE_CHANGED|DEVICE_TO_WORLD_INVALID); + Dc_Attr->ptlViewportOrg.x = X; + Dc_Attr->ptlViewportOrg.y = Y; + return TRUE; +#endif + return NtGdiSetViewportOrgEx(hdc,X,Y,lpPoint); +} + + + /* FIXME: include correct header */ HPALETTE STDCALL NtUserSelectPalette(HDC hDC, HPALETTE hpal,
Modified: trunk/reactos/dll/win32/gdi32/objects/region.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/reg... ============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/region.c (original) +++ trunk/reactos/dll/win32/gdi32/objects/region.c Tue Nov 27 08:40:50 2007 @@ -136,3 +136,54 @@ return NULL; }
+ +/* + * @implemented + */ +BOOL +STDCALL +SetRectRgn(HRGN hrgn, + int nLeftRect, + int nTopRect, + int nRightRect, + int nBottomRect) +{ +#if 0 + PREGION_ATTR Rgn_Attr; + + if (!(GdiGetHandleUserData((HGDIOBJ) hrgn, (PVOID) &Rgn_Attr)) || + (GDI_HANDLE_GET_TYPE(hrgn) != GDI_OBJECT_TYPE_REGION)) +#endif + return NtGdiSetRectRgn(hrgn, nLeftRect, nTopRect, nRightRect, nBottomRect); +#if 0 + if ((nLeftRect == nRightRect) || (nTopRect == nBottomRect)) + { + Rgn_Attr->flFlags |= DIRTY_RGNATTR; + Rgn_Attr->dwType = RGNATTR_INIT; + Rgn_Attr->rcBound.left = Rgn_Attr->rcBound.top = + Rgn_Attr->rcBound.right = Rgn_Attr->rcBound.bottom = 0; + return TRUE; + } + + Rgn_Attr->rcBound.left = nLeftRect; + Rgn_Attr->rcBound.top = nTopRect; + Rgn_Attr->rcBound.right = nRightRect; + Rgn_Attr->rcBound.bottom = nBottomRect; + + if(nLeftRect > nRightRect) + { + Rgn_Attr->rcBound.left = nRightRect; + Rgn_Attr->rcBound.right = nLeftRect; + } + if(nTopRect > nBottomRect) + { + Rgn_Attr->rcBound.top = nBottomRect; + Rgn_Attr->rcBound.bottom = nTopRect; + } + + Rgn_Attr->flFlags |= DIRTY_RGNATTR; + Rgn_Attr->dwType = RGNATTR_SET; + return TRUE; +#endif +} +
Modified: trunk/reactos/dll/win32/gdi32/objects/text.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/tex... ============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/text.c (original) +++ trunk/reactos/dll/win32/gdi32/objects/text.c Tue Nov 27 08:40:50 2007 @@ -572,3 +572,41 @@ return OldColor; }
+/* + * @implemented + */ +BOOL +STDCALL +SetTextJustification( + HDC hdc, + int extra, + int breaks + ) +{ + PDC_ATTR Dc_Attr; + if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE; +#if 0 + if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC) + { + if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC) + return MFDRV_SetTextJustification( hdc, extra, breaks ) + else + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } +#endif + if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hdc) + { + if (Dc_Attr->ulDirty_ & DC_FONTTEXT_DIRTY) + { + NtGdiFlush(); // Sync up Dc_Attr from Kernel space. + Dc_Attr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY); + } + } + Dc_Attr->cBreak = breaks; + Dc_Attr->lBreakExtra = extra; + return TRUE; +} + +
Modified: trunk/reactos/include/reactos/win32k/ntgdihdl.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntgd... ============================================================================== --- trunk/reactos/include/reactos/win32k/ntgdihdl.h (original) +++ trunk/reactos/include/reactos/win32k/ntgdihdl.h Tue Nov 27 08:40:50 2007 @@ -191,6 +191,15 @@ #define PAGE_XLATE_CHANGED 0x00002000 #define PAGE_EXTENTS_CHANGED 0x00004000 #define WORLD_XFORM_CHANGED 0x00008000 + + +/* RGN_ATTR Dirty Flags */ +#define DIRTY_RGNATTR 0x00000020 + +/* RGN_ATTR Type Flags */ +#define RGNATTR_INIT 0x00000001 +#define RGNATTR_SET 0x00000002 +
/* TYPES *********************************************************************/
@@ -291,15 +300,11 @@ DWORD dwUnused[3]; } BRUSH_ATTR, *PBRUSH_ATTR;
- typedef struct _REGION_ATTR { - DWORD dwUnknown1; - DWORD dwUnknown2; - LONG right; - LONG bottom; - LONG left; - LONG top; + FLONG flFlags; + DWORD dwType; + RECT rcBound; } REGION_ATTR, *PREGION_ATTR;
typedef struct _FONT_ATTR