Author: jimtabor
Date: Thu Apr 17 23:11:13 2008
New Revision: 33016
URL:
http://svn.reactos.org/svn/reactos?rev=33016&view=rev
Log:
Implement Win32k-Gdi32: GetAspectRatioFilter and SetMapperFlags.
Modified:
trunk/reactos/dll/win32/gdi32/misc/stubs.c
trunk/reactos/dll/win32/gdi32/objects/font.c
trunk/reactos/subsystems/win32/win32k/objects/dc.c
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 [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/misc/stubs.c [iso-8859-1] Thu Apr 17 23:11:13 2008
@@ -252,22 +252,6 @@
{
/* FIXME add check for vaildate the flags */
return NtGdiSetBoundsRect(hdc, (LPRECT)prc, flags);
-}
-
-
-/*
- * @unimplemented
- */
-DWORD
-STDCALL
-SetMapperFlags(
- HDC a0,
- DWORD a1
- )
-{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
}
/*
Modified: trunk/reactos/dll/win32/gdi32/objects/font.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/fo…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/font.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/objects/font.c [iso-8859-1] Thu Apr 17 23:11:13 2008
@@ -1678,6 +1678,60 @@
/*
+ * @implemented
+ */
+DWORD
+STDCALL
+SetMapperFlags(
+ HDC hDC,
+ DWORD flags
+ )
+{
+ DWORD Ret = GDI_ERROR;
+ 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_SetMapperFlags( hDC, flags);
+ else
+ {
+ PLDC pLDC = Dc_Attr->pvLDC;
+ if ( !pLDC )
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return GDI_ERROR;
+ }
+ if (pLDC->iType == LDC_EMFLDC)
+ {
+ return EMFDRV_SetMapperFlags( hDC, flags);
+ }
+ }
+ }
+#endif
+ if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return GDI_ERROR;
+
+ if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hDC)
+ {
+ if (Dc_Attr->ulDirty_ & DC_FONTTEXT_DIRTY)
+ {
+ NtGdiFlush();
+ Dc_Attr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY);
+ }
+ }
+
+ if ( flags & ~1 )
+ SetLastError(ERROR_INVALID_PARAMETER);
+ else
+ {
+ Ret = Dc_Attr->flFontMapper;
+ Dc_Attr->flFontMapper = flags;
+ }
+ return Ret;
+}
+
+
+/*
* @unimplemented
*/
int
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] Thu Apr 17 23:11:13
2008
@@ -1168,8 +1168,24 @@
IntGetAspectRatioFilter(PDC pDC,
LPSIZE AspectRatio)
{
- UNIMPLEMENTED;
- return FALSE;
+ PDC_ATTR pDc_Attr;
+
+ pDc_Attr = pDC->pDc_Attr;
+ if ( !pDc_Attr ) pDc_Attr = &pDC->Dc_Attr;
+
+ if ( pDc_Attr->flFontMapper & 1 ) // TRUE assume 1.
+ {
+ // "This specifies that Windows should only match fonts that have the
+ // same aspect ratio as the display.", Programming Windows, Fifth Ed.
+ AspectRatio->cx = ((PGDIDEVICE)pDC->pPDev)->GDIInfo.ulLogPixelsX;
+ AspectRatio->cy = ((PGDIDEVICE)pDC->pPDev)->GDIInfo.ulLogPixelsY;
+ }
+ else
+ {
+ AspectRatio->cx = 0;
+ AspectRatio->cy = 0;
+ }
+ return TRUE;
}
BOOL STDCALL
@@ -2262,6 +2278,14 @@
case GdiGetSetSelectFont:
break;
case GdiGetSetMapperFlagsInternal:
+ if (dwIn & ~1)
+ {
+ SetLastWin32Error(ERROR_INVALID_PARAMETER);
+ Ret = FALSE;
+ break;
+ }
+ SafeResult = Dc_Attr->flFontMapper;
+ Dc_Attr->flFontMapper = dwIn;
break;
case GdiGetSetMapMode:
SafeResult = IntGdiSetMapMode( dc, dwIn);