ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
December 2014
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
387 discussions
Start a n
N
ew thread
[tkreuzer] 65733: [WIN32K] - Make REGION_iOffsetRgn check the region for coordinate space overflow and fail, if the region cannot be moved - Rename REGION_iOffsetRgn to REGION_bOffsetRgn and make i...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Dec 18 08:12:41 2014 New Revision: 65733 URL:
http://svn.reactos.org/svn/reactos?rev=65733&view=rev
Log: [WIN32K] - Make REGION_iOffsetRgn check the region for coordinate space overflow and fail, if the region cannot be moved - Rename REGION_iOffsetRgn to REGION_bOffsetRgn and make it return BOOL instead of the complexity, since the majority of callers are not interested in the complexity. It's also more obvious that we need to check for an error. Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c trunk/reactos/win32ss/gdi/ntgdi/coord.h trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c trunk/reactos/win32ss/gdi/ntgdi/region.c trunk/reactos/win32ss/gdi/ntgdi/region.h trunk/reactos/win32ss/user/ntuser/painting.c trunk/reactos/win32ss/user/ntuser/vis.c trunk/reactos/win32ss/user/ntuser/windc.c trunk/reactos/win32ss/user/ntuser/winpos.c Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Thu Dec 18 08:12:41 2014 @@ -1053,7 +1053,7 @@ /* Transform region into device coordinates */ if (!REGION_LPTODP(pdc, prgnClip, prgn) || - REGION_iOffsetRgn(prgnClip, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y) == ERROR) + !REGION_bOffsetRgn(prgnClip, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y)) { REGION_Delete(prgnClip); return FALSE; 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] Thu Dec 18 08:12:41 2014 @@ -57,7 +57,7 @@ ASSERT(prgn != NULL); IntGdiCombineRgn(dc->prgnVis, prgn, NULL, RGN_COPY); - REGION_iOffsetRgn(dc->prgnVis, -dc->ptlDCOrig.x, -dc->ptlDCOrig.y); + REGION_bOffsetRgn(dc->prgnVis, -dc->ptlDCOrig.x, -dc->ptlDCOrig.y); DC_UnlockDc(dc); } @@ -365,9 +365,17 @@ if(dc->dclevel.prgnClip != NULL) { - Result = REGION_iOffsetRgn(dc->dclevel.prgnClip, - XOffset, - YOffset); + if (!REGION_bOffsetRgn(dc->dclevel.prgnClip, + XOffset, + YOffset)) + { + Result = ERROR; + } + else + { + Result = REGION_Complexity(dc->dclevel.prgnClip); + } + dc->fs |= DC_FLAG_DIRTY_RAO; } else @@ -572,7 +580,7 @@ } - REGION_iOffsetRgn(pDC->prgnRao, pDC->ptlDCOrig.x, pDC->ptlDCOrig.y); + REGION_bOffsetRgn(pDC->prgnRao, pDC->ptlDCOrig.x, pDC->ptlDCOrig.y); RtlCopyMemory(&pDC->erclClip, &pDC->prgnRao->rdh.rcBound, @@ -590,7 +598,7 @@ pDC->prgnRao->Buffer, &pDC->erclClip); - REGION_iOffsetRgn(pDC->prgnRao, -pDC->ptlDCOrig.x, -pDC->ptlDCOrig.y); + REGION_bOffsetRgn(pDC->prgnRao, -pDC->ptlDCOrig.x, -pDC->ptlDCOrig.y); } /* EOF */ 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 Dec 18 08:12:41 2014 @@ -1,4 +1,8 @@ #pragma once + +/* Maximum extend of coordinate space */ +#define MIN_COORD (INT_MIN / 16) +#define MAX_COORD (INT_MAX / 16) #define IntLPtoDP(pdc, ppt, count) DC_vXformWorldToDevice(pdc, count, (PPOINTL)(ppt), (PPOINTL)(ppt)); #define CoordLPtoDP(pdc, ppt) DC_vXformWorldToDevice(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt)); 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 Dec 18 08:12:41 2014 @@ -779,7 +779,10 @@ { ret = IntGdiCombineRgn(prgnDest, prgnSrc, 0, RGN_COPY) == ERROR ? -1 : 1; if ((ret == 1) && (iCode == SYSRGN)) - REGION_iOffsetRgn(prgnDest, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y); + { + /// \todo FIXME This is not really correct, since we already modified the region + ret = REGION_bOffsetRgn(prgnDest, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y); + } REGION_UnlockRgn(prgnDest); } else Modified: trunk/reactos/win32ss/gdi/ntgdi/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] Thu Dec 18 08:12:41 2014 @@ -514,7 +514,7 @@ PREGION dst, PREGION src) { - /* Only copy if source and dest are equal */ + /* Only copy if source and dest are not equal */ if (dst != src) { /* Check if we need to increase our buffer */ @@ -1867,31 +1867,31 @@ else { /* Move the source region to the bottom-right */ - REGION_iOffsetRgn(prgnSrc, cx, cy); + REGION_bOffsetRgn(prgnSrc, cx, cy); /* Intersect with the source region (this crops the top-left frame) */ REGION_IntersectRegion(prgnDest, prgnDest, prgnSrc); /* Move the source region to the bottom-left */ - REGION_iOffsetRgn(prgnSrc, -2 * cx, 0); + REGION_bOffsetRgn(prgnSrc, -2 * cx, 0); /* Intersect with the source region (this crops the top-right frame) */ REGION_IntersectRegion(prgnDest, prgnDest, prgnSrc); /* Move the source region to the top-left */ - REGION_iOffsetRgn(prgnSrc, 0, -2 * cy); + REGION_bOffsetRgn(prgnSrc, 0, -2 * cy); /* Intersect with the source region (this crops the bottom-right frame) */ REGION_IntersectRegion(prgnDest, prgnDest, prgnSrc); /* Move the source region to the top-right */ - REGION_iOffsetRgn(prgnSrc, 2 * cx, 0); + REGION_bOffsetRgn(prgnSrc, 2 * cx, 0); /* Intersect with the source region (this crops the bottom-left frame) */ REGION_IntersectRegion(prgnDest, prgnDest, prgnSrc); /* Move the source region back to the original position */ - REGION_iOffsetRgn(prgnSrc, -cx, cy); + REGION_bOffsetRgn(prgnSrc, -cx, cy); /* Finally subtract the cropped region from the source */ REGION_SubtractRegion(prgnDest, prgnSrc, prgnDest); @@ -1961,7 +1961,7 @@ if (pmx->flAccel & XFORM_UNITY) { /* Just offset the region */ - return REGION_iOffsetRgn(prgn, (pmx->fxDx + 8) / 16, (pmx->fxDy + 8) / 16) != ERROR; + return REGION_bOffsetRgn(prgn, (pmx->fxDx + 8) / 16, (pmx->fxDy + 8) / 16); } else { @@ -2584,40 +2584,93 @@ } } -INT -FASTCALL -REGION_iOffsetRgn( - PREGION rgn, - INT XOffset, - INT YOffset) -{ - if (XOffset || YOffset) - { - int nbox = rgn->rdh.nCount; - PRECTL pbox = rgn->Buffer; - - if (nbox && pbox) - { - while (nbox--) - { - pbox->left += XOffset; - pbox->right += XOffset; - pbox->top += YOffset; - pbox->bottom += YOffset; - pbox++; - } - - if (rgn->Buffer != &rgn->rdh.rcBound) - { - rgn->rdh.rcBound.left += XOffset; - rgn->rdh.rcBound.right += XOffset; - rgn->rdh.rcBound.top += YOffset; - rgn->rdh.rcBound.bottom += YOffset; - } - } - } - - return REGION_Complexity(rgn); +BOOL +FASTCALL +REGION_bOffsetRgn( + _Inout_ PREGION prgn, + _In_ INT cx, + _In_ INT cy) +{ + PRECTL prcl; + UINT i; + + NT_ASSERT(prgn != NULL); + + /* Check for trivial case */ + if ((cx == 0) && (cy == 0)) + { + return TRUE; + } + + /* Check for empty regions, we ignore the offset values here */ + if (prgn->rdh.nCount == 0) + { + return TRUE; + } + + /* Make sure the offset is within the legal range */ + if ((cx > MAX_COORD) || (cx < MIN_COORD) || + (cy > MAX_COORD) || (cy < MIN_COORD)) + { + return FALSE; + } + + /* Are we moving right? */ + if (cx > 0) + { + /* Check if we stay inside the bounds on the right side */ + if (prgn->rdh.rcBound.right > (MAX_COORD - cx)) + { + return FALSE; + } + } + else + { + /* Check if we stay inside the bounds on the left side */ + if (prgn->rdh.rcBound.left < (MIN_COORD - cx)) + { + return FALSE; + } + } + + /* Are we moving down? */ + if (cy > 0) + { + /* Check if we stay inside the bounds on the right side */ + if (prgn->rdh.rcBound.bottom > (MAX_COORD - cy)) + { + return FALSE; + } + } + else + { + /* Check if we stay inside the bounds on the left side */ + if (prgn->rdh.rcBound.top < (MIN_COORD - cy)) + { + return FALSE; + } + } + + /* Loop to move the rects */ + prcl = prgn->Buffer; + for (i = 0; i < prgn->rdh.nCount; i++) + { + prcl[i].left += cx; + prcl[i].right += cx; + prcl[i].top += cy; + prcl[i].bottom += cy; + } + + /* Finally update the bounds rect */ + if (prgn->Buffer != &prgn->rdh.rcBound) + { + prgn->rdh.rcBound.left += cx; + prgn->rdh.rcBound.right += cx; + prgn->rdh.rcBound.top += cy; + prgn->rdh.rcBound.bottom += cy; + } + + return TRUE; } /*********************************************************************** @@ -3786,7 +3839,14 @@ return ERROR; } - ret = REGION_iOffsetRgn(rgn, XOffset, YOffset); + if (!REGION_bOffsetRgn(rgn, XOffset, YOffset)) + { + ret = ERROR; + } + else + { + ret = REGION_Complexity(rgn); + } RGNOBJAPI_Unlock(rgn); return ret; Modified: trunk/reactos/win32ss/gdi/ntgdi/region.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.h…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] Thu Dec 18 08:12:41 2014 @@ -62,7 +62,13 @@ _In_ ULONG cPolygons, _In_ INT iMode); -INT FASTCALL REGION_iOffsetRgn(PREGION,INT,INT); +BOOL +FASTCALL +REGION_bOffsetRgn( + _Inout_ PREGION prgn, + _In_ INT cx, + _In_ INT cy); + BOOL FASTCALL IntRectInRegion(HRGN,LPRECTL); INT FASTCALL IntGdiCombineRgn(PREGION, PREGION, PREGION, INT); Modified: trunk/reactos/win32ss/user/ntuser/painting.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/painti…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/painting.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/painting.c [iso-8859-1] Thu Dec 18 08:12:41 2014 @@ -460,11 +460,11 @@ PREGION RgnClip = RGNOBJAPI_Lock(Wnd->hrgnClip, NULL); if (RgnClip) { - REGION_iOffsetRgn(Rgn, + REGION_bOffsetRgn(Rgn, -Wnd->rcWindow.left, -Wnd->rcWindow.top); RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnClip, RGN_AND); - REGION_iOffsetRgn(Rgn, + REGION_bOffsetRgn(Rgn, Wnd->rcWindow.left, Wnd->rcWindow.top); RGNOBJAPI_Unlock(RgnClip); @@ -682,7 +682,7 @@ } else { - REGION_iOffsetRgn(TmpRgn, Window->rcClient.left, Window->rcClient.top); + REGION_bOffsetRgn(TmpRgn, Window->rcClient.left, Window->rcClient.top); } } else if (UpdateRect != NULL) @@ -690,7 +690,7 @@ if (!RECTL_bIsEmptyRect(UpdateRect)) { TmpRgn = IntSysCreateRectpRgnIndirect(UpdateRect); - REGION_iOffsetRgn(TmpRgn, Window->rcClient.left, Window->rcClient.top); + REGION_bOffsetRgn(TmpRgn, Window->rcClient.left, Window->rcClient.top); } } else if ((Flags & (RDW_INVALIDATE | RDW_FRAME)) == (RDW_INVALIDATE | RDW_FRAME) || @@ -1229,7 +1229,7 @@ IntIntersectWithParents(Window, &Rect); REGION_SetRectRgn(Rgn, Rect.left, Rect.top, Rect.right, Rect.bottom); RegionType = IntGdiCombineRgn(Rgn, Rgn, UpdateRgn, RGN_AND); - REGION_iOffsetRgn(Rgn, -Window->rcClient.left, -Window->rcClient.top); + REGION_bOffsetRgn(Rgn, -Window->rcClient.left, -Window->rcClient.top); RGNOBJAPI_Unlock(UpdateRgn); if (bErase && RegionType != NULLREGION && RegionType != ERROR) @@ -1565,7 +1565,7 @@ /* Substract the part of the dest that was visible in source */ IntGdiCombineRgn(RgnTmp, RgnTmp, pDC->prgnVis, RGN_AND); - REGION_iOffsetRgn(RgnTmp, dx, dy); + REGION_bOffsetRgn(RgnTmp, dx, dy); Result = IntGdiCombineRgn(RgnOwn, RgnOwn, RgnTmp, RGN_DIFF); /* DO NOT Unlock DC while messing with prgnVis! */ @@ -1851,7 +1851,7 @@ RgnWinupd = IntSysCreateRectpRgn( 0, 0, 0, 0); IntGdiCombineRgn( RgnWinupd, RgnTemp, 0, RGN_COPY); } - REGION_iOffsetRgn(RgnTemp, dx, dy); + REGION_bOffsetRgn(RgnTemp, dx, dy); IntGdiCombineRgn(RgnTemp, RgnTemp, RgnClip, RGN_AND); if (hrgnUpdate) IntGdiCombineRgn( RgnWinupd, RgnWinupd, RgnTemp, RGN_OR ); Modified: trunk/reactos/win32ss/user/ntuser/vis.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/vis.c?…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/vis.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/vis.c [iso-8859-1] Thu Dec 18 08:12:41 2014 @@ -81,9 +81,9 @@ PREGION SiblingClipRgn = RGNOBJAPI_Lock(CurrentSibling->hrgnClip, NULL); if (SiblingClipRgn) { - REGION_iOffsetRgn(ClipRgn, -CurrentSibling->rcWindow.left, -CurrentSibling->rcWindow.top); + REGION_bOffsetRgn(ClipRgn, -CurrentSibling->rcWindow.left, -CurrentSibling->rcWindow.top); IntGdiCombineRgn(ClipRgn, ClipRgn, SiblingClipRgn, RGN_AND); - REGION_iOffsetRgn(ClipRgn, CurrentSibling->rcWindow.left, CurrentSibling->rcWindow.top); + REGION_bOffsetRgn(ClipRgn, CurrentSibling->rcWindow.left, CurrentSibling->rcWindow.top); RGNOBJAPI_Unlock(SiblingClipRgn); } } @@ -113,9 +113,9 @@ PREGION CurrentRgnClip = RGNOBJAPI_Lock(CurrentWindow->hrgnClip, NULL); if (CurrentRgnClip) { - REGION_iOffsetRgn(ClipRgn, -CurrentWindow->rcWindow.left, -CurrentWindow->rcWindow.top); + REGION_bOffsetRgn(ClipRgn, -CurrentWindow->rcWindow.left, -CurrentWindow->rcWindow.top); IntGdiCombineRgn(ClipRgn, ClipRgn, CurrentRgnClip, RGN_AND); - REGION_iOffsetRgn(ClipRgn, CurrentWindow->rcWindow.left, CurrentWindow->rcWindow.top); + REGION_bOffsetRgn(ClipRgn, CurrentWindow->rcWindow.left, CurrentWindow->rcWindow.top); RGNOBJAPI_Unlock(CurrentRgnClip); } } @@ -131,9 +131,9 @@ PREGION WndRgnClip = RGNOBJAPI_Lock(Wnd->hrgnClip, NULL); if (WndRgnClip) { - REGION_iOffsetRgn(VisRgn, -Wnd->rcWindow.left, -Wnd->rcWindow.top); + REGION_bOffsetRgn(VisRgn, -Wnd->rcWindow.left, -Wnd->rcWindow.top); IntGdiCombineRgn(VisRgn, VisRgn, WndRgnClip, RGN_AND); - REGION_iOffsetRgn(VisRgn, Wnd->rcWindow.left, Wnd->rcWindow.top); + REGION_bOffsetRgn(VisRgn, Wnd->rcWindow.left, Wnd->rcWindow.top); RGNOBJAPI_Unlock(WndRgnClip); } } @@ -160,7 +160,7 @@ return; IntGdiCombineRgn(TempRgn, NewlyExposed, NULL, RGN_COPY); - REGION_iOffsetRgn(TempRgn, + REGION_bOffsetRgn(TempRgn, Wnd->rcWindow.left - Parent->rcClient.left, Wnd->rcWindow.top - Parent->rcClient.top); Modified: trunk/reactos/win32ss/user/ntuser/windc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/windc.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/windc.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/windc.c [iso-8859-1] Thu Dec 18 08:12:41 2014 @@ -873,7 +873,7 @@ if (NULL != dc->dclevel.prgnClip) { - REGION_iOffsetRgn(dc->dclevel.prgnClip, DeltaX, DeltaY); + REGION_bOffsetRgn(dc->dclevel.prgnClip, DeltaX, DeltaY); dc->fs |= DC_FLAG_DIRTY_RAO; } if (NULL != pDCE->hrgnClip) Modified: trunk/reactos/win32ss/user/ntuser/winpos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winpos…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1] Thu Dec 18 08:12:41 2014 @@ -1762,7 +1762,7 @@ } else if(VisBefore) { - REGION_iOffsetRgn(VisBefore, -Window->rcWindow.left, -Window->rcWindow.top); + REGION_bOffsetRgn(VisBefore, -Window->rcWindow.left, -Window->rcWindow.top); } /* Calculate the non client area for resizes, as this is used in the copy region */ @@ -1779,7 +1779,7 @@ } else if(VisBeforeJustClient) { - REGION_iOffsetRgn(VisBeforeJustClient, -Window->rcWindow.left, -Window->rcWindow.top); + REGION_bOffsetRgn(VisBeforeJustClient, -Window->rcWindow.left, -Window->rcWindow.top); } } } @@ -1864,7 +1864,7 @@ } else if(VisAfter) { - REGION_iOffsetRgn(VisAfter, -Window->rcWindow.left, -Window->rcWindow.top); + REGION_bOffsetRgn(VisAfter, -Window->rcWindow.left, -Window->rcWindow.top); } /* @@ -1905,9 +1905,9 @@ PREGION RgnUpdate = RGNOBJAPI_Lock(Window->hrgnUpdate, NULL); if (RgnUpdate) { - REGION_iOffsetRgn(CopyRgn, NewWindowRect.left, NewWindowRect.top); + REGION_bOffsetRgn(CopyRgn, NewWindowRect.left, NewWindowRect.top); IntGdiCombineRgn(CopyRgn, CopyRgn, RgnUpdate, RGN_DIFF); - REGION_iOffsetRgn(CopyRgn, -NewWindowRect.left, -NewWindowRect.top); + REGION_bOffsetRgn(CopyRgn, -NewWindowRect.left, -NewWindowRect.top); RGNOBJAPI_Unlock(RgnUpdate); } } @@ -1939,7 +1939,7 @@ * to create a copy of CopyRgn and pass that. We need CopyRgn later */ IntGdiCombineRgn(DcRgnObj, CopyRgn, NULL, RGN_COPY); - REGION_iOffsetRgn(DcRgnObj, NewWindowRect.left, NewWindowRect.top); + REGION_bOffsetRgn(DcRgnObj, NewWindowRect.left, NewWindowRect.top); RGNOBJAPI_Unlock(DcRgnObj); Dc = UserGetDCEx( Window, DcRgn, @@ -1992,7 +1992,7 @@ PWND Parent = Window->spwndParent; - REGION_iOffsetRgn( DirtyRgn, + REGION_bOffsetRgn( DirtyRgn, Window->rcWindow.left, Window->rcWindow.top); if ( (Window->style & WS_CHILD) && @@ -2027,7 +2027,7 @@ if (ExposedRgn) { RgnType = IntGdiCombineRgn(ExposedRgn, VisBefore, NULL, RGN_COPY); - REGION_iOffsetRgn(ExposedRgn, + REGION_bOffsetRgn(ExposedRgn, OldWindowRect.left - NewWindowRect.left, OldWindowRect.top - NewWindowRect.top);
10 years
1
0
0
0
[tkreuzer] 65732: [WIN32K] - Rename IntGdiOffsetRgn to REGION_iOffsetRgn
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Dec 18 08:12:34 2014 New Revision: 65732 URL:
http://svn.reactos.org/svn/reactos?rev=65732&view=rev
Log: [WIN32K] - Rename IntGdiOffsetRgn to REGION_iOffsetRgn Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c trunk/reactos/win32ss/gdi/ntgdi/region.c trunk/reactos/win32ss/gdi/ntgdi/region.h trunk/reactos/win32ss/user/ntuser/painting.c trunk/reactos/win32ss/user/ntuser/vis.c trunk/reactos/win32ss/user/ntuser/windc.c trunk/reactos/win32ss/user/ntuser/winpos.c Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Thu Dec 18 08:12:34 2014 @@ -1053,7 +1053,7 @@ /* Transform region into device coordinates */ if (!REGION_LPTODP(pdc, prgnClip, prgn) || - IntGdiOffsetRgn(prgnClip, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y) == ERROR) + REGION_iOffsetRgn(prgnClip, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y) == ERROR) { REGION_Delete(prgnClip); return FALSE; 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] Thu Dec 18 08:12:34 2014 @@ -57,7 +57,7 @@ ASSERT(prgn != NULL); IntGdiCombineRgn(dc->prgnVis, prgn, NULL, RGN_COPY); - IntGdiOffsetRgn(dc->prgnVis, -dc->ptlDCOrig.x, -dc->ptlDCOrig.y); + REGION_iOffsetRgn(dc->prgnVis, -dc->ptlDCOrig.x, -dc->ptlDCOrig.y); DC_UnlockDc(dc); } @@ -365,9 +365,9 @@ if(dc->dclevel.prgnClip != NULL) { - Result = IntGdiOffsetRgn(dc->dclevel.prgnClip, - XOffset, - YOffset); + Result = REGION_iOffsetRgn(dc->dclevel.prgnClip, + XOffset, + YOffset); dc->fs |= DC_FLAG_DIRTY_RAO; } else @@ -572,7 +572,7 @@ } - IntGdiOffsetRgn(pDC->prgnRao, pDC->ptlDCOrig.x, pDC->ptlDCOrig.y); + REGION_iOffsetRgn(pDC->prgnRao, pDC->ptlDCOrig.x, pDC->ptlDCOrig.y); RtlCopyMemory(&pDC->erclClip, &pDC->prgnRao->rdh.rcBound, @@ -590,7 +590,7 @@ pDC->prgnRao->Buffer, &pDC->erclClip); - IntGdiOffsetRgn(pDC->prgnRao, -pDC->ptlDCOrig.x, -pDC->ptlDCOrig.y); + REGION_iOffsetRgn(pDC->prgnRao, -pDC->ptlDCOrig.x, -pDC->ptlDCOrig.y); } /* EOF */ 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 Dec 18 08:12:34 2014 @@ -779,7 +779,7 @@ { ret = IntGdiCombineRgn(prgnDest, prgnSrc, 0, RGN_COPY) == ERROR ? -1 : 1; if ((ret == 1) && (iCode == SYSRGN)) - IntGdiOffsetRgn(prgnDest, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y); + REGION_iOffsetRgn(prgnDest, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y); REGION_UnlockRgn(prgnDest); } else Modified: trunk/reactos/win32ss/gdi/ntgdi/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] Thu Dec 18 08:12:34 2014 @@ -1867,31 +1867,31 @@ else { /* Move the source region to the bottom-right */ - IntGdiOffsetRgn(prgnSrc, cx, cy); + REGION_iOffsetRgn(prgnSrc, cx, cy); /* Intersect with the source region (this crops the top-left frame) */ REGION_IntersectRegion(prgnDest, prgnDest, prgnSrc); /* Move the source region to the bottom-left */ - IntGdiOffsetRgn(prgnSrc, -2 * cx, 0); + REGION_iOffsetRgn(prgnSrc, -2 * cx, 0); /* Intersect with the source region (this crops the top-right frame) */ REGION_IntersectRegion(prgnDest, prgnDest, prgnSrc); /* Move the source region to the top-left */ - IntGdiOffsetRgn(prgnSrc, 0, -2 * cy); + REGION_iOffsetRgn(prgnSrc, 0, -2 * cy); /* Intersect with the source region (this crops the bottom-right frame) */ REGION_IntersectRegion(prgnDest, prgnDest, prgnSrc); /* Move the source region to the top-right */ - IntGdiOffsetRgn(prgnSrc, 2 * cx, 0); + REGION_iOffsetRgn(prgnSrc, 2 * cx, 0); /* Intersect with the source region (this crops the bottom-left frame) */ REGION_IntersectRegion(prgnDest, prgnDest, prgnSrc); /* Move the source region back to the original position */ - IntGdiOffsetRgn(prgnSrc, -cx, cy); + REGION_iOffsetRgn(prgnSrc, -cx, cy); /* Finally subtract the cropped region from the source */ REGION_SubtractRegion(prgnDest, prgnSrc, prgnDest); @@ -1961,7 +1961,7 @@ if (pmx->flAccel & XFORM_UNITY) { /* Just offset the region */ - return IntGdiOffsetRgn(prgn, (pmx->fxDx + 8) / 16, (pmx->fxDy + 8) / 16) != ERROR; + return REGION_iOffsetRgn(prgn, (pmx->fxDx + 8) / 16, (pmx->fxDy + 8) / 16) != ERROR; } else { @@ -2586,7 +2586,7 @@ INT FASTCALL -IntGdiOffsetRgn( +REGION_iOffsetRgn( PREGION rgn, INT XOffset, INT YOffset) @@ -3786,7 +3786,7 @@ return ERROR; } - ret = IntGdiOffsetRgn(rgn, XOffset, YOffset); + ret = REGION_iOffsetRgn(rgn, XOffset, YOffset); RGNOBJAPI_Unlock(rgn); return ret; Modified: trunk/reactos/win32ss/gdi/ntgdi/region.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.h…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] Thu Dec 18 08:12:34 2014 @@ -62,7 +62,7 @@ _In_ ULONG cPolygons, _In_ INT iMode); -INT FASTCALL IntGdiOffsetRgn(PREGION,INT,INT); +INT FASTCALL REGION_iOffsetRgn(PREGION,INT,INT); BOOL FASTCALL IntRectInRegion(HRGN,LPRECTL); INT FASTCALL IntGdiCombineRgn(PREGION, PREGION, PREGION, INT); Modified: trunk/reactos/win32ss/user/ntuser/painting.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/painti…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/painting.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/painting.c [iso-8859-1] Thu Dec 18 08:12:34 2014 @@ -460,13 +460,13 @@ PREGION RgnClip = RGNOBJAPI_Lock(Wnd->hrgnClip, NULL); if (RgnClip) { - IntGdiOffsetRgn( Rgn, - -Wnd->rcWindow.left, - -Wnd->rcWindow.top); + REGION_iOffsetRgn(Rgn, + -Wnd->rcWindow.left, + -Wnd->rcWindow.top); RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnClip, RGN_AND); - IntGdiOffsetRgn( Rgn, - Wnd->rcWindow.left, - Wnd->rcWindow.top); + REGION_iOffsetRgn(Rgn, + Wnd->rcWindow.left, + Wnd->rcWindow.top); RGNOBJAPI_Unlock(RgnClip); } } @@ -682,7 +682,7 @@ } else { - IntGdiOffsetRgn(TmpRgn, Window->rcClient.left, Window->rcClient.top); + REGION_iOffsetRgn(TmpRgn, Window->rcClient.left, Window->rcClient.top); } } else if (UpdateRect != NULL) @@ -690,7 +690,7 @@ if (!RECTL_bIsEmptyRect(UpdateRect)) { TmpRgn = IntSysCreateRectpRgnIndirect(UpdateRect); - IntGdiOffsetRgn(TmpRgn, Window->rcClient.left, Window->rcClient.top); + REGION_iOffsetRgn(TmpRgn, Window->rcClient.left, Window->rcClient.top); } } else if ((Flags & (RDW_INVALIDATE | RDW_FRAME)) == (RDW_INVALIDATE | RDW_FRAME) || @@ -1229,7 +1229,7 @@ IntIntersectWithParents(Window, &Rect); REGION_SetRectRgn(Rgn, Rect.left, Rect.top, Rect.right, Rect.bottom); RegionType = IntGdiCombineRgn(Rgn, Rgn, UpdateRgn, RGN_AND); - IntGdiOffsetRgn(Rgn, -Window->rcClient.left, -Window->rcClient.top); + REGION_iOffsetRgn(Rgn, -Window->rcClient.left, -Window->rcClient.top); RGNOBJAPI_Unlock(UpdateRgn); if (bErase && RegionType != NULLREGION && RegionType != ERROR) @@ -1565,7 +1565,7 @@ /* Substract the part of the dest that was visible in source */ IntGdiCombineRgn(RgnTmp, RgnTmp, pDC->prgnVis, RGN_AND); - IntGdiOffsetRgn(RgnTmp, dx, dy); + REGION_iOffsetRgn(RgnTmp, dx, dy); Result = IntGdiCombineRgn(RgnOwn, RgnOwn, RgnTmp, RGN_DIFF); /* DO NOT Unlock DC while messing with prgnVis! */ @@ -1851,7 +1851,7 @@ RgnWinupd = IntSysCreateRectpRgn( 0, 0, 0, 0); IntGdiCombineRgn( RgnWinupd, RgnTemp, 0, RGN_COPY); } - IntGdiOffsetRgn(RgnTemp, dx, dy); + REGION_iOffsetRgn(RgnTemp, dx, dy); IntGdiCombineRgn(RgnTemp, RgnTemp, RgnClip, RGN_AND); if (hrgnUpdate) IntGdiCombineRgn( RgnWinupd, RgnWinupd, RgnTemp, RGN_OR ); Modified: trunk/reactos/win32ss/user/ntuser/vis.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/vis.c?…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/vis.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/vis.c [iso-8859-1] Thu Dec 18 08:12:34 2014 @@ -81,9 +81,9 @@ PREGION SiblingClipRgn = RGNOBJAPI_Lock(CurrentSibling->hrgnClip, NULL); if (SiblingClipRgn) { - IntGdiOffsetRgn(ClipRgn, -CurrentSibling->rcWindow.left, -CurrentSibling->rcWindow.top); + REGION_iOffsetRgn(ClipRgn, -CurrentSibling->rcWindow.left, -CurrentSibling->rcWindow.top); IntGdiCombineRgn(ClipRgn, ClipRgn, SiblingClipRgn, RGN_AND); - IntGdiOffsetRgn(ClipRgn, CurrentSibling->rcWindow.left, CurrentSibling->rcWindow.top); + REGION_iOffsetRgn(ClipRgn, CurrentSibling->rcWindow.left, CurrentSibling->rcWindow.top); RGNOBJAPI_Unlock(SiblingClipRgn); } } @@ -113,9 +113,9 @@ PREGION CurrentRgnClip = RGNOBJAPI_Lock(CurrentWindow->hrgnClip, NULL); if (CurrentRgnClip) { - IntGdiOffsetRgn(ClipRgn, -CurrentWindow->rcWindow.left, -CurrentWindow->rcWindow.top); + REGION_iOffsetRgn(ClipRgn, -CurrentWindow->rcWindow.left, -CurrentWindow->rcWindow.top); IntGdiCombineRgn(ClipRgn, ClipRgn, CurrentRgnClip, RGN_AND); - IntGdiOffsetRgn(ClipRgn, CurrentWindow->rcWindow.left, CurrentWindow->rcWindow.top); + REGION_iOffsetRgn(ClipRgn, CurrentWindow->rcWindow.left, CurrentWindow->rcWindow.top); RGNOBJAPI_Unlock(CurrentRgnClip); } } @@ -131,9 +131,9 @@ PREGION WndRgnClip = RGNOBJAPI_Lock(Wnd->hrgnClip, NULL); if (WndRgnClip) { - IntGdiOffsetRgn(VisRgn, -Wnd->rcWindow.left, -Wnd->rcWindow.top); + REGION_iOffsetRgn(VisRgn, -Wnd->rcWindow.left, -Wnd->rcWindow.top); IntGdiCombineRgn(VisRgn, VisRgn, WndRgnClip, RGN_AND); - IntGdiOffsetRgn(VisRgn, Wnd->rcWindow.left, Wnd->rcWindow.top); + REGION_iOffsetRgn(VisRgn, Wnd->rcWindow.left, Wnd->rcWindow.top); RGNOBJAPI_Unlock(WndRgnClip); } } @@ -160,9 +160,9 @@ return; IntGdiCombineRgn(TempRgn, NewlyExposed, NULL, RGN_COPY); - IntGdiOffsetRgn(TempRgn, - Wnd->rcWindow.left - Parent->rcClient.left, - Wnd->rcWindow.top - Parent->rcClient.top); + REGION_iOffsetRgn(TempRgn, + Wnd->rcWindow.left - Parent->rcClient.left, + Wnd->rcWindow.top - Parent->rcClient.top); UserRefObjectCo(Parent, &Ref); co_UserRedrawWindow(Parent, NULL, TempRgn, Modified: trunk/reactos/win32ss/user/ntuser/windc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/windc.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/windc.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/windc.c [iso-8859-1] Thu Dec 18 08:12:34 2014 @@ -873,7 +873,7 @@ if (NULL != dc->dclevel.prgnClip) { - IntGdiOffsetRgn(dc->dclevel.prgnClip, DeltaX, DeltaY); + REGION_iOffsetRgn(dc->dclevel.prgnClip, DeltaX, DeltaY); dc->fs |= DC_FLAG_DIRTY_RAO; } if (NULL != pDCE->hrgnClip) Modified: trunk/reactos/win32ss/user/ntuser/winpos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winpos…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1] Thu Dec 18 08:12:34 2014 @@ -1440,7 +1440,7 @@ TRACE("skip all the topmost windows\n"); /* skip all the topmost windows */ while (List[i] && - (ChildObject = ValidateHwndNoErr(List[i])) && + (ChildObject = ValidateHwndNoErr(List[i])) && (ChildObject->ExStyle & WS_EX_TOPMOST)) i++; } } @@ -1532,9 +1532,9 @@ POINT pt; /* Finally make sure that all coordinates are valid */ - if (WinPos->x < -32768) WinPos->x = -32768; + if (WinPos->x < -32768) WinPos->x = -32768; else if (WinPos->x > 32767) WinPos->x = 32767; - if (WinPos->y < -32768) WinPos->y = -32768; + if (WinPos->y < -32768) WinPos->y = -32768; else if (WinPos->y > 32767) WinPos->y = 32767; WinPos->cx = max(WinPos->cx, 0); @@ -1762,10 +1762,10 @@ } else if(VisBefore) { - IntGdiOffsetRgn(VisBefore, -Window->rcWindow.left, -Window->rcWindow.top); + REGION_iOffsetRgn(VisBefore, -Window->rcWindow.left, -Window->rcWindow.top); } - /* Calculate the non client area for resizes, as this is used in the copy region */ + /* Calculate the non client area for resizes, as this is used in the copy region */ if (!(WinPos.flags & SWP_NOSIZE)) { VisBeforeJustClient = VIS_ComputeVisibleRegion(Window, TRUE, FALSE, @@ -1779,7 +1779,7 @@ } else if(VisBeforeJustClient) { - IntGdiOffsetRgn(VisBeforeJustClient, -Window->rcWindow.left, -Window->rcWindow.top); + REGION_iOffsetRgn(VisBeforeJustClient, -Window->rcWindow.left, -Window->rcWindow.top); } } } @@ -1864,7 +1864,7 @@ } else if(VisAfter) { - IntGdiOffsetRgn(VisAfter, -Window->rcWindow.left, -Window->rcWindow.top); + REGION_iOffsetRgn(VisAfter, -Window->rcWindow.left, -Window->rcWindow.top); } /* @@ -1905,9 +1905,9 @@ PREGION RgnUpdate = RGNOBJAPI_Lock(Window->hrgnUpdate, NULL); if (RgnUpdate) { - IntGdiOffsetRgn(CopyRgn, NewWindowRect.left, NewWindowRect.top); + REGION_iOffsetRgn(CopyRgn, NewWindowRect.left, NewWindowRect.top); IntGdiCombineRgn(CopyRgn, CopyRgn, RgnUpdate, RGN_DIFF); - IntGdiOffsetRgn(CopyRgn, -NewWindowRect.left, -NewWindowRect.top); + REGION_iOffsetRgn(CopyRgn, -NewWindowRect.left, -NewWindowRect.top); RGNOBJAPI_Unlock(RgnUpdate); } } @@ -1939,7 +1939,7 @@ * to create a copy of CopyRgn and pass that. We need CopyRgn later */ IntGdiCombineRgn(DcRgnObj, CopyRgn, NULL, RGN_COPY); - IntGdiOffsetRgn(DcRgnObj, NewWindowRect.left, NewWindowRect.top); + REGION_iOffsetRgn(DcRgnObj, NewWindowRect.left, NewWindowRect.top); RGNOBJAPI_Unlock(DcRgnObj); Dc = UserGetDCEx( Window, DcRgn, @@ -1992,7 +1992,7 @@ PWND Parent = Window->spwndParent; - IntGdiOffsetRgn( DirtyRgn, + REGION_iOffsetRgn( DirtyRgn, Window->rcWindow.left, Window->rcWindow.top); if ( (Window->style & WS_CHILD) && @@ -2027,9 +2027,9 @@ if (ExposedRgn) { RgnType = IntGdiCombineRgn(ExposedRgn, VisBefore, NULL, RGN_COPY); - IntGdiOffsetRgn( ExposedRgn, - OldWindowRect.left - NewWindowRect.left, - OldWindowRect.top - NewWindowRect.top); + REGION_iOffsetRgn(ExposedRgn, + OldWindowRect.left - NewWindowRect.left, + OldWindowRect.top - NewWindowRect.top); if (VisAfter != NULL) RgnType = IntGdiCombineRgn(ExposedRgn, ExposedRgn, VisAfter, RGN_DIFF);
10 years
1
0
0
0
[tkreuzer] 65731: [WIN32K] Implement exclusive lock order checks for GDI objects in debug builds
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Dec 18 08:12:28 2014 New Revision: 65731 URL:
http://svn.reactos.org/svn/reactos?rev=65731&view=rev
Log: [WIN32K] Implement exclusive lock order checks for GDI objects in debug builds Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] Thu Dec 18 08:12:28 2014 @@ -71,6 +71,22 @@ } #if DBG +VOID +ASSERT_LOCK_ORDER( + _In_ UCHAR objt) +{ + PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); + ULONG i; + + if (pti) + { + /* Ensure correct locking order! */ + for (i = objt + 1; i < GDIObjTypeTotal; i++) + { + NT_ASSERT(pti->acExclusiveLockCount[i] == 0); + } + } +} #define ASSERT_SHARED_OBJECT_TYPE(objt) \ ASSERT((objt) == GDIObjType_SURF_TYPE || \ (objt) == GDIObjType_PAL_TYPE || \ @@ -83,6 +99,7 @@ #define ASSERT_TRYLOCK_OBJECT_TYPE(objt) \ ASSERT((objt) == GDIObjType_DRVOBJ_TYPE) #else +#define ASSERT_LOCK_ORDER(hobj) #define ASSERT_SHARED_OBJECT_TYPE(objt) #define ASSERT_EXCLUSIVE_OBJECT_TYPE(objt) #define ASSERT_TRYLOCK_OBJECT_TYPE(objt) @@ -669,6 +686,9 @@ return NULL; } + /* Make sure lock order is correct */ + ASSERT_LOCK_ORDER(objt); + /* Reference the handle entry */ pentry = ENTRY_ReferenceEntryByHandle(hobj, 0); if (!pentry) @@ -734,6 +754,9 @@ DPRINT("Wrong object type: hobj=0x%p, objt=0x%x\n", hobj, objt); return NULL; } + + /* Make sure lock order is correct */ + ASSERT_LOCK_ORDER(objt); /* Reference the handle entry */ pentry = ENTRY_ReferenceEntryByHandle(hobj, 0);
10 years
1
0
0
0
[tkreuzer] 65730: [WIN32K] - Rewrite NtGdiFillRgn and IntGdiPaintRgn We now properly support painting regions on DCs with arbitrary world transforms, with pattern brushes and we respect the foregro...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Dec 18 08:12:23 2014 New Revision: 65730 URL:
http://svn.reactos.org/svn/reactos?rev=65730&view=rev
Log: [WIN32K] - Rewrite NtGdiFillRgn and IntGdiPaintRgn We now properly support painting regions on DCs with arbitrary world transforms, with pattern brushes and we respect the foreground ROP and mode of the DC. And we don't run into deadlocks due to having an exclusive region lock while trying to lock a DC. LOCKING MUST BE DONE IN PROPER ORDER! Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Thu Dec 18 08:12:23 2014 @@ -1021,103 +1021,146 @@ if (IntGdiCombineRgn(prgnDest, prgnSrc, NULL, RGN_COPY) == ERROR) return FALSE; - return REGION_bXformRgn(prgnDest, &pdc->dclevel.mxWorldToDevice); + return REGION_bXformRgn(prgnDest, DC_pmxWorldToDevice(pdc)); +} + +BOOL +IntGdiFillRgn( + _In_ PDC pdc, + _In_ PREGION prgn, + _In_ BRUSHOBJ *pbo) +{ + PREGION prgnClip; + XCLIPOBJ xcoClip; + BOOL bRet; + PSURFACE psurf; + DWORD rop2Fg; + MIX mix; + + NT_ASSERT((pdc != NULL) && (prgn != NULL)); + + psurf = pdc->dclevel.pSurface; + if (psurf == NULL) + { + return TRUE; + } + + prgnClip = IntSysCreateRectpRgn(0, 0, 0, 0); + if (prgnClip == NULL) + { + return FALSE; + } + + /* Transform region into device coordinates */ + if (!REGION_LPTODP(pdc, prgnClip, prgn) || + IntGdiOffsetRgn(prgnClip, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y) == ERROR) + { + REGION_Delete(prgnClip); + return FALSE; + } + + /* Intersect with the system or RAO region */ + if (pdc->prgnRao) + IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnRao, RGN_AND); + else + IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnVis, RGN_AND); + + IntEngInitClipObj(&xcoClip); + IntEngUpdateClipRegion(&xcoClip, + prgnClip->rdh.nCount, + prgnClip->Buffer, + &prgnClip->rdh.rcBound ); + + /* Get the FG rop and create a MIX based on the BK mode */ + rop2Fg = pdc->pdcattr->jROP2; + mix = rop2Fg | (pdc->pdcattr->jBkMode == OPAQUE ? rop2Fg : R2_NOP) << 8; + + /* Call the internal function */ + bRet = IntEngPaint(&psurf->SurfObj, + &xcoClip.ClipObj, + pbo, + &pdc->pdcattr->ptlBrushOrigin, + mix); + + REGION_Delete(prgnClip); + IntEngFreeClipResources(&xcoClip); + + // Fill the region + return bRet; } BOOL FASTCALL IntGdiPaintRgn( - PDC dc, - PREGION Rgn) -{ - PREGION VisRgn; - XCLIPOBJ ClipRegion; - BOOL bRet = FALSE; - POINTL BrushOrigin; - SURFACE *psurf; - PDC_ATTR pdcattr; - - if ((dc == NULL) || (Rgn == NULL)) - return FALSE; - - pdcattr = dc->pdcattr; - - ASSERT(!(pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))); - - VisRgn = IntSysCreateRectpRgn(0, 0, 0, 0); - if (VisRgn == NULL) - { - return FALSE; - } - - // Transform region into device co-ords - if (!REGION_LPTODP(dc, VisRgn, Rgn) || - IntGdiOffsetRgn(VisRgn, dc->ptlDCOrig.x, dc->ptlDCOrig.y) == ERROR) - { - REGION_Delete(VisRgn); - return FALSE; - } - - if (dc->prgnRao) - IntGdiCombineRgn(VisRgn, VisRgn, dc->prgnRao, RGN_AND); - - IntEngInitClipObj(&ClipRegion); - IntEngUpdateClipRegion(&ClipRegion, - VisRgn->rdh.nCount, - VisRgn->Buffer, - &VisRgn->rdh.rcBound ); - - BrushOrigin.x = pdcattr->ptlBrushOrigin.x; - BrushOrigin.y = pdcattr->ptlBrushOrigin.y; - psurf = dc->dclevel.pSurface; - /* FIXME: Handle psurf == NULL !!!! */ - - bRet = IntEngPaint(&psurf->SurfObj, - &ClipRegion.ClipObj, - &dc->eboFill.BrushObject, - &BrushOrigin, - 0xFFFF); // FIXME: Don't know what to put here - - REGION_Delete(VisRgn); - IntEngFreeClipResources(&ClipRegion); - - // Fill the region - return bRet; + _In_ PDC pdc, + _In_ PREGION prgn) +{ + if (pdc->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY)) + DC_vUpdateFillBrush(pdc); + + return IntGdiFillRgn(pdc, prgn, &pdc->eboFill.BrushObject); } BOOL APIENTRY NtGdiFillRgn( - HDC hDC, - HRGN hRgn, - HBRUSH hBrush) -{ - HBRUSH oldhBrush; - PREGION rgn; - PRECTL r; - - rgn = RGNOBJAPI_Lock(hRgn, NULL); - if (rgn == NULL) - { - return FALSE; - } - - oldhBrush = NtGdiSelectBrush(hDC, hBrush); - if (oldhBrush == NULL) - { - RGNOBJAPI_Unlock(rgn); - return FALSE; - } - - for (r = rgn->Buffer; r < rgn->Buffer + rgn->rdh.nCount; r++) - { - NtGdiPatBlt(hDC, r->left, r->top, r->right - r->left, r->bottom - r->top, PATCOPY); - } - - RGNOBJAPI_Unlock(rgn); - NtGdiSelectBrush(hDC, oldhBrush); - - return TRUE; + _In_ HDC hdc, + _In_ HRGN hrgn, + _In_ HBRUSH hbrush) +{ + PDC pdc; + PREGION prgn; + PBRUSH pbrFill; + EBRUSHOBJ eboFill; + BOOL bResult; + + /* Lock the DC */ + pdc = DC_LockDc(hdc); + if (pdc == NULL) + { + ERR("Failed to lock hdc %p\n", hdc); + return FALSE; + } + + /* Check if the DC has no surface (empty mem or info DC) */ + if (pdc->dclevel.pSurface == NULL) + { + DC_UnlockDc(pdc); + return TRUE; + } + + /* Lock the region */ + prgn = RGNOBJAPI_Lock(hrgn, NULL); + if (prgn == NULL) + { + ERR("Failed to lock hrgn %p\n", hrgn); + DC_UnlockDc(pdc); + return FALSE; + } + + /* Lock the brush */ + pbrFill = BRUSH_ShareLockBrush(hbrush); + if (pbrFill == NULL) + { + ERR("Failed to lock hbrush %p\n", hbrush); + RGNOBJAPI_Unlock(prgn); + DC_UnlockDc(pdc); + return FALSE; + } + + /* Initialize the brush object */ + /// \todo Check parameters + EBRUSHOBJ_vInit(&eboFill, pbrFill, pdc->dclevel.pSurface, 0x00FFFFFF, 0, NULL); + + /* Call the internal function */ + bResult = IntGdiFillRgn(pdc, prgn, &eboFill.BrushObject); + + /* Cleanup locks */ + BRUSH_ShareUnlockBrush(pbrFill); + RGNOBJAPI_Unlock(prgn); + DC_UnlockDc(pdc); + + return bResult; } BOOL
10 years
1
0
0
0
[tkreuzer] 65729: [WIN32K] Properly implement EngPaint, calling IntEngBitBlt, instead of doing a manual single color fill.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Dec 18 08:12:19 2014 New Revision: 65729 URL:
http://svn.reactos.org/svn/reactos?rev=65729&view=rev
Log: [WIN32K] Properly implement EngPaint, calling IntEngBitBlt, instead of doing a manual single color fill. Modified: trunk/reactos/win32ss/gdi/eng/eng.h trunk/reactos/win32ss/gdi/eng/paint.c Modified: trunk/reactos/win32ss/gdi/eng/eng.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/eng.h?rev=…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/eng.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/eng.h [iso-8859-1] Thu Dec 18 08:12:19 2014 @@ -1,4 +1,10 @@ #pragma once + +extern const BYTE gajRop2ToRop3[16]; + +#define MIX_TO_ROP4(mix) \ + (((ULONG)gajRop2ToRop3[((mix) - 1) & 0xF]) | \ + ((ULONG)gajRop2ToRop3[(((mix) >> 8) - 1) & 0xF] << 8)) VOID NTAPI Modified: trunk/reactos/win32ss/gdi/eng/paint.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/paint.c?re…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/paint.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/paint.c [iso-8859-1] Thu Dec 18 08:12:19 2014 @@ -3,13 +3,34 @@ * PROJECT: ReactOS kernel * PURPOSE: GDI Driver Paint Functions * FILE: subsys/win32k/eng/paint.c - * PROGRAMER: Jason Filby + * PROGRAMERS: Timo Kreuzer (timo.kreuzer(a)reactos.org) + * Jason Filby */ #include <win32k.h> #define NDEBUG #include <debug.h> + +const BYTE gajRop2ToRop3[16] = +{ + 0x00, // 1: R2_BLACK 0 + 0x05, // 2: R2_NOTMERGEPEN DPon + 0x0A, // 3: R2_MASKNOTPEN DPna + 0x0F, // 4: R2_NOTCOPYPEN Pn + 0x50, // 5: R2_MASKPENNOT PDna + 0x55, // 6: R2_NOT Dn + 0x5A, // 7: R2_XORPEN DPx + 0x5F, // 8: R2_NOTMASKPEN DPan + 0xA0, // 9: R2_MASKPEN DPa + 0xA5, // 10: R2_NOTXORPEN PDxn + 0xAA, // 11: R2_NOP D + 0xAF, // 12: R2_MERGENOTPEN DPno + 0xF0, // 13: R2_COPYPEN P + 0xF5, // 14: R2_MERGEPENNOT PDno + 0xFA, // 15: R2_MERGEPEN DPo + 0xFF, // 16: R2_WHITE 1 +}; BOOL APIENTRY FillSolid(SURFOBJ *pso, PRECTL pRect, ULONG iColor) { @@ -28,87 +49,57 @@ return TRUE; } -BOOL APIENTRY -EngPaintRgn(SURFOBJ *pso, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix, - BRUSHOBJ *BrushObj, POINTL *BrushPoint) +BOOL +APIENTRY +EngPaint( + _In_ SURFOBJ *pso, + _In_ CLIPOBJ *pco, + _In_ BRUSHOBJ *pbo, + _In_ POINTL *pptlBrushOrg, + _In_ __in_data_source(USER_MODE) MIX mix) { - RECT_ENUM RectEnum; - BOOL EnumMore; - ULONG i; + ROP4 rop4; - ASSERT(pso); - ASSERT(ClipRegion); + /* Convert the MIX, consisting of 2 ROP2 codes into a ROP4 */ + rop4 = MIX_TO_ROP4(mix); - DPRINT("ClipRegion->iMode:%u, ClipRegion->iDComplexity: %u\n Color: %lu", ClipRegion->iMode, ClipRegion->iDComplexity, iColor); - switch(ClipRegion->iMode) { + /* Sanity checks */ + NT_ASSERT(!ROP4_USES_SOURCE(rop4)); + NT_ASSERT(!ROP4_USES_MASK(rop4)); - case TC_RECTANGLES: + /* Forward the call to Eng/DrvBitBlt */ + return IntEngBitBlt(pso, + NULL, + NULL, + pco, + NULL, + &pco->rclBounds, + NULL, + NULL, + pbo, + pptlBrushOrg, + rop4); +} - /* Rectangular clipping can be handled without enumeration. - Note that trivial clipping is not possible, since the clipping - region defines the area to fill */ +BOOL +APIENTRY +IntEngPaint( + _In_ SURFOBJ *pso, + _In_ CLIPOBJ *pco, + _In_ BRUSHOBJ *pbo, + _In_ POINTL *pptlBrushOrg, + _In_ __in_data_source(USER_MODE) MIX mix) +{ + SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj); - if (ClipRegion->iDComplexity == DC_RECT) + /* Is the surface's Paint function hooked? */ + if ((pso->iType != STYPE_BITMAP) && (psurf->flags & HOOK_PAINT)) { - FillSolid(pso, &(ClipRegion->rclBounds), iColor); - } else { - - /* Enumerate all the rectangles and draw them */ - CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY, 0); - - do { - EnumMore = CLIPOBJ_bEnum(ClipRegion, sizeof(RectEnum), (PVOID) &RectEnum); - for (i = 0; i < RectEnum.c; i++) { - FillSolid(pso, RectEnum.arcl + i, iColor); - } - } while (EnumMore); + /* Call the driver's DrvPaint */ + return GDIDEVFUNCS(pso).Paint(pso, pco, pbo, pptlBrushOrg, mix); } - return(TRUE); - - default: - return(FALSE); - } + return EngPaint(pso, pco, pbo, pptlBrushOrg, mix); } -/* - * @unimplemented - */ -BOOL APIENTRY -EngPaint(IN SURFOBJ *pso, - IN CLIPOBJ *ClipRegion, - IN BRUSHOBJ *Brush, - IN POINTL *BrushOrigin, - IN MIX Mix) -{ - BOOLEAN ret; - - // FIXME: We only support a brush's solid color attribute - ret = EngPaintRgn(pso, ClipRegion, Brush->iSolidColor, Mix, Brush, BrushOrigin); - - return ret; -} - -BOOL APIENTRY -IntEngPaint(IN SURFOBJ *pso, - IN CLIPOBJ *ClipRegion, - IN BRUSHOBJ *Brush, - IN POINTL *BrushOrigin, - IN MIX Mix) -{ - SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj); - BOOL ret; - - DPRINT("pso->iType == %u\n", pso->iType); - /* Is the surface's Paint function hooked? */ - if((pso->iType!=STYPE_BITMAP) && (psurf->flags & HOOK_PAINT)) - { - // Call the driver's DrvPaint - ret = GDIDEVFUNCS(pso).Paint( - pso, ClipRegion, Brush, BrushOrigin, Mix); - return ret; - } - return EngPaint(pso, ClipRegion, Brush, BrushOrigin, Mix ); - -} /* EOF */
10 years
1
0
0
0
[tkreuzer] 65728: [WIN32K] - Implement REGION_bXformRgn - Move IntGdiPaintRgn ro bitblt.c
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Dec 18 08:12:06 2014 New Revision: 65728 URL:
http://svn.reactos.org/svn/reactos?rev=65728&view=rev
Log: [WIN32K] - Implement REGION_bXformRgn - Move IntGdiPaintRgn ro bitblt.c Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c trunk/reactos/win32ss/gdi/ntgdi/region.c trunk/reactos/win32ss/gdi/ntgdi/region.h Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Thu Dec 18 08:12:06 2014 @@ -1010,6 +1010,81 @@ return Ret; } +static +BOOL +FASTCALL +REGION_LPTODP( + _In_ PDC pdc, + _Inout_ PREGION prgnDest, + _In_ PREGION prgnSrc) +{ + if (IntGdiCombineRgn(prgnDest, prgnSrc, NULL, RGN_COPY) == ERROR) + return FALSE; + + return REGION_bXformRgn(prgnDest, &pdc->dclevel.mxWorldToDevice); +} + +BOOL +FASTCALL +IntGdiPaintRgn( + PDC dc, + PREGION Rgn) +{ + PREGION VisRgn; + XCLIPOBJ ClipRegion; + BOOL bRet = FALSE; + POINTL BrushOrigin; + SURFACE *psurf; + PDC_ATTR pdcattr; + + if ((dc == NULL) || (Rgn == NULL)) + return FALSE; + + pdcattr = dc->pdcattr; + + ASSERT(!(pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))); + + VisRgn = IntSysCreateRectpRgn(0, 0, 0, 0); + if (VisRgn == NULL) + { + return FALSE; + } + + // Transform region into device co-ords + if (!REGION_LPTODP(dc, VisRgn, Rgn) || + IntGdiOffsetRgn(VisRgn, dc->ptlDCOrig.x, dc->ptlDCOrig.y) == ERROR) + { + REGION_Delete(VisRgn); + return FALSE; + } + + if (dc->prgnRao) + IntGdiCombineRgn(VisRgn, VisRgn, dc->prgnRao, RGN_AND); + + IntEngInitClipObj(&ClipRegion); + IntEngUpdateClipRegion(&ClipRegion, + VisRgn->rdh.nCount, + VisRgn->Buffer, + &VisRgn->rdh.rcBound ); + + BrushOrigin.x = pdcattr->ptlBrushOrigin.x; + BrushOrigin.y = pdcattr->ptlBrushOrigin.y; + psurf = dc->dclevel.pSurface; + /* FIXME: Handle psurf == NULL !!!! */ + + bRet = IntEngPaint(&psurf->SurfObj, + &ClipRegion.ClipObj, + &dc->eboFill.BrushObject, + &BrushOrigin, + 0xFFFF); // FIXME: Don't know what to put here + + REGION_Delete(VisRgn); + IntEngFreeClipResources(&ClipRegion); + + // Fill the region + return bRet; +} + BOOL APIENTRY NtGdiFillRgn( Modified: trunk/reactos/win32ss/gdi/ntgdi/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] Thu Dec 18 08:12:06 2014 @@ -1941,64 +1941,137 @@ return hrgnFrame; } - -static BOOL FASTCALL -REGION_LPTODP( - _In_ PDC dc, - _Inout_ PREGION RgnDest, - _In_ PREGION RgnSrc) -{ - RECTL *pCurRect, *pEndRect; - RECTL tmpRect; - PDC_ATTR pdcattr; - - if (dc == NULL) - return FALSE; - pdcattr = dc->pdcattr; - - if (pdcattr->iMapMode == MM_TEXT) // Requires only a translation - { - if (IntGdiCombineRgn(RgnDest, RgnSrc, 0, RGN_COPY) == ERROR) +REGION_bXformRgn( + _Inout_ PREGION prgn, + _In_ PMATRIX pmx) +{ + XFORMOBJ xo; + ULONG i, j, cjSize; + PPOINT ppt; + PULONG pcPoints; + RECT rect; + BOOL bResult; + + /* Check if this is a scaling only matrix (off-diagonal elements are 0 */ + if (pmx->flAccel & XFORM_SCALE) + { + /* Check if this is a translation only matrix */ + if (pmx->flAccel & XFORM_UNITY) + { + /* Just offset the region */ + return IntGdiOffsetRgn(prgn, (pmx->fxDx + 8) / 16, (pmx->fxDy + 8) / 16) != ERROR; + } + else + { + /* Initialize the xform object */ + XFORMOBJ_vInit(&xo, pmx); + + /* Scaling can move the rects out of the coordinate space, so + * we first need to check whether we can apply the transformation + * on the bounds rect without modifying the region */ + if (!XFORMOBJ_bApplyXform(&xo, XF_LTOL, 2, &prgn->rdh.rcBound, &rect)) + { + return FALSE; + } + + /* Apply the xform to the rects in the region */ + if (!XFORMOBJ_bApplyXform(&xo, + XF_LTOL, + prgn->rdh.nCount * 2, + prgn->Buffer, + prgn->Buffer)) + { + /* This can not happen, since we already checked the bounds! */ + NT_ASSERT(FALSE); + } + + /* Reset bounds */ + RECTL_vSetEmptyRect(&prgn->rdh.rcBound); + + /* Loop all rects in the region */ + for (i = 0; i < prgn->rdh.nCount; i++) + { + /* Make sure the rect is well-ordered after the xform */ + RECTL_vMakeWellOrdered(&prgn->Buffer[i]); + + /* Update bounds */ + RECTL_bUnionRect(&prgn->rdh.rcBound, + &prgn->rdh.rcBound, + &prgn->Buffer[i]); + } + + /* Loop all rects in the region */ + for (i = 0; i < prgn->rdh.nCount - 1; i++) + { + for (j = i; i < prgn->rdh.nCount; i++) + { + NT_ASSERT(prgn->Buffer[i].top < prgn->Buffer[i].bottom); + NT_ASSERT(prgn->Buffer[j].top >= prgn->Buffer[i].top); + } + } + + return TRUE; + } + } + else + { + /* Allocate a buffer for the polygons */ + cjSize = prgn->rdh.nCount * (4 * sizeof(POINT) + sizeof(ULONG)); + ppt = ExAllocatePoolWithTag(PagedPool, cjSize, GDITAG_REGION); + if (ppt == NULL) + { return FALSE; - - IntGdiOffsetRgn(RgnDest, - pdcattr->ptlViewportOrg.x - pdcattr->ptlWindowOrg.x, - pdcattr->ptlViewportOrg.y - pdcattr->ptlWindowOrg.y); - return TRUE; - } - - EMPTY_REGION(RgnDest); - - pEndRect = RgnSrc->Buffer + RgnSrc->rdh.nCount; - for (pCurRect = RgnSrc->Buffer; pCurRect < pEndRect; pCurRect++) - { - tmpRect = *pCurRect; - tmpRect.left = XLPTODP(pdcattr, tmpRect.left); - tmpRect.top = YLPTODP(pdcattr, tmpRect.top); - tmpRect.right = XLPTODP(pdcattr, tmpRect.right); - tmpRect.bottom = YLPTODP(pdcattr, tmpRect.bottom); - - if (tmpRect.left > tmpRect.right) - { - INT tmp = tmpRect.left; - tmpRect.left = tmpRect.right; - tmpRect.right = tmp; - } - - if (tmpRect.top > tmpRect.bottom) - { - INT tmp = tmpRect.top; - tmpRect.top = tmpRect.bottom; - tmpRect.bottom = tmp; - } - - REGION_UnionRectWithRgn(RgnDest, &tmpRect); - } - - return TRUE; -} + } + + /* Fill the buffer with the rects */ + pcPoints = (PULONG)&ppt[4 * prgn->rdh.nCount]; + for (i = 0; i < prgn->rdh.nCount; i++) + { + /* Make sure the rect is within the legal range */ + pcPoints[i] = 4; + ppt[4 * i + 0].x = prgn->Buffer[i].left; + ppt[4 * i + 0].y = prgn->Buffer[i].top; + ppt[4 * i + 1].x = prgn->Buffer[i].right; + ppt[4 * i + 1].y = prgn->Buffer[i].top; + ppt[4 * i + 2].x = prgn->Buffer[i].right; + ppt[4 * i + 2].y = prgn->Buffer[i].bottom; + ppt[4 * i + 3].x = prgn->Buffer[i].left; + ppt[4 * i + 3].y = prgn->Buffer[i].bottom; + } + + /* Initialize the xform object */ + XFORMOBJ_vInit(&xo, pmx); + + /* Apply the xform to the rects in the buffer */ + if (!XFORMOBJ_bApplyXform(&xo, + XF_LTOL, + prgn->rdh.nCount * 2, + ppt, + ppt)) + { + /* This means, there were coordinates that would go outside of + the coordinate space after the transformation */ + ExFreePoolWithTag(ppt, GDITAG_REGION); + return FALSE; + } + + /* Now use the polygons to create a polygon region */ + bResult = REGION_SetPolyPolygonRgn(prgn, + ppt, + pcPoints, + prgn->rdh.nCount, + WINDING); + + /* Free the polygon buffer */ + ExFreePoolWithTag(ppt, GDITAG_REGION); + + return bResult; + } + +} + PREGION FASTCALL @@ -2385,66 +2458,6 @@ return ret; } -BOOL -FASTCALL -IntGdiPaintRgn( - PDC dc, - PREGION Rgn) -{ - PREGION VisRgn; - XCLIPOBJ ClipRegion; - BOOL bRet = FALSE; - POINTL BrushOrigin; - SURFACE *psurf; - PDC_ATTR pdcattr; - - if ((dc == NULL) || (Rgn == NULL)) - return FALSE; - - pdcattr = dc->pdcattr; - - ASSERT(!(pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))); - - VisRgn = IntSysCreateRectpRgn(0, 0, 0, 0); - if (VisRgn == NULL) - { - return FALSE; - } - - // Transform region into device co-ords - if (!REGION_LPTODP(dc, VisRgn, Rgn) || - IntGdiOffsetRgn(VisRgn, dc->ptlDCOrig.x, dc->ptlDCOrig.y) == ERROR) - { - REGION_Delete(VisRgn); - return FALSE; - } - - if (dc->prgnRao) - IntGdiCombineRgn(VisRgn, VisRgn, dc->prgnRao, RGN_AND); - - IntEngInitClipObj(&ClipRegion); - IntEngUpdateClipRegion(&ClipRegion, - VisRgn->rdh.nCount, - VisRgn->Buffer, - &VisRgn->rdh.rcBound ); - - BrushOrigin.x = pdcattr->ptlBrushOrigin.x; - BrushOrigin.y = pdcattr->ptlBrushOrigin.y; - psurf = dc->dclevel.pSurface; - /* FIXME: Handle psurf == NULL !!!! */ - - bRet = IntEngPaint(&psurf->SurfObj, - &ClipRegion.ClipObj, - &dc->eboFill.BrushObject, - &BrushOrigin, - 0xFFFF); // FIXME: Don't know what to put here - - REGION_Delete(VisRgn); - IntEngFreeClipResources(&ClipRegion); - - // Fill the region - return bRet; -} BOOL FASTCALL @@ -3204,8 +3217,10 @@ * are in the Winding active edge table. */ if (pWETE == pAET) { - pts->x = pAET->bres.minor_axis, pts->y = y; - pts++, iPts++; + pts->x = pAET->bres.minor_axis; + pts->y = y; + pts++; + iPts++; /* Send out the buffer */ if (iPts == NUMPTSTOBUFFER) @@ -3245,7 +3260,7 @@ REGION_FreeStorage(SLLBlock.next); REGION_PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, prgn); - for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;) + for (curPtBlock = FirstPtBlock.next; numFullPtBlocks-- > 0;) { tmpPtBlock = curPtBlock->next; ExFreePoolWithTag(curPtBlock, TAG_REGION); Modified: trunk/reactos/win32ss/gdi/ntgdi/region.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.h…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] Thu Dec 18 08:12:06 2014 @@ -38,6 +38,12 @@ VOID NTAPI REGION_vCleanup(PVOID ObjectBody); VOID FASTCALL REGION_Delete(PREGION); INT APIENTRY IntGdiGetRgnBox(HRGN, RECTL*); + +BOOL +FASTCALL +REGION_bXformRgn( + _Inout_ PREGION prgn, + _In_ PMATRIX pmx); BOOL FASTCALL
10 years
1
0
0
0
[tkreuzer] 65727: [WIN32K] - Move IntGdiReleaseRaoRgn and IntGdiReleaseVisRgn to cliprgn.c - Remove unused IntUpdateVisRectRgn
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Dec 18 08:12:01 2014 New Revision: 65727 URL:
http://svn.reactos.org/svn/reactos?rev=65727&view=rev
Log: [WIN32K] - Move IntGdiReleaseRaoRgn and IntGdiReleaseVisRgn to cliprgn.c - Remove unused IntUpdateVisRectRgn Modified: trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c trunk/reactos/win32ss/gdi/ntgdi/cliprgn.h trunk/reactos/win32ss/gdi/ntgdi/region.c trunk/reactos/win32ss/gdi/ntgdi/region.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] Thu Dec 18 08:12:01 2014 @@ -10,6 +10,32 @@ #define NDEBUG #include <debug.h> + +VOID +FASTCALL +IntGdiReleaseRaoRgn(PDC pDC) +{ + INT Index = GDI_HANDLE_GET_INDEX(pDC->BaseObject.hHmgr); + PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index]; + pDC->fs |= DC_FLAG_DIRTY_RAO; + Entry->Flags |= GDI_ENTRY_VALIDATE_VIS; + RECTL_vSetEmptyRect(&pDC->erclClip); + REGION_Delete(pDC->prgnRao); + pDC->prgnRao = NULL; +} + +VOID +FASTCALL +IntGdiReleaseVisRgn(PDC pDC) +{ + INT Index = GDI_HANDLE_GET_INDEX(pDC->BaseObject.hHmgr); + PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index]; + pDC->fs |= DC_FLAG_DIRTY_RAO; + Entry->Flags |= GDI_ENTRY_VALIDATE_VIS; + RECTL_vSetEmptyRect(&pDC->erclClip); + REGION_Delete(pDC->prgnVis); + pDC->prgnVis = prgnDefault; +} VOID FASTCALL 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] Thu Dec 18 08:12:01 2014 @@ -9,3 +9,5 @@ VOID FASTCALL GdiSelectVisRgn(HDC hdc, PREGION prgn); INT FASTCALL IntGdiExtSelectClipRgn (PDC dc, PREGION prgn, int fnMode); VOID FASTCALL CLIPPING_UpdateGCRegion(DC* Dc); +VOID FASTCALL IntGdiReleaseRaoRgn(PDC); +VOID FASTCALL IntGdiReleaseVisRgn(PDC); Modified: trunk/reactos/win32ss/gdi/ntgdi/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] Thu Dec 18 08:12:01 2014 @@ -2264,70 +2264,6 @@ GDIOBJ_vDeleteObject(&pRgn->BaseObject); } -VOID -FASTCALL -IntGdiReleaseRaoRgn(PDC pDC) -{ - INT Index = GDI_HANDLE_GET_INDEX(pDC->BaseObject.hHmgr); - PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index]; - pDC->fs |= DC_FLAG_DIRTY_RAO; - Entry->Flags |= GDI_ENTRY_VALIDATE_VIS; - RECTL_vSetEmptyRect(&pDC->erclClip); - REGION_Delete(pDC->prgnRao); - pDC->prgnRao = NULL; -} - -VOID -FASTCALL -IntGdiReleaseVisRgn(PDC pDC) -{ - INT Index = GDI_HANDLE_GET_INDEX(pDC->BaseObject.hHmgr); - PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index]; - pDC->fs |= DC_FLAG_DIRTY_RAO; - Entry->Flags |= GDI_ENTRY_VALIDATE_VIS; - RECTL_vSetEmptyRect(&pDC->erclClip); - REGION_Delete(pDC->prgnVis); - pDC->prgnVis = prgnDefault; -} - -VOID -FASTCALL -IntUpdateVisRectRgn(PDC pDC, PREGION pRgn) -{ - INT Index = GDI_HANDLE_GET_INDEX(pDC->BaseObject.hHmgr); - PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index]; - PDC_ATTR pdcattr; - RECTL rcl; - - if (Entry->Flags & GDI_ENTRY_VALIDATE_VIS) - { - pdcattr = pDC->pdcattr; - - pdcattr->VisRectRegion.iComplexity = REGION_Complexity(pRgn); - - if (pRgn && pdcattr->VisRectRegion.iComplexity != NULLREGION) - { - rcl.left = pRgn->rdh.rcBound.left; - rcl.top = pRgn->rdh.rcBound.top; - rcl.right = pRgn->rdh.rcBound.right; - rcl.bottom = pRgn->rdh.rcBound.bottom; - - rcl.left -= pDC->erclWindow.left; - rcl.top -= pDC->erclWindow.top; - rcl.right -= pDC->erclWindow.left; - rcl.bottom -= pDC->erclWindow.top; - } - else - { - RECTL_vSetEmptyRect(&rcl); - } - - pdcattr->VisRectRegion.Rect = rcl; - - Entry->Flags &= ~GDI_ENTRY_VALIDATE_VIS; - } -} - BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask) @@ -3617,6 +3553,8 @@ ULONG i; BOOL bRet = FALSE; + /// FIXME: need to use GDIOBJ_LockMultipleObjects + rgn1 = RGNOBJAPI_Lock(hSrcRgn1, NULL); if (rgn1 == NULL) return ERROR; Modified: trunk/reactos/win32ss/gdi/ntgdi/region.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.h…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] Thu Dec 18 08:12:01 2014 @@ -8,14 +8,18 @@ { /* Header for all gdi objects in the handle table. Do not (re)move this. */ - BASEOBJECT BaseObject; + BASEOBJECT BaseObject; PRGN_ATTR prgnattr; RGN_ATTR rgnattr; RGNDATAHEADER rdh; - RECTL *Buffer; + RECTL *Buffer; } REGION, *PREGION; +/* Globals ********************************************************************/ + +extern PREGION prgnDefault; +extern HRGN hrgnDefault; /* Functions ******************************************************************/ @@ -32,16 +36,8 @@ INT FASTCALL REGION_CropRegion(PREGION rgnDst, PREGION rgnSrc, const RECTL *rect); VOID FASTCALL REGION_SetRectRgn(PREGION pRgn, INT LeftRect, INT TopRect, INT RightRect, INT BottomRect); VOID NTAPI REGION_vCleanup(PVOID ObjectBody); - -extern PREGION prgnDefault; -extern HRGN hrgnDefault; - VOID FASTCALL REGION_Delete(PREGION); -VOID FASTCALL IntGdiReleaseRaoRgn(PDC); -VOID FASTCALL IntGdiReleaseVisRgn(PDC); - INT APIENTRY IntGdiGetRgnBox(HRGN, RECTL*); -BOOL FASTCALL IntGdiPaintRgn(PDC, PREGION ); BOOL FASTCALL @@ -97,3 +93,6 @@ { GDIOBJ_vUnlockObject(&prgn->BaseObject); } + +// FIXME: move this +BOOL FASTCALL IntGdiPaintRgn(PDC, PREGION );
10 years
1
0
0
0
[tkreuzer] 65726: [WIN32K] - Rename IntSetPolyPolygonRgn to REGION_SetPolyPolygonRgn - Implement GreCreatePolyPolygonRgn wrapper around it - Fix iMode usage in NtGdiPolyPolyDraw - Improve some vari...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Dec 18 08:11:56 2014 New Revision: 65726 URL:
http://svn.reactos.org/svn/reactos?rev=65726&view=rev
Log: [WIN32K] - Rename IntSetPolyPolygonRgn to REGION_SetPolyPolygonRgn - Implement GreCreatePolyPolygonRgn wrapper around it - Fix iMode usage in NtGdiPolyPolyDraw - Improve some variable naming Modified: trunk/reactos/win32ss/gdi/ntgdi/fillshap.c trunk/reactos/win32ss/gdi/ntgdi/path.c trunk/reactos/win32ss/gdi/ntgdi/region.c trunk/reactos/win32ss/gdi/ntgdi/region.h Modified: trunk/reactos/win32ss/gdi/ntgdi/fillshap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/fillshap…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/fillshap.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/fillshap.c [iso-8859-1] Thu Dec 18 08:11:56 2014 @@ -458,26 +458,13 @@ /* Special handling for GdiPolyPolyRgn */ if (iFunc == GdiPolyPolyRgn) { - PREGION Rgn; - HRGN hRgn; - - Rgn = REGION_AllocUserRgnWithHandle(0); - if (!Rgn) - { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - ExFreePoolWithTag(pTemp, TAG_SHAPE); - return 0; - } - hRgn = Rgn->BaseObject.hHmgr; - if (!IntSetPolyPolygonRgn(SafePoints, SafeCounts, Count, hDC ? 1 : 2, Rgn)) - { - /* EngSetLastError ? */ - GreDeleteObject(hRgn); - hRgn = NULL; - } - RGNOBJAPI_Unlock(Rgn); + INT iMode = (INT)(UINT_PTR)hDC; + HRGN hrgn; + + hrgn = GreCreatePolyPolygonRgn(SafePoints, SafeCounts, Count, iMode); + ExFreePoolWithTag(pTemp, TAG_SHAPE); - return (ULONG_PTR)hRgn; + return (ULONG_PTR)hrgn; } dc = DC_LockDc(hDC); Modified: trunk/reactos/win32ss/gdi/ntgdi/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/path.c?r…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/path.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/path.c [iso-8859-1] Thu Dec 18 08:11:56 2014 @@ -1280,11 +1280,11 @@ } /* Fill the region with the strokes */ - Ret = IntSetPolyPolygonRgn(pPath->pPoints, - pNumPointsInStroke, - numStrokes, - nPolyFillMode, - Rgn); + Ret = REGION_SetPolyPolygonRgn(Rgn, + pPath->pPoints, + pNumPointsInStroke, + numStrokes, + nPolyFillMode); /* Free memory for number-of-points-in-stroke array */ ExFreePoolWithTag(pNumPointsInStroke, TAG_PATH); Modified: trunk/reactos/win32ss/gdi/ntgdi/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] Thu Dec 18 08:11:56 2014 @@ -597,7 +597,7 @@ // FIXME: This function needs review and testing /*********************************************************************** - * REGION_CropAndOffsetRegion + * REGION_CropRegion */ INT FASTCALL @@ -3020,7 +3020,7 @@ } /*********************************************************************** - * REGION_CreateEDGE_TABLE + * REGION_CreateETandAET * * This routine creates the edge table for * scan converting polygons. @@ -3061,7 +3061,7 @@ INT iSLLBlock = 0; INT dy; - /* Initialize the Active Edge Table */ + /* Initialize the Active Edge Table */ AET->next = (EDGE_TABLE_ENTRY *)NULL; AET->back = (EDGE_TABLE_ENTRY *)NULL; AET->nextWETE = (EDGE_TABLE_ENTRY *)NULL; @@ -3132,12 +3132,12 @@ BOOL FASTCALL -IntSetPolyPolygonRgn( - POINT *Pts, - PULONG Count, - INT nbpolygons, - INT mode, - PREGION Rgn) +REGION_SetPolyPolygonRgn( + _Inout_ PREGION prgn, + _In_ const POINT *ppt, + _In_ const ULONG *pcPoints, + _In_ ULONG cPolygons, + _In_ INT iMode) { EDGE_TABLE_ENTRY *pAET; /* Active Edge Table */ INT y; /* Current scanline */ @@ -3153,33 +3153,35 @@ INT fixWAET = FALSE; POINTBLOCK FirstPtBlock, *curPtBlock; /* PtBlock buffers */ POINTBLOCK *tmpPtBlock; - INT numFullPtBlocks = 0; - INT poly, total; - - if (mode == 0 || mode > 2) return 0; + UINT numFullPtBlocks = 0; + UINT poly, total; + + /* Check if iMode is valid */ + if ((iMode != ALTERNATE) && (iMode != WINDING)) + return FALSE; /* Special case a rectangle */ - if (((nbpolygons == 1) && ((*Count == 4) || - ((*Count == 5) && (Pts[4].x == Pts[0].x) && (Pts[4].y == Pts[0].y)))) && - (((Pts[0].y == Pts[1].y) && - (Pts[1].x == Pts[2].x) && - (Pts[2].y == Pts[3].y) && - (Pts[3].x == Pts[0].x)) || - ((Pts[0].x == Pts[1].x) && - (Pts[1].y == Pts[2].y) && - (Pts[2].x == Pts[3].x) && - (Pts[3].y == Pts[0].y)))) - { - REGION_SetRectRgn(Rgn, - min(Pts[0].x, Pts[2].x), - min(Pts[0].y, Pts[2].y), - max(Pts[0].x, Pts[2].x), - max(Pts[0].y, Pts[2].y)); + if (((cPolygons == 1) && ((pcPoints[0] == 4) || + ((pcPoints[0] == 5) && (ppt[4].x == ppt[0].x) && (ppt[4].y == ppt[0].y)))) && + (((ppt[0].y == ppt[1].y) && + (ppt[1].x == ppt[2].x) && + (ppt[2].y == ppt[3].y) && + (ppt[3].x == ppt[0].x)) || + ((ppt[0].x == ppt[1].x) && + (ppt[1].y == ppt[2].y) && + (ppt[2].x == ppt[3].x) && + (ppt[3].y == ppt[0].y)))) + { + REGION_SetRectRgn(prgn, + min(ppt[0].x, ppt[2].x), + min(ppt[0].y, ppt[2].y), + max(ppt[0].x, ppt[2].x), + max(ppt[0].y, ppt[2].y)); return TRUE; } - for (poly = total = 0; poly < nbpolygons; poly++) - total += Count[poly]; + for (poly = total = 0; poly < cPolygons; poly++) + total += pcPoints[poly]; pETEs = ExAllocatePoolWithTag(PagedPool, sizeof(EDGE_TABLE_ENTRY) * total, @@ -3190,11 +3192,11 @@ } pts = FirstPtBlock.pts; - REGION_CreateETandAET(Count, nbpolygons, Pts, &ET, &AET, pETEs, &SLLBlock); + REGION_CreateETandAET(pcPoints, cPolygons, ppt, &ET, &AET, pETEs, &SLLBlock); pSLL = ET.scanlines.next; curPtBlock = &FirstPtBlock; - if (mode != WINDING) + if (iMode != WINDING) { /* For each scanline */ for (y = ET.ymin; y < ET.ymax; y++) @@ -3305,7 +3307,7 @@ } REGION_FreeStorage(SLLBlock.next); - REGION_PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, Rgn); + REGION_PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, prgn); for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;) { @@ -3316,6 +3318,42 @@ ExFreePoolWithTag(pETEs, TAG_REGION); return TRUE; +} + +HRGN +NTAPI +GreCreatePolyPolygonRgn( + _In_ const POINT *ppt, + _In_ const ULONG *pcPoints, + _In_ ULONG cPolygons, + _In_ INT iMode) +{ + PREGION prgn; + HRGN hrgn; + + /* Allocate a new region */ + prgn = REGION_AllocUserRgnWithHandle(0); + if (prgn == NULL) + { + EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); + return NULL; + } + + /* Call the internal function and check for success */ + if (REGION_SetPolyPolygonRgn(prgn, ppt, pcPoints, cPolygons, iMode)) + { + /* Success, get the handle and unlock the region */ + hrgn = prgn->BaseObject.hHmgr; + RGNOBJAPI_Unlock(prgn); + } + else + { + /* Failure, delete the region */ + REGION_Delete(prgn); + hrgn = NULL; + } + + return hrgn; } BOOL Modified: trunk/reactos/win32ss/gdi/ntgdi/region.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.h…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] Thu Dec 18 08:11:56 2014 @@ -42,7 +42,24 @@ INT APIENTRY IntGdiGetRgnBox(HRGN, RECTL*); BOOL FASTCALL IntGdiPaintRgn(PDC, PREGION ); -BOOL FASTCALL IntSetPolyPolygonRgn(PPOINT, PULONG, INT, INT, PREGION); + +BOOL +FASTCALL +REGION_SetPolyPolygonRgn( + _Inout_ PREGION prgn, + _In_ const POINT *ppt, + _In_ const ULONG *pcPoints, + _In_ ULONG cPolygons, + _In_ INT iMode); + +HRGN +NTAPI +GreCreatePolyPolygonRgn( + _In_ const POINT *ppt, + _In_ const ULONG *pcPoints, + _In_ ULONG cPolygons, + _In_ INT iMode); + INT FASTCALL IntGdiOffsetRgn(PREGION,INT,INT); BOOL FASTCALL IntRectInRegion(HRGN,LPRECTL);
10 years
1
0
0
0
[tkreuzer] 65725: [WIN32K] Rework GreCreateFrameRgn to return the new region. Implement the internal function REGION_bMakeFrameRegion doing the actual work. Fix frame calculation by moving the sour...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Dec 18 08:11:50 2014 New Revision: 65725 URL:
http://svn.reactos.org/svn/reactos?rev=65725&view=rev
Log: [WIN32K] Rework GreCreateFrameRgn to return the new region. Implement the internal function REGION_bMakeFrameRegion doing the actual work. Fix frame calculation by moving the source region diagonal instead of only horizontal and vertical, use IntGdiOffsetRgn instead of manually fiddling with the rectangles. Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c trunk/reactos/win32ss/gdi/ntgdi/region.c trunk/reactos/win32ss/gdi/ntgdi/region.h Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Thu Dec 18 08:11:50 2014 @@ -1048,31 +1048,25 @@ BOOL APIENTRY NtGdiFrameRgn( - HDC hDC, - HRGN hRgn, - HBRUSH hBrush, - INT Width, - INT Height) -{ - HRGN FrameRgn; - BOOL Ret; - - FrameRgn = NtGdiCreateRectRgn(0, 0, 0, 0); - if (FrameRgn == NULL) - { - return FALSE; - } - - if (!GreCreateFrameRgn(FrameRgn, hRgn, Width, Height)) - { - GreDeleteObject(FrameRgn); - return FALSE; - } - - Ret = NtGdiFillRgn(hDC, FrameRgn, hBrush); - - GreDeleteObject(FrameRgn); - return Ret; + _In_ HDC hdc, + _In_ HRGN hrgn, + _In_ HBRUSH hbrush, + _In_ INT xWidth, + _In_ INT yHeight) +{ + HRGN hrgnFrame; + BOOL bResult; + + hrgnFrame = GreCreateFrameRgn(hrgn, xWidth, yHeight); + if (hrgnFrame == NULL) + { + return FALSE; + } + + bResult = NtGdiFillRgn(hdc, hrgnFrame, hbrush); + + GreDeleteObject(hrgnFrame); + return bResult; } BOOL Modified: trunk/reactos/win32ss/gdi/ntgdi/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] Thu Dec 18 08:11:50 2014 @@ -1838,118 +1838,107 @@ return TRUE; } +static BOOL +REGION_bMakeFrameRegion( + _Inout_ PREGION prgnDest, + _In_ PREGION prgnSrc, + _In_ INT cx, + _In_ INT cy) +{ + + if (!REGION_NOT_EMPTY(prgnSrc)) + { + return FALSE; + } + + if (!REGION_CopyRegion(prgnDest, prgnSrc)) + { + return FALSE; + } + + if (REGION_Complexity(prgnSrc) == SIMPLEREGION) + { + if (!REGION_CreateSimpleFrameRgn(prgnDest, cx, cy)) + { + return FALSE; + } + } + else + { + /* Move the source region to the bottom-right */ + IntGdiOffsetRgn(prgnSrc, cx, cy); + + /* Intersect with the source region (this crops the top-left frame) */ + REGION_IntersectRegion(prgnDest, prgnDest, prgnSrc); + + /* Move the source region to the bottom-left */ + IntGdiOffsetRgn(prgnSrc, -2 * cx, 0); + + /* Intersect with the source region (this crops the top-right frame) */ + REGION_IntersectRegion(prgnDest, prgnDest, prgnSrc); + + /* Move the source region to the top-left */ + IntGdiOffsetRgn(prgnSrc, 0, -2 * cy); + + /* Intersect with the source region (this crops the bottom-right frame) */ + REGION_IntersectRegion(prgnDest, prgnDest, prgnSrc); + + /* Move the source region to the top-right */ + IntGdiOffsetRgn(prgnSrc, 2 * cx, 0); + + /* Intersect with the source region (this crops the bottom-left frame) */ + REGION_IntersectRegion(prgnDest, prgnDest, prgnSrc); + + /* Move the source region back to the original position */ + IntGdiOffsetRgn(prgnSrc, -cx, cy); + + /* Finally subtract the cropped region from the source */ + REGION_SubtractRegion(prgnDest, prgnSrc, prgnDest); + } + + return TRUE; +} + +HRGN FASTCALL GreCreateFrameRgn( - HRGN hDest, - HRGN hSrc, - INT x, - INT y) -{ - PREGION srcObj, destObj; - PRECTL rc; - ULONG i; - - srcObj = RGNOBJAPI_Lock(hSrc, NULL); - if (srcObj == NULL) - { + HRGN hrgn, + INT cx, + INT cy) +{ + PREGION prgnFrame, prgnSrc; + HRGN hrgnFrame; + + /* Allocate a new region */ + prgnFrame = REGION_AllocUserRgnWithHandle(1); + if (prgnFrame == NULL) + { + EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); + return NULL; + } + + /* Lock the source region */ + prgnSrc = RGNOBJAPI_Lock(hrgn, NULL); + if (prgnSrc == NULL) + { + REGION_Delete(prgnFrame); return FALSE; } - if (!REGION_NOT_EMPTY(srcObj)) - { - RGNOBJAPI_Unlock(srcObj); - return FALSE; - } - - destObj = RGNOBJAPI_Lock(hDest, NULL); - if (destObj == NULL) - { - RGNOBJAPI_Unlock(srcObj); - return FALSE; - } - - EMPTY_REGION(destObj); - if (!REGION_CopyRegion(destObj, srcObj)) - { - RGNOBJAPI_Unlock(destObj); - RGNOBJAPI_Unlock(srcObj); - return FALSE; - } - - if (REGION_Complexity(srcObj) == SIMPLEREGION) - { - if (!REGION_CreateSimpleFrameRgn(destObj, x, y)) - { - EMPTY_REGION(destObj); - RGNOBJAPI_Unlock(destObj); - RGNOBJAPI_Unlock(srcObj); - return FALSE; - } + if (REGION_bMakeFrameRegion(prgnFrame, prgnSrc, cx, cy)) + { + hrgnFrame = prgnFrame->BaseObject.hHmgr; + RGNOBJAPI_Unlock(prgnFrame); } else { - /* Original region moved to right */ - rc = srcObj->Buffer; - for (i = 0; i < srcObj->rdh.nCount; i++) - { - rc->left += x; - rc->right += x; - rc++; - } - - REGION_IntersectRegion(destObj, destObj, srcObj); - - /* Original region moved to left */ - rc = srcObj->Buffer; - for (i = 0; i < srcObj->rdh.nCount; i++) - { - rc->left -= 2 * x; - rc->right -= 2 * x; - rc++; - } - - REGION_IntersectRegion(destObj, destObj, srcObj); - - /* Original region moved down */ - rc = srcObj->Buffer; - for (i = 0; i < srcObj->rdh.nCount; i++) - { - rc->left += x; - rc->right += x; - rc->top += y; - rc->bottom += y; - rc++; - } - - REGION_IntersectRegion(destObj, destObj, srcObj); - - /* Original region moved up */ - rc = srcObj->Buffer; - for (i = 0; i < srcObj->rdh.nCount; i++) - { - rc->top -= 2 * y; - rc->bottom -= 2 * y; - rc++; - } - - REGION_IntersectRegion(destObj, destObj, srcObj); - - /* Restore the original region */ - rc = srcObj->Buffer; - for (i = 0; i < srcObj->rdh.nCount; i++) - { - rc->top += y; - rc->bottom += y; - rc++; - } - - REGION_SubtractRegion(destObj, srcObj, destObj); - } - - RGNOBJAPI_Unlock(destObj); - RGNOBJAPI_Unlock(srcObj); - return TRUE; + REGION_Delete(prgnFrame); + hrgnFrame = NULL; + } + + RGNOBJAPI_Unlock(prgnSrc); + return hrgnFrame; } Modified: trunk/reactos/win32ss/gdi/ntgdi/region.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.h…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] Thu Dec 18 08:11:50 2014 @@ -53,11 +53,10 @@ PREGION FASTCALL IntSysCreateRectpRgn(INT,INT,INT,INT); BOOL FASTCALL IntGdiSetRegionOwner(HRGN,DWORD); -BOOL +HRGN FASTCALL GreCreateFrameRgn( - HRGN hDest, - HRGN hSrc, + HRGN hrgn, INT x, INT y);
10 years
1
0
0
0
[tkreuzer] 65724: [WIN32K] - Move NtGdiFillRgn and NtGdiFrameRgn to bitblt.c - Remove unused NtGdiUnionRectWithRgn - Rename REGION_CreateFrameRgn to GreCreateFrameRgn
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Dec 18 08:11:42 2014 New Revision: 65724 URL:
http://svn.reactos.org/svn/reactos?rev=65724&view=rev
Log: [WIN32K] - Move NtGdiFillRgn and NtGdiFrameRgn to bitblt.c - Remove unused NtGdiUnionRectWithRgn - Rename REGION_CreateFrameRgn to GreCreateFrameRgn Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c trunk/reactos/win32ss/gdi/ntgdi/region.c trunk/reactos/win32ss/gdi/ntgdi/region.h Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Thu Dec 18 08:11:42 2014 @@ -1012,6 +1012,71 @@ BOOL APIENTRY +NtGdiFillRgn( + HDC hDC, + HRGN hRgn, + HBRUSH hBrush) +{ + HBRUSH oldhBrush; + PREGION rgn; + PRECTL r; + + rgn = RGNOBJAPI_Lock(hRgn, NULL); + if (rgn == NULL) + { + return FALSE; + } + + oldhBrush = NtGdiSelectBrush(hDC, hBrush); + if (oldhBrush == NULL) + { + RGNOBJAPI_Unlock(rgn); + return FALSE; + } + + for (r = rgn->Buffer; r < rgn->Buffer + rgn->rdh.nCount; r++) + { + NtGdiPatBlt(hDC, r->left, r->top, r->right - r->left, r->bottom - r->top, PATCOPY); + } + + RGNOBJAPI_Unlock(rgn); + NtGdiSelectBrush(hDC, oldhBrush); + + return TRUE; +} + +BOOL +APIENTRY +NtGdiFrameRgn( + HDC hDC, + HRGN hRgn, + HBRUSH hBrush, + INT Width, + INT Height) +{ + HRGN FrameRgn; + BOOL Ret; + + FrameRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + if (FrameRgn == NULL) + { + return FALSE; + } + + if (!GreCreateFrameRgn(FrameRgn, hRgn, Width, Height)) + { + GreDeleteObject(FrameRgn); + return FALSE; + } + + Ret = NtGdiFillRgn(hDC, FrameRgn, hBrush); + + GreDeleteObject(FrameRgn); + return Ret; +} + +BOOL +APIENTRY NtGdiInvertRgn( HDC hDC, HRGN hRgn) Modified: trunk/reactos/win32ss/gdi/ntgdi/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] Thu Dec 18 08:11:42 2014 @@ -1840,7 +1840,7 @@ BOOL FASTCALL -REGION_CreateFrameRgn( +GreCreateFrameRgn( HRGN hDest, HRGN hSrc, INT x, @@ -3745,72 +3745,6 @@ return hRgn; } -BOOL -APIENTRY -NtGdiFillRgn( - HDC hDC, - HRGN hRgn, - HBRUSH hBrush) -{ - HBRUSH oldhBrush; - PREGION rgn; - PRECTL r; - - rgn = RGNOBJAPI_Lock(hRgn, NULL); - if (rgn == NULL) - { - return FALSE; - } - - oldhBrush = NtGdiSelectBrush(hDC, hBrush); - if (oldhBrush == NULL) - { - RGNOBJAPI_Unlock(rgn); - return FALSE; - } - - for (r = rgn->Buffer; r < rgn->Buffer + rgn->rdh.nCount; r++) - { - NtGdiPatBlt(hDC, r->left, r->top, r->right - r->left, r->bottom - r->top, PATCOPY); - } - - RGNOBJAPI_Unlock(rgn); - NtGdiSelectBrush(hDC, oldhBrush); - - return TRUE; -} - -BOOL -APIENTRY -NtGdiFrameRgn( - HDC hDC, - HRGN hRgn, - HBRUSH hBrush, - INT Width, - INT Height) -{ - HRGN FrameRgn; - BOOL Ret; - - FrameRgn = NtGdiCreateRectRgn(0, 0, 0, 0); - if (FrameRgn == NULL) - { - return FALSE; - } - - if (!REGION_CreateFrameRgn(FrameRgn, hRgn, Width, Height)) - { - GreDeleteObject(FrameRgn); - return FALSE; - } - - Ret = NtGdiFillRgn(hDC, FrameRgn, hBrush); - - GreDeleteObject(FrameRgn); - return Ret; -} - - INT APIENTRY NtGdiGetRgnBox( @@ -3949,46 +3883,6 @@ RGNOBJAPI_Unlock(rgn); return TRUE; -} - -HRGN -APIENTRY -NtGdiUnionRectWithRgn( - HRGN hDest, - const RECTL *UnsafeRect) -{ - RECTL SafeRect = { 0 }; - PREGION Rgn; - NTSTATUS Status = STATUS_SUCCESS; - - Rgn = RGNOBJAPI_Lock(hDest, NULL); - if (Rgn == NULL) - { - EngSetLastError(ERROR_INVALID_HANDLE); - return NULL; - } - - _SEH2_TRY - { - ProbeForRead(UnsafeRect, sizeof(RECT), 1); - SafeRect = *UnsafeRect; - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END; - - if (!NT_SUCCESS(Status)) - { - RGNOBJAPI_Unlock(Rgn); - SetLastNtError(Status); - return NULL; - } - - REGION_UnionRectWithRgn(Rgn, &SafeRect); - RGNOBJAPI_Unlock(Rgn); - return hDest; } /*! Modified: trunk/reactos/win32ss/gdi/ntgdi/region.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.h…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] Thu Dec 18 08:11:42 2014 @@ -53,6 +53,14 @@ PREGION FASTCALL IntSysCreateRectpRgn(INT,INT,INT,INT); BOOL FASTCALL IntGdiSetRegionOwner(HRGN,DWORD); +BOOL +FASTCALL +GreCreateFrameRgn( + HRGN hDest, + HRGN hSrc, + INT x, + INT y); + #define IntSysCreateRectpRgnIndirect(prc) \ IntSysCreateRectpRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom)
10 years
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
23
...
39
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Results per page:
10
25
50
100
200