Author: tkreuzer
Date: Thu May 3 18:55:38 2012
New Revision: 56486
URL:
http://svn.reactos.org/svn/reactos?rev=56486&view=rev
Log:
- Move NtGdiSetBrushOrg from brush.c to dcobjs.c, since it doesn't really deal with
brushes, but with the dc and is related to the brush seletcted into the dc. Cleanup,
simplify and fix the function.
- rename IntptlBrushOrigin to DC_vSetBrushOrigin and also move it to dcobjs.c
Modified:
trunk/reactos/win32ss/gdi/ntgdi/brush.c
trunk/reactos/win32ss/gdi/ntgdi/coord.c
trunk/reactos/win32ss/gdi/ntgdi/coord.h
trunk/reactos/win32ss/gdi/ntgdi/dc.h
trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c
trunk/reactos/win32ss/gdi/ntgdi/gdibatch.c
Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.c?…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/brush.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/brush.c [iso-8859-1] Thu May 3 18:55:38 2012
@@ -484,60 +484,5 @@
return IntGdiCreateSolidBrush(Color);
}
-/**
- * \name NtGdiSetBrushOrg
- *
- * \brief Sets the brush origin that GDI assigns to
- * the next brush an application selects into the specified device context.
- *
- * @implemented
- */
-BOOL
-APIENTRY
-NtGdiSetBrushOrg(HDC hDC, INT XOrg, INT YOrg, LPPOINT Point)
-{
- PDC dc;
- PDC_ATTR pdcattr;
-
- dc = DC_LockDc(hDC);
- if (dc == NULL)
- {
- EngSetLastError(ERROR_INVALID_HANDLE);
- return FALSE;
- }
- pdcattr = dc->pdcattr;
-
- if (Point != NULL)
- {
- NTSTATUS Status = STATUS_SUCCESS;
- POINT SafePoint;
- SafePoint.x = pdcattr->ptlBrushOrigin.x;
- SafePoint.y = pdcattr->ptlBrushOrigin.y;
- _SEH2_TRY
- {
- ProbeForWrite(Point, sizeof(POINT), 1);
- *Point = SafePoint;
- }
- _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
- Status = _SEH2_GetExceptionCode();
- }
- _SEH2_END;
-
- if (!NT_SUCCESS(Status))
- {
- DC_UnlockDc(dc);
- SetLastNtError(Status);
- return FALSE;
- }
- }
-
- pdcattr->ptlBrushOrigin.x = XOrg;
- pdcattr->ptlBrushOrigin.y = YOrg;
- IntptlBrushOrigin(dc, XOrg, YOrg );
- DC_UnlockDc(dc);
-
- return TRUE;
-}
/* EOF */
Modified: trunk/reactos/win32ss/gdi/ntgdi/coord.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/coord.c?…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/coord.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/coord.c [iso-8859-1] Thu May 3 18:55:38 2012
@@ -1205,17 +1205,6 @@
return TRUE;
}
-PPOINTL
-FASTCALL
-IntptlBrushOrigin(PDC pdc, LONG x, LONG y )
-{
- pdc->dclevel.ptlBrushOrigin.x = x;
- pdc->dclevel.ptlBrushOrigin.y = y;
- pdc->ptlFillOrigin.x = pdc->dclevel.ptlBrushOrigin.x + pdc->ptlDCOrig.x;
- pdc->ptlFillOrigin.y = pdc->dclevel.ptlBrushOrigin.y + pdc->ptlDCOrig.y;
- return &pdc->dclevel.ptlBrushOrigin;
-}
-
static
VOID FASTCALL
DC_vGetAspectRatioFilter(PDC pDC, LPSIZE AspectRatio)
Modified: trunk/reactos/win32ss/gdi/ntgdi/coord.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/coord.h?…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/coord.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/coord.h [iso-8859-1] Thu May 3 18:55:38 2012
@@ -159,4 +159,4 @@
VOID FASTCALL IntMirrorWindowOrg(PDC);
void FASTCALL IntFixIsotropicMapping(PDC);
LONG FASTCALL IntCalcFillOrigin(PDC);
-PPOINTL FASTCALL IntptlBrushOrigin(PDC pdc,LONG,LONG);
+
Modified: trunk/reactos/win32ss/gdi/ntgdi/dc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dc.h?rev…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dc.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dc.h [iso-8859-1] Thu May 3 18:55:38 2012
@@ -189,6 +189,9 @@
BOOL FASTCALL IntSetDefaultRegion(PDC);
BOOL NTAPI GreSetDCOwner(HDC hdc, ULONG ulOwner);
+VOID
+NTAPI
+DC_vSetBrushOrigin(PDC pdc, LONG x, LONG y);
FORCEINLINE
PDC
Modified: trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c [iso-8859-1] Thu May 3 18:55:38 2012
@@ -136,6 +136,71 @@
/* Clear flag */
pdcattr->ulDirty_ &= ~DIRTY_BACKGROUND;
+}
+
+VOID
+NTAPI
+DC_vSetBrushOrigin(PDC pdc, LONG x, LONG y)
+{
+ /* Set the brush origin */
+ pdc->dclevel.ptlBrushOrigin.x = x;
+ pdc->dclevel.ptlBrushOrigin.y = y;
+
+ /* Set the fill origin */
+ pdc->ptlFillOrigin.x = x + pdc->ptlDCOrig.x;
+ pdc->ptlFillOrigin.y = y + pdc->ptlDCOrig.y;
+}
+
+/**
+ * \name NtGdiSetBrushOrg
+ *
+ * \brief Sets the brush origin that GDI uses when drawing with pattern
+ * brushes. The brush origin is relative to the DC origin.
+ *
+ * @implemented
+ */
+BOOL
+APIENTRY
+NtGdiSetBrushOrg(
+ _In_ HDC hdc,
+ _In_ INT x,
+ _In_ INT y,
+ _Out_opt_ LPPOINT pptOut)
+{
+ PDC pdc;
+
+ /* Lock the DC */
+ pdc = DC_LockDc(hdc);
+ if (pdc == NULL)
+ {
+ EngSetLastError(ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
+ /* Check if the old origin was requested */
+ if (pptOut != NULL)
+ {
+ /* Enter SEH for buffer transfer */
+ _SEH2_TRY
+ {
+ /* Probe and copy the old origin */
+ ProbeForWrite(pptOut, sizeof(POINT), 1);
+ *pptOut = pdc->pdcattr->ptlBrushOrigin;
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ DC_UnlockDc(pdc);
+ _SEH2_YIELD(return FALSE);
+ }
+ _SEH2_END;
+ }
+
+ /* Call the internal function */
+ DC_vSetBrushOrigin(pdc, x, y);
+
+ /* Unlock the DC and return success */
+ DC_UnlockDc(pdc);
+ return TRUE;
}
HPALETTE
Modified: trunk/reactos/win32ss/gdi/ntgdi/gdibatch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdibatch…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/gdibatch.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/gdibatch.c [iso-8859-1] Thu May 3 18:55:38 2012
@@ -109,7 +109,7 @@
if (!dc) break;
pgSBO = (PGDIBSSETBRHORG) pHdr;
pdcattr->ptlBrushOrigin = pgSBO->ptlBrushOrigin;
- IntptlBrushOrigin(dc, pgSBO->ptlBrushOrigin.x, pgSBO->ptlBrushOrigin.y);
+ DC_vSetBrushOrigin(dc, pgSBO->ptlBrushOrigin.x, pgSBO->ptlBrushOrigin.y);
break;
}
case GdiBCExtSelClipRgn: