Author: jimtabor
Date: Thu Nov 29 06:32:23 2007
New Revision: 30850
URL:
http://svn.reactos.org/svn/reactos?rev=30850&view=rev
Log:
Fix typos and add check for DC type object.
Modified:
trunk/reactos/dll/win32/gdi32/objects/coord.c
trunk/reactos/dll/win32/gdi32/objects/text.c
Modified: trunk/reactos/dll/win32/gdi32/objects/coord.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/co…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/coord.c (original)
+++ trunk/reactos/dll/win32/gdi32/objects/coord.c Thu Nov 29 06:32:23 2007
@@ -98,7 +98,8 @@
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 @@
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 @@
{
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 @@
#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 @@
{
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 @@
{
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 @@
{
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 @@
{
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,13 +357,17 @@
}
}
#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->ptlWindowExt.cx == nXExtent) && (Dc_Attr->ptlWindowExt.cy
== nYExtent))
+ return TRUE;
if ((Dc_Attr->iMapMode == MM_ISOTROPIC) && (Dc_Attr->iMapMode ==
MM_ANISOTROPIC))
{
@@ -409,7 +421,8 @@
}
}
#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 @@
}
}
#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 @@
}
}
#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 @@
)
{
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 @@
}
}
#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 @@
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);
}
Modified: trunk/reactos/dll/win32/gdi32/objects/text.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/te…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/text.c (original)
+++ trunk/reactos/dll/win32/gdi32/objects/text.c Thu Nov 29 06:32:23 2007
@@ -55,7 +55,8 @@
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 @@
{
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 @@
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 @@
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 @@
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 @@
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 @@
#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 @@
{
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 @@
}
}
#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 @@
)
{
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 @@
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)