Author: tkreuzer
Date: Tue Sep 23 19:32:38 2014
New Revision: 64247
URL:
http://svn.reactos.org/svn/reactos?rev=64247&view=rev
Log:
[WIN32K]
- Improve GetClipBox (we have a RAO region, make use of that, no need to check for Clip or
Meta region and combine them with the vis region) and fix coordinates (result must be in
logical coordinate space!)
Modified:
trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c
trunk/reactos/win32ss/gdi/ntgdi/cliprgn.h
Modified: trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/cliprgn.…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c [iso-8859-1] Tue Sep 23 19:32:38 2014
@@ -117,91 +117,77 @@
return retval;
}
-INT FASTCALL
-GdiGetClipBox(HDC hDC, PRECTL rc)
-{
- INT retval;
- PDC dc;
- PROSRGNDATA pRgnNew, pRgn = NULL;
-
- if (!(dc = DC_LockDc(hDC)))
- {
- return ERROR;
- }
-
- if (dc->fs & DC_FLAG_DIRTY_RAO)
- CLIPPING_UpdateGCRegion(dc);
-
- /* FIXME: Rao and Vis only! */
- if (dc->prgnAPI) // APIRGN
- {
- pRgn = dc->prgnAPI;
- }
- else if (dc->dclevel.prgnMeta) // METARGN
- {
- pRgn = dc->dclevel.prgnMeta;
- }
- else if (dc->dclevel.prgnClip) // CLIPRGN
- {
- pRgn = dc->dclevel.prgnClip;
- }
-
- if (pRgn)
- {
- pRgnNew = IntSysCreateRectpRgn( 0, 0, 0, 0 );
-
- if (!pRgnNew)
- {
- DC_UnlockDc(dc);
- return ERROR;
- }
-
- IntGdiCombineRgn(pRgnNew, dc->prgnVis, pRgn, RGN_AND);
-
- retval = REGION_GetRgnBox(pRgnNew, rc);
-
- REGION_Delete(pRgnNew);
-
- DC_UnlockDc(dc);
- return retval;
- }
-
- retval = REGION_GetRgnBox(dc->prgnVis, rc);
-
- DC_UnlockDc(dc);
-
- return retval;
-}
-
-INT APIENTRY
-NtGdiGetAppClipBox(HDC hDC, PRECTL rc)
-{
- INT Ret;
- NTSTATUS Status = STATUS_SUCCESS;
- RECTL Saferect;
-
- Ret = GdiGetClipBox(hDC, &Saferect);
-
- _SEH2_TRY
- {
- ProbeForWrite(rc,
- sizeof(RECT),
- 1);
- *rc = Saferect;
- }
- _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
- Status = _SEH2_GetExceptionCode();
- }
- _SEH2_END;
-
- if(!NT_SUCCESS(Status))
- {
- SetLastNtError(Status);
- return ERROR;
- }
-
- return Ret;
+INT
+FASTCALL
+GdiGetClipBox(
+ _In_ HDC hdc,
+ _Out_ LPRECT prc)
+{
+ PDC pdc;
+ INT iComplexity;
+
+ /* Lock the DC */
+ pdc = DC_LockDc(hdc);
+ if (!pdc)
+ {
+ return ERROR;
+ }
+
+ /* Update RAO region if necessary */
+ if (pdc->fs & DC_FLAG_DIRTY_RAO)
+ CLIPPING_UpdateGCRegion(pdc);
+
+ /* Check if we have a RAO region (intersection of API and VIS region) */
+ if (pdc->prgnRao)
+ {
+ /* We have a RAO region, use it */
+ iComplexity = REGION_GetRgnBox(pdc->prgnRao, prc);
+ }
+ else
+ {
+ /* No RAO region means no API region, so use the VIS region */
+ ASSERT(pdc->prgnVis);
+ iComplexity = REGION_GetRgnBox(pdc->prgnVis, prc);
+ }
+
+ /* Unlock the DC */
+ DC_UnlockDc(pdc);
+
+ /* Convert the rect to logical coordinates */
+ IntDPtoLP(pdc, (LPPOINT)prc, 2);
+
+ /* Return the complexity */
+ return iComplexity;
+}
+
+INT
+APIENTRY
+NtGdiGetAppClipBox(
+ _In_ HDC hdc,
+ _Out_ LPRECT prc)
+{
+ RECT rect;
+ INT iComplexity;
+
+ /* Call the internal function */
+ iComplexity = GdiGetClipBox(hdc, &rect);
+
+ if (iComplexity != ERROR)
+ {
+ _SEH2_TRY
+ {
+ ProbeForWrite(prc, sizeof(RECT), 1);
+ *prc = rect;
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ iComplexity = ERROR;
+ }
+ _SEH2_END
+ }
+
+ /* Return the complexity */
+ return iComplexity;
}
int APIENTRY NtGdiExcludeClipRect(HDC hDC,
Modified: trunk/reactos/win32ss/gdi/ntgdi/cliprgn.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/cliprgn.…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/cliprgn.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/cliprgn.h [iso-8859-1] Tue Sep 23 19:32:38 2014
@@ -1,6 +1,11 @@
#pragma once
-INT FASTCALL GdiGetClipBox(HDC hDC, RECTL *rc);
+INT
+FASTCALL
+GdiGetClipBox(
+ _In_ HDC hdc,
+ _Out_ LPRECT prc);
+
VOID FASTCALL GdiSelectVisRgn(HDC hdc, PREGION prgn);
INT FASTCALL IntGdiExtSelectClipRgn (PDC dc, PREGION prgn, int fnMode);
VOID FASTCALL CLIPPING_UpdateGCRegion(DC* Dc);