Implement SetTextJustification. Add code for Window and Viewport Org and Ext. Setup SetRectRgn and added rgn_attr types.

svn path=/trunk/; revision=30809
This commit is contained in:
James Tabor 2007-11-27 05:40:50 +00:00
parent 19c56142c7
commit df9ecdbb80
5 changed files with 338 additions and 97 deletions

View file

@ -74,77 +74,6 @@ SetStretchBltMode(HDC hdc, int iStretchMode)
return NtGdiSetStretchBltMode(hdc, iStretchMode);
}
/*
* @unimplemented
*/
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
*/
@ -398,22 +327,6 @@ SetMetaFileBitsEx(
return 0;
}
/*
* @unimplemented
*/
BOOL
STDCALL
SetTextJustification(
HDC a0,
int a1,
int a2
)
{
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/*
* @unimplemented
*/

View file

@ -867,7 +867,7 @@ SetBkColor(
}
if (pLDC->iType == LDC_EMFLDC)
{
if return EMFDRV_SetBkColor( hDC, crColor );
return EMFDRV_SetBkColor( hDC, crColor );
}
}
}
@ -924,7 +924,7 @@ SetBkMode(HDC hdc,
}
if (pLDC->iType == LDC_EMFLDC)
{
if return EMFDRV_SetBkMode( hdc, iBkMode )
return EMFDRV_SetBkMode( hdc, iBkMode )
}
}
}
@ -973,7 +973,7 @@ SetPolyFillMode(HDC hdc,
}
if (pLDC->iType == LDC_EMFLDC)
{
if return EMFDRV_SetPolyFillMode( hdc, iPolyFillMode )
return EMFDRV_SetPolyFillMode( hdc, iPolyFillMode )
}
}
}
@ -1258,6 +1258,240 @@ GetWindowOrgEx(
//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,

View file

@ -136,3 +136,54 @@ ExtCreateRegion(
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
}

View file

@ -572,3 +572,41 @@ SetTextColor(
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;
}

View file

@ -192,6 +192,15 @@
#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 *********************************************************************/
typedef struct _GDI_TABLE_ENTRY
@ -291,15 +300,11 @@ typedef struct _BRUSH_ATTR
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