mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 12:29:56 +00:00
Fix typos and add check for DC type object.
svn path=/trunk/; revision=30850
This commit is contained in:
parent
a63375b80e
commit
b6a91f911b
2 changed files with 59 additions and 27 deletions
|
@ -98,7 +98,8 @@ DPtoLP ( HDC hDC, LPPOINT Points, INT Count )
|
|||
INT i;
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr)) return FALSE;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||
|
||||
if (Dc_Attr->flXform & ( DEVICE_TO_WORLD_INVALID | // Force a full recalibration!
|
||||
PAGE_XLATE_CHANGED | // Changes or Updates have been made,
|
||||
|
@ -125,7 +126,8 @@ LPtoDP ( HDC hDC, LPPOINT Points, INT Count )
|
|||
INT i;
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr)) return FALSE;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||
|
||||
if (Dc_Attr->flXform & ( PAGE_XLATE_CHANGED | // Check for Changes and Updates
|
||||
PAGE_EXTENTS_CHANGED |
|
||||
|
@ -153,7 +155,8 @@ GetCurrentPositionEx(HDC hdc,
|
|||
{
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||
|
||||
if ( lpPoint )
|
||||
{
|
||||
|
@ -234,7 +237,8 @@ ModifyWorldTransform(
|
|||
#endif
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr)) return FALSE;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||
|
||||
/* Check that graphics mode is GM_ADVANCED */
|
||||
if ( Dc_Attr->iGraphicsMode != GM_ADVANCED ) return FALSE;
|
||||
|
@ -251,7 +255,8 @@ GetViewportExtEx(
|
|||
{
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||
|
||||
if ((Dc_Attr->flXform & PAGE_EXTENTS_CHANGED) && (Dc_Attr->iMapMode == MM_ISOTROPIC))
|
||||
// Something was updated, go to kernel.
|
||||
|
@ -274,7 +279,8 @@ GetViewportOrgEx(
|
|||
{
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||
lpPoint->x = Dc_Attr->ptlViewportOrg.x;
|
||||
lpPoint->y = Dc_Attr->ptlViewportOrg.y;
|
||||
if (Dc_Attr->dwLayout & LAYOUT_RTL) lpPoint->x = -lpPoint->x;
|
||||
|
@ -292,7 +298,8 @@ GetWindowExtEx(
|
|||
{
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||
lpSize->cx = Dc_Attr->szlWindowExt.cx;
|
||||
lpSize->cy = Dc_Attr->szlWindowExt.cy;
|
||||
if (Dc_Attr->dwLayout & LAYOUT_RTL) lpSize->cx = -lpSize->cx;
|
||||
|
@ -310,7 +317,8 @@ GetWindowOrgEx(
|
|||
{
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||
lpPoint->x = Dc_Attr->ptlWindowOrg.x;
|
||||
lpPoint->y = Dc_Attr->ptlWindowOrg.y;
|
||||
return TRUE;
|
||||
|
@ -349,7 +357,8 @@ SetViewportExtEx(HDC hdc,
|
|||
}
|
||||
}
|
||||
#endif
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||
|
||||
if (lpSize)
|
||||
{
|
||||
|
@ -357,6 +366,9 @@ SetViewportExtEx(HDC hdc,
|
|||
lpSize->cy = Dc_Attr->szlWindowExt.cy;
|
||||
}
|
||||
|
||||
if ((Dc_Attr->ptlWindowExt.cx == nXExtent) && (Dc_Attr->ptlWindowExt.cy == nYExtent))
|
||||
return TRUE;
|
||||
|
||||
if ((Dc_Attr->iMapMode == MM_ISOTROPIC) && (Dc_Attr->iMapMode == MM_ANISOTROPIC))
|
||||
{
|
||||
if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hdc)
|
||||
|
@ -409,7 +421,8 @@ SetWindowOrgEx(HDC hdc,
|
|||
}
|
||||
}
|
||||
#endif
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||
|
||||
if (lpPoint)
|
||||
{
|
||||
|
@ -471,13 +484,14 @@ SetWindowExtEx(HDC hdc,
|
|||
}
|
||||
}
|
||||
#endif
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||
|
||||
if (lpSize)
|
||||
{
|
||||
lpSize->cx = Dc_Attr->szlWindowExt.cx;
|
||||
lpSize->cy = Dc_Attr->szlWindowExt.cy;
|
||||
if (Dc_Attr->dwLayout & LAYOUT_RTL) -lpSize->cx;
|
||||
if (Dc_Attr->dwLayout & LAYOUT_RTL) lpSize->cx = -lpSize->cx;
|
||||
}
|
||||
|
||||
if (Dc_Attr->dwLayout & LAYOUT_RTL)
|
||||
|
@ -542,15 +556,17 @@ SetViewportOrgEx(HDC hdc,
|
|||
}
|
||||
}
|
||||
#endif
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||
|
||||
if (lpPoint)
|
||||
{
|
||||
lpPoint->x = Dc_Attr->ptlViewportOrg.x;
|
||||
lpPoint->y = Dc_Attr->ptlViewportOrg.y;
|
||||
if (Dc_Attr->dwLayout & LAYOUT_RTL) -lpPoint->x;
|
||||
if (Dc_Attr->dwLayout & LAYOUT_RTL) lpPoint->x = -lpPoint->x;
|
||||
}
|
||||
Dc_Attr->flXform |= (PAGE_XLATE_CHANGED|DEVICE_TO_WORLD_INVALID);
|
||||
if (Dc_Attr->dwLayout & LAYOUT_RTL) X = -X;
|
||||
Dc_Attr->ptlViewportOrg.x = X;
|
||||
Dc_Attr->ptlViewportOrg.y = Y;
|
||||
return TRUE;
|
||||
|
@ -567,7 +583,8 @@ GetLayout(HDC hdc
|
|||
)
|
||||
{
|
||||
PDC_ATTR Dc_Attr;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return GDI_ERROR;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return GDI_ERROR;
|
||||
return Dc_Attr->dwLayout;
|
||||
}
|
||||
|
||||
|
@ -600,7 +617,8 @@ SetLayout(HDC hdc,
|
|||
}
|
||||
}
|
||||
#endif
|
||||
if (!GdiIsHandleValid((HGDIOBJ) hdc)) return GDI_ERROR;
|
||||
if (!GdiIsHandleValid((HGDIOBJ) hdc) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return GDI_ERROR;
|
||||
return NtGdiSetLayout( hdc, -1, dwLayout);
|
||||
}
|
||||
|
||||
|
@ -611,7 +629,8 @@ DWORD
|
|||
STDCALL
|
||||
SetLayoutWidth(HDC hdc,LONG wox,DWORD dwLayout)
|
||||
{
|
||||
if (!GdiIsHandleValid((HGDIOBJ) hdc)) return GDI_ERROR;
|
||||
if (!GdiIsHandleValid((HGDIOBJ) hdc) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return GDI_ERROR;
|
||||
return NtGdiSetLayout( hdc, wox, dwLayout);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,8 @@ STDCALL
|
|||
GdiGetCodePage(HDC hdc)
|
||||
{
|
||||
PDC_ATTR Dc_Attr;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return 0;
|
||||
if (Dc_Attr->ulDirty_ & DIRTY_CHARSET) return LOWORD(NtGdiGetCharSet(hdc));
|
||||
return LOWORD(Dc_Attr->iCS_CP);
|
||||
}
|
||||
|
@ -72,7 +73,8 @@ GetTextCharacterExtra(
|
|||
{
|
||||
PDC_ATTR Dc_Attr;
|
||||
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hDc, (PVOID) &Dc_Attr)) return 0;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hDc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hDc) == GDI_OBJECT_TYPE_DC)) return 0;
|
||||
return Dc_Attr->lTextExtra;
|
||||
// return GetDCDWord( hDc, GdiGetTextCharExtra, 0);
|
||||
}
|
||||
|
@ -442,7 +444,8 @@ SetTextCharacterExtra(
|
|||
return MFDRV_SetTextCharacterExtra( hDC, CharExtra ); // Wine port.
|
||||
}
|
||||
#endif
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr)) return cExtra;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_DC)) return cExtra;
|
||||
|
||||
if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hDC)
|
||||
{
|
||||
|
@ -467,7 +470,8 @@ STDCALL
|
|||
GetTextAlign(HDC hdc)
|
||||
{
|
||||
PDC_ATTR Dc_Attr;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return 0;
|
||||
return Dc_Attr->lTextAlign;
|
||||
}
|
||||
|
||||
|
@ -481,7 +485,8 @@ STDCALL
|
|||
GetTextColor(HDC hdc)
|
||||
{
|
||||
PDC_ATTR Dc_Attr;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return 0;
|
||||
return Dc_Attr->ulForegroundClr;
|
||||
}
|
||||
|
||||
|
@ -498,7 +503,8 @@ SetTextAlign(HDC hdc,
|
|||
PDC_ATTR Dc_Attr;
|
||||
INT OldMode = 0;
|
||||
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return OldMode;
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return OldMode;
|
||||
#if 0
|
||||
if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
|
||||
{
|
||||
|
@ -521,7 +527,11 @@ SetTextAlign(HDC hdc,
|
|||
#endif
|
||||
OldMode = Dc_Attr->lTextAlign;
|
||||
Dc_Attr->lTextAlign = fMode; // Raw
|
||||
Dc_Attr->flTextAlign = fMode & 0x1f;
|
||||
if (Dc_Attr->dwLayout & LAYOUT_RTL)
|
||||
{
|
||||
if(!(fMode & TA_CENTER)) fMode |= TA_RIGHT;
|
||||
}
|
||||
Dc_Attr->flTextAlign = fMode & (TA_BASELINE|TA_UPDATECP|TA_CENTER);
|
||||
return OldMode;
|
||||
|
||||
}
|
||||
|
@ -539,8 +549,6 @@ SetTextColor(
|
|||
{
|
||||
PDC_ATTR Dc_Attr;
|
||||
COLORREF OldColor = CLR_INVALID;
|
||||
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return OldColor;
|
||||
#if 0
|
||||
if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
|
||||
{
|
||||
|
@ -561,6 +569,9 @@ SetTextColor(
|
|||
}
|
||||
}
|
||||
#endif
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return OldColor;
|
||||
|
||||
OldColor = (COLORREF) Dc_Attr->ulForegroundClr;
|
||||
Dc_Attr->ulForegroundClr = (ULONG) crColor;
|
||||
|
||||
|
@ -584,7 +595,6 @@ SetTextJustification(
|
|||
)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -596,6 +606,9 @@ SetTextJustification(
|
|||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) &&
|
||||
(GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||
|
||||
if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hdc)
|
||||
{
|
||||
if (Dc_Attr->ulDirty_ & DC_FONTTEXT_DIRTY)
|
||||
|
|
Loading…
Reference in a new issue