mirror of
https://github.com/reactos/reactos.git
synced 2025-05-28 13:38:19 +00:00
- 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 svn path=/trunk/; revision=56486
This commit is contained in:
parent
a97d8f8aee
commit
4fbb6addbc
6 changed files with 70 additions and 68 deletions
|
@ -484,60 +484,5 @@ NtGdiCreateSolidBrush(COLORREF Color,
|
|||
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 */
|
||||
|
|
|
@ -1205,17 +1205,6 @@ NtGdiSetVirtualResolution(
|
|||
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)
|
||||
|
|
|
@ -159,4 +159,4 @@ GreModifyWorldTransform(
|
|||
VOID FASTCALL IntMirrorWindowOrg(PDC);
|
||||
void FASTCALL IntFixIsotropicMapping(PDC);
|
||||
LONG FASTCALL IntCalcFillOrigin(PDC);
|
||||
PPOINTL FASTCALL IntptlBrushOrigin(PDC pdc,LONG,LONG);
|
||||
|
||||
|
|
|
@ -189,6 +189,9 @@ VOID FASTCALL IntvGetDeviceCaps(PPDEVOBJ, PDEVCAPS);
|
|||
BOOL FASTCALL IntSetDefaultRegion(PDC);
|
||||
BOOL NTAPI GreSetDCOwner(HDC hdc, ULONG ulOwner);
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
DC_vSetBrushOrigin(PDC pdc, LONG x, LONG y);
|
||||
|
||||
FORCEINLINE
|
||||
PDC
|
||||
|
|
|
@ -138,6 +138,71 @@ DC_vUpdateBackgroundBrush(PDC pdc)
|
|||
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
|
||||
NTAPI
|
||||
GdiSelectPalette(
|
||||
|
|
|
@ -109,7 +109,7 @@ GdiFlushUserBatch(PDC dc, PGDIBATCHHDR pHdr)
|
|||
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:
|
||||
|
|
Loading…
Reference in a new issue