Author: jimtabor
Date: Fri Apr 2 13:53:14 2010
New Revision: 46679
URL:
http://svn.reactos.org/svn/reactos?rev=46679&view=rev
Log:
[Win32k]
- Implement MakeInfoDC and support functions. Dedicated to Timo.
Modified:
trunk/reactos/subsystems/win32/win32k/include/dc.h
trunk/reactos/subsystems/win32/win32k/include/pdevobj.h
trunk/reactos/subsystems/win32/win32k/include/surface.h
trunk/reactos/subsystems/win32/win32k/objects/dclife.c
trunk/reactos/subsystems/win32/win32k/objects/dcutil.c
trunk/reactos/subsystems/win32/win32k/objects/device.c
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] Fri Apr 2 13:53:14
2010
@@ -177,6 +177,8 @@
BOOL FASTCALL IntGdiCleanDC(HDC hDC);
VOID FASTCALL IntvGetDeviceCaps(PPDEVOBJ, PDEVCAPS);
INT FASTCALL IntGdiGetDeviceCaps(PDC,INT);
+BOOL FASTCALL MakeInfoDC(PDC,BOOL);
+BOOL FASTCALL IntSetDefaultRegion(PDC);
extern PPDEVOBJ pPrimarySurface;
@@ -228,6 +230,5 @@
pdc->dclevel.ppal = ppal;
}
-BOOL FASTCALL
-IntPrepareDriverIfNeeded(VOID);
+BOOL FASTCALL IntPrepareDriverIfNeeded(VOID);
extern PDEVOBJ PrimarySurface;
Modified: trunk/reactos/subsystems/win32/win32k/include/pdevobj.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/pdevobj.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/pdevobj.h [iso-8859-1] Fri Apr 2
13:53:14 2010
@@ -88,8 +88,8 @@
// PVOID TypeOneInfo;
PVOID pvGammaRamp; /* Gamma ramp pointer. */
// PVOID RemoteTypeOne;
-// ULONG ulHorzRes;
-// ULONG ulVertRes;
+ ULONG ulHorzRes;
+ ULONG ulVertRes;
// PFN_DrvSetPointerShape pfnDrvSetPointerShape;
// PFN_DrvMovePointer pfnDrvMovePointer;
PFN_DrvMovePointer pfnMovePointer;
@@ -107,7 +107,7 @@
// HANDLE hSpooler; /* Handle to spooler, if spooler dev
driver. */
// PVOID pDesktopId;
PGRAPHICS_DEVICE pGraphicsDevice;
-// POINTL ptlOrigion;
+ POINTL ptlOrigion;
PVOID pdmwDev; /* Ptr->DEVMODEW.dmSize + dmDriverExtra
== alloc size. */
// DWORD Unknown3;
FLONG DxDd_Flags; /* DxDD active status flags. */
@@ -141,4 +141,6 @@
EDD_DIRECTDRAW_GLOBAL EDDgpl;
} PDEVEDD, *PPDEVEDD;
+PSIZEL FASTCALL PDEV_sizl(PPDEVOBJ, PSIZEL);
+
extern ULONG gdwDirectDrawContext;
Modified: trunk/reactos/subsystems/win32/win32k/include/surface.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/surface.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/surface.h [iso-8859-1] Fri Apr 2
13:53:14 2010
@@ -2,6 +2,8 @@
#include "win32.h"
#include "gdiobj.h"
+
+#define PDEV_SURFACE 0x80000000
/* GDI surface object */
typedef struct _SURFACE
Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Fri Apr 2
13:53:14 2010
@@ -586,8 +586,59 @@
NtGdiSetVirtualResolution(DCHandle, 0, 0, 0, 0);
}
+BOOL
+FASTCALL
+MakeInfoDC(PDC pdc, BOOL bSet)
+{
+ PSURFACE pSurface;
+ SIZEL sizl;
+
+ /* Can not be a display DC. */
+ if (pdc->fs & DC_FLAG_DISPLAY) return FALSE;
+ if (bSet)
+ {
+ if (pdc->fs & DC_FLAG_TEMPINFODC || pdc->dctype == DC_TYPE_DIRECT)
+ return FALSE;
+
+ pSurface = pdc->dclevel.pSurface;
+ pdc->fs |= DC_FLAG_TEMPINFODC;
+ pdc->pSurfInfo = pSurface;
+ pdc->dctype = DC_TYPE_INFO;
+ pdc->dclevel.pSurface = NULL;
+
+ if (PDEV_sizl(pdc->ppdev, &sizl)->cx == pdc->dclevel.sizl.cx
&&
+ PDEV_sizl(pdc->ppdev, &sizl)->cy == pdc->dclevel.sizl.cy)
+ return TRUE;
+
+ pdc->dclevel.sizl.cx = PDEV_sizl(pdc->ppdev, &sizl)->cx;
+ pdc->dclevel.sizl.cy = sizl.cy;
+ IntSetDefaultRegion(pdc);
+ }
+ else
+ {
+ if (!(pdc->fs & DC_FLAG_TEMPINFODC) || pdc->dctype != DC_TYPE_INFO)
+ return FALSE;
+
+ pSurface = pdc->pSurfInfo;
+ pdc->fs &= ~DC_FLAG_TEMPINFODC;
+ pdc->dclevel.pSurface = pSurface;
+ pdc->dctype = DC_TYPE_DIRECT;
+ pdc->pSurfInfo = NULL;
+
+ if ( !pSurface ||
+ (pSurface->SurfObj.sizlBitmap.cx == pdc->dclevel.sizl.cx &&
+ pSurface->SurfObj.sizlBitmap.cy == pdc->dclevel.sizl.cy) )
+ return TRUE;
+
+ pdc->dclevel.sizl.cx = pSurface->SurfObj.sizlBitmap.cx;
+ pdc->dclevel.sizl.cy = pSurface->SurfObj.sizlBitmap.cy;
+ IntSetDefaultRegion(pdc);
+ }
+ return TRUE;
+}
+
/*
-* @unimplemented
+* @implemented
*/
BOOL
APIENTRY
@@ -595,7 +646,14 @@
IN HDC hdc,
IN BOOL bSet)
{
- UNIMPLEMENTED;
+ BOOL Ret;
+ PDC pdc = DC_LockDc(hdc);
+ if (pdc)
+ {
+ Ret = MakeInfoDC(pdc, bSet);
+ DC_UnlockDc(pdc);
+ return Ret;
+ }
return FALSE;
}
Modified: trunk/reactos/subsystems/win32/win32k/objects/dcutil.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] Fri Apr 2
13:53:14 2010
@@ -124,6 +124,71 @@
return SurfObj->hsurf == PrimarySurface.pSurface; // <- FIXME: WTF?
}
#endif
+
+BOOL
+FASTCALL
+IntSetDefaultRegion(PDC pdc)
+{
+ PSURFACE pSurface;
+ PROSRGNDATA prgn;
+ RECTL rclWnd, rclClip;
+
+ IntGdiReleaseRaoRgn(pdc);
+
+ rclWnd.left = 0;
+ rclWnd.top = 0;
+ rclWnd.right = pdc->dclevel.sizl.cx;
+ rclWnd.bottom = pdc->dclevel.sizl.cy;
+ rclClip = rclWnd;
+
+// EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
+ if (pdc->ppdev->flFlags & PDEV_META_DEVICE)
+ {
+ pSurface = pdc->dclevel.pSurface;
+ if (pSurface && pSurface->flFlags & PDEV_SURFACE)
+ {
+ rclClip.left += pdc->ppdev->ptlOrigion.x;
+ rclClip.top += pdc->ppdev->ptlOrigion.y;
+ rclClip.right += pdc->ppdev->ptlOrigion.x;
+ rclClip.bottom += pdc->ppdev->ptlOrigion.y;
+ }
+ }
+// EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
+
+ prgn = pdc->prgnVis;
+
+ if (prgn && prgn != prgnDefault)
+ {
+ REGION_SetRectRgn( prgn,
+ rclClip.left,
+ rclClip.top,
+ rclClip.right ,
+ rclClip.bottom );
+ }
+ else
+ {
+ prgn = IntSysCreateRectpRgn( rclClip.left,
+ rclClip.top,
+ rclClip.right ,
+ rclClip.bottom );
+ pdc->prgnVis = prgn;
+ }
+
+ if (prgn)
+ {
+ pdc->ptlDCOrig.x = 0;
+ pdc->ptlDCOrig.y = 0;
+ pdc->erclWindow = rclWnd;
+ pdc->erclClip = rclClip;
+ /* Might be an InitDC or DCE....*/
+ pdc->ptlFillOrigin.x = pdc->dcattr.VisRectRegion.Rect.right;
+ pdc->ptlFillOrigin.y = pdc->dcattr.VisRectRegion.Rect.bottom;
+ return TRUE;
+ }
+
+ pdc->prgnVis = prgnDefault;
+ return FALSE;
+}
BOOL APIENTRY
Modified: trunk/reactos/subsystems/win32/win32k/objects/device.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/device.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/device.c [iso-8859-1] Fri Apr 2
13:53:14 2010
@@ -19,6 +19,22 @@
static KEVENT VideoDriverPrepared;
PDC defaultDCstate = NULL;
+PSIZEL
+FASTCALL
+PDEV_sizl(PPDEVOBJ ppdev, PSIZEL psizl)
+{
+ if (ppdev->flFlags & PDEV_META_DEVICE)
+ {
+ psizl->cx = ppdev->ulHorzRes;
+ psizl->cy = ppdev->ulVertRes;
+ }
+ else
+ {
+ psizl->cx = ppdev->gdiinfo.ulHorzRes;
+ psizl->cy = ppdev->gdiinfo.ulVertRes;
+ }
+ return psizl;
+}
NTSTATUS FASTCALL
InitDcImpl(VOID)