Author: jimtabor
Date: Sat Oct 18 23:47:04 2008
New Revision: 36825
URL:
http://svn.reactos.org/svn/reactos?rev=36825&view=rev
Log:
- Add missing CAPS to psdk.
- Implemented NtGdiGetDeviceCapsAll.
- Now support primary display device capabilities in shared gdi handle table.
Modified:
trunk/reactos/include/psdk/wingdi.h
trunk/reactos/subsystems/win32/win32k/include/dc.h
trunk/reactos/subsystems/win32/win32k/objects/dc.c
trunk/reactos/subsystems/win32/win32k/stubs/stubs.c
Modified: trunk/reactos/include/psdk/wingdi.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/wingdi.h?rev=…
==============================================================================
--- trunk/reactos/include/psdk/wingdi.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/wingdi.h [iso-8859-1] Sat Oct 18 23:47:04 2008
@@ -744,6 +744,10 @@
#define TC_VA_ABLE 16384
#define TC_RESERVED 32768
#define TC_SCROLLBLT 65536
+/* CLIPCAPS */
+#define CP_NONE 0
+#define CP_RECTANGLE 1
+#define CP_REGION 2
#define GCP_DBCS 1
#define GCP_ERROR 0x8000
#define GCP_CLASSIN 0x80000
@@ -863,6 +867,20 @@
#define TCI_SRCCHARSET 1
#define TCI_SRCCODEPAGE 2
#define TCI_SRCFONTSIG 3
+#if (_WIN32_WINNT >= 0x0500)
+/* SHADEBLENDCAPS */
+#define SB_NONE 0x00000000
+#define SB_CONST_ALPHA 0x00000001
+#define SB_PIXEL_ALPHA 0x00000002
+#define SB_PREMULT_ALPHA 0x00000004
+#define SB_GRAD_RECT 0x00000010
+#define SB_GRAD_TRI 0x00000020
+/* Color Management caps */
+#define CM_NONE 0x00000000
+#define CM_DEVICE_ICM 0x00000001
+#define CM_GAMMA_RAMP 0x00000002
+#define CM_CMYK_COLOR 0x00000004
+#endif
#define ICM_ON 2
#define ICM_OFF 1
#define ICM_QUERY 3
Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Sat Oct 18 23:47:04
2008
@@ -267,6 +267,7 @@
VOID FASTCALL IntGdiUnreferencePdev(PGDIDEVICE pPDev, DWORD CleanUpType);
HDC FASTCALL IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC);
BOOL FASTCALL IntGdiCleanDC(HDC hDC);
+VOID FASTCALL IntvGetDeviceCaps(PGDIDEVICE, PDEVCAPS);
extern PGDIDEVICE pPrimarySurface;
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] Sat Oct 18 23:47:04
2008
@@ -686,6 +686,9 @@
EngUnlockSurface(SurfObj);
co_IntShowDesktop(IntGetActiveDesktop(), SurfSize.cx, SurfSize.cy);
+
+ // Init Primary Displays Device Capabilities.
+ IntvGetDeviceCaps(&PrimarySurface, &GdiHandleTable->DevCaps);
if (!calledFromUser){
UserLeave();
@@ -1769,6 +1772,162 @@
return ret;
}
+INT
+FASTCALL
+IntcFonts(PGDIDEVICE pDevObj)
+{
+ ULONG_PTR Junk;
+// Msdn DrvQueryFont:
+// If the number of fonts in DEVINFO is -1 and iFace is zero, the driver
+// should return the number of fonts it supports.
+ if ( pDevObj->DevInfo.cFonts == -1)
+ {
+ if (pDevObj->DriverFunctions.QueryFont)
+ pDevObj->DevInfo.cFonts =
+ (ULONG)pDevObj->DriverFunctions.QueryFont(pDevObj->hPDev, 0, 0,
&Junk);
+ else
+ pDevObj->DevInfo.cFonts = 0;
+ }
+ return pDevObj->DevInfo.cFonts;
+}
+
+INT
+FASTCALL
+IntGetColorManagementCaps(PGDIDEVICE pDevObj)
+{
+ INT ret = CM_NONE;
+
+ if ( pDevObj->flFlags & PDEV_DISPLAY)
+ {
+ if ( pDevObj->DevInfo.iDitherFormat == BMF_8BPP ||
+ pDevObj->DevInfo.flGraphicsCaps2 & GCAPS2_CHANGEGAMMARAMP)
+ ret = CM_GAMMA_RAMP;
+ }
+ if (pDevObj->DevInfo.flGraphicsCaps & GCAPS_CMYKCOLOR)
+ ret |= CM_CMYK_COLOR;
+ if (pDevObj->DevInfo.flGraphicsCaps & GCAPS_ICM)
+ ret |= CM_DEVICE_ICM;
+ return ret;
+}
+
+VOID
+FASTCALL
+IntvGetDeviceCaps(
+ PGDIDEVICE pDevObj,
+ PDEVCAPS pDevCaps)
+{
+ ULONG Tmp = 0;
+ PGDIINFO pGdiInfo = &pDevObj->GDIInfo;
+
+ pDevCaps->ulVersion = pGdiInfo->ulVersion;
+ pDevCaps->ulTechnology = pGdiInfo->ulTechnology;
+ pDevCaps->ulHorzSizeM = (pGdiInfo->ulHorzSize + 500) / 0x3E8u;
+ pDevCaps->ulVertSizeM = (pGdiInfo->ulVertSize + 500) / 0x3E8u;
+ pDevCaps->ulHorzSize = pGdiInfo->ulHorzSize;
+ pDevCaps->ulVertSize = pGdiInfo->ulVertSize;
+ pDevCaps->ulHorzRes = pGdiInfo->ulHorzRes;
+ pDevCaps->ulVertRes = pGdiInfo->ulVertRes;
+ pDevCaps->ulVRefresh = pGdiInfo->ulVRefresh;
+ pDevCaps->ulDesktopHorzRes = pGdiInfo->ulHorzRes;
+ pDevCaps->ulDesktopVertRes = pGdiInfo->ulVertRes;
+ pDevCaps->ulBltAlignment = pGdiInfo->ulBltAlignment;
+ pDevCaps->ulPlanes = pGdiInfo->cPlanes;
+
+ pDevCaps->ulBitsPixel = pGdiInfo->cBitsPixel;
+ if (pGdiInfo->cBitsPixel == 15) pDevCaps->ulBitsPixel = 16;
+
+ Tmp = pGdiInfo->ulNumColors;
+ if ( Tmp != -1 ) Tmp *= 5;
+ pDevCaps->ulNumPens = Tmp;
+ pDevCaps->ulNumColors = pGdiInfo->ulNumColors;
+
+ pDevCaps->ulNumFonts = IntcFonts(pDevObj);
+
+ pDevCaps->ulRasterCaps = pGdiInfo->flRaster;
+ pDevCaps->ulShadeBlend = pGdiInfo->flShadeBlend;
+ pDevCaps->ulAspectX = pGdiInfo->ulAspectX;
+ pDevCaps->ulAspectY = pGdiInfo->ulAspectY;
+ pDevCaps->ulAspectXY = pGdiInfo->ulAspectXY;
+ pDevCaps->ulLogPixelsX = pGdiInfo->ulLogPixelsX;
+ pDevCaps->ulLogPixelsY = pGdiInfo->ulLogPixelsY;
+ pDevCaps->ulSizePalette = pGdiInfo->ulNumPalReg;
+ pDevCaps->ulColorRes = pGdiInfo->ulDACRed + pGdiInfo->ulDACGreen +
pGdiInfo->ulDACBlue;
+ pDevCaps->ulPhysicalWidth = pGdiInfo->szlPhysSize.cx;
+ pDevCaps->ulPhysicalHeight = pGdiInfo->szlPhysSize.cy;
+ pDevCaps->ulPhysicalOffsetX = pGdiInfo->ptlPhysOffset.x;
+ pDevCaps->ulPhysicalOffsetY = pGdiInfo->ptlPhysOffset.y;
+
+ Tmp = 0;
+ Tmp = pGdiInfo->flTextCaps |
(TC_SO_ABLE|TC_UA_ABLE|TC_CP_STROKE|TC_OP_STROKE|TC_OP_CHARACTER);
+
+ pDevCaps->ulTextCaps = pGdiInfo->flTextCaps |
(TC_SO_ABLE|TC_UA_ABLE|TC_CP_STROKE|TC_OP_STROKE|TC_OP_CHARACTER);
+
+ if (pGdiInfo->ulTechnology)
+ pDevCaps->ulTextCaps = Tmp | TC_VA_ABLE;
+
+ pDevCaps->ulColorMgmtCaps = IntGetColorManagementCaps(pDevObj);
+
+ return;
+}
+
+ /*
+ * @implemented
+ */
+BOOL
+APIENTRY
+NtGdiGetDeviceCapsAll (
+ IN HDC hDC,
+ OUT PDEVCAPS pDevCaps)
+{
+ PDC dc;
+ PDEVCAPS pSafeDevCaps;
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ dc = DC_LockDc(hDC);
+ if (dc == NULL)
+ {
+ SetLastWin32Error(ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
+ pSafeDevCaps = ExAllocatePoolWithTag(PagedPool, sizeof(DEVCAPS), TAG_DC);
+
+ if (!pSafeDevCaps)
+ {
+ DC_UnlockDc(dc);
+ return FALSE;
+ }
+
+ IntvGetDeviceCaps(dc->pPDev, pSafeDevCaps);
+
+ _SEH_TRY
+ {
+ ProbeForWrite(pDevCaps,
+ sizeof(DEVCAPS),
+ 1);
+ RtlCopyMemory(pDevCaps, pSafeDevCaps, sizeof(DEVCAPS));
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+
+ if(!NT_SUCCESS(Status))
+ {
+ SetLastNtError(Status);
+ ExFreePoolWithTag(pSafeDevCaps, TAG_DC);
+ DC_UnlockDc(dc);
+ return FALSE;
+ }
+
+ ExFreePoolWithTag(pSafeDevCaps, TAG_DC);
+ DC_UnlockDc( dc );
+ return TRUE;
+}
+
+
+
BOOL
APIENTRY
NtGdiResetDC(
Modified: trunk/reactos/subsystems/win32/win32k/stubs/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/st…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/stubs/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/stubs/stubs.c [iso-8859-1] Sat Oct 18 23:47:04
2008
@@ -1972,19 +1972,6 @@
*/
BOOL
APIENTRY
-NtGdiGetDeviceCapsAll (
- IN HDC hdc,
- OUT PDEVCAPS pDevCaps)
-{
- UNIMPLEMENTED;
- return FALSE;
-}
-
- /*
- * @unimplemented
- */
-BOOL
-APIENTRY
NtGdiGetETM(
IN HDC hdc,
OUT EXTTEXTMETRIC *petm)