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
September 2016
----- 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
18 participants
342 discussions
Start a n
N
ew thread
[jimtabor] 72630: [NtGDI] - Remove unneeded return sets.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Fri Sep 9 15:12:04 2016 New Revision: 72630 URL:
http://svn.reactos.org/svn/reactos?rev=72630&view=rev
Log: [NtGDI] - Remove unneeded return sets. Modified: trunk/reactos/win32ss/gdi/ntgdi/path.c 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] Fri Sep 9 15:12:04 2016 @@ -2559,7 +2559,6 @@ if (pNewPath->state != PATH_Closed) { EngSetLastError(ERROR_CAN_NOT_COMPLETE); - ret = FALSE; } else if (pNewPath->numEntriesUsed) { @@ -2883,7 +2882,6 @@ if (pNewPath->state != PATH_Closed) { EngSetLastError(ERROR_CAN_NOT_COMPLETE); - bRet = FALSE; } else if (pNewPath->numEntriesUsed) { @@ -2941,7 +2939,6 @@ if (pNewPath->state != PATH_Closed) { EngSetLastError(ERROR_CAN_NOT_COMPLETE); - bRet = FALSE; } else bRet = PATH_StrokePath(pDc, pNewPath);
8 years, 3 months
1
0
0
0
[akhaldi] 72629: * Create a branch for USB experiments.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Sep 9 15:11:19 2016 New Revision: 72629 URL:
http://svn.reactos.org/svn/reactos?rev=72629&view=rev
Log: * Create a branch for USB experiments. Added: branches/usb-experiments/ (props changed) - copied from r72628, trunk/reactos/ Propchange: branches/usb-experiments/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Fri Sep 9 15:11:19 2016 @@ -0,0 +1,14 @@ +*.iso +makefile.auto +makefile-*.auto +config-*.rbuild +obj-* +output-* +reactos +reactos.* +RosBE-Logs +*.sln +*.ncb +*.suo +versionreport.xml +config.rbuild Propchange: branches/usb-experiments/ ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Fri Sep 9 15:11:19 2016 @@ -0,0 +1,23 @@ +/branches/GSoC_2011/GSoC_Network:51548 +/branches/GSoC_2011/GSoC_TcpIpDriver:51550 +/branches/GSoC_2011/TcpIpDriver:51551-53074,53076-53119 +/branches/GSoC_2016/USB:72366,72376 +/branches/GSoC_Network:51545-51546 +/branches/cmake-bringup:50484,50693,50719,51544-52564 +/branches/condrv_restructure:63104-65657 +/branches/header-work:45691-47721 +/branches/kd++:58883-58973 +/branches/kernel-fun/reactos:62291,62294,62301-62302,62304,62321-62322,62353,62531-62532,62853,64152,64173-64174,65253 +/branches/ntvdm:59241-63176 +/branches/reactos-yarotows:45219-46371,46373-48025,48027-49273 +/branches/reactx/reactos:49994-49995 +/branches/ros-amd64-bringup:36852 +/branches/ros-amd64-bringup/reactos:34711-34712,34741,34743,34770,34780-34782,34803,34812,34839,34842,34864,34870,34874,34877,34908-34909,34917,34965,35323-35324,35347-35348,35361,35436,35509,35515,35588,35655,35683,35739,35746,35762,35771,35777,35781,35789,35805,35823,35827,35902,35904-35906,35942,35947-35949,35952-35953,35966,36011-36013,36172,36360,36380,36388-36389,36393,36397,36443,36445,36475,36502-36503,36505,36570,36614,36852,36898-36899,36930,36936,36949,36951,36958,36961,36964,36969,36972,36987-36988,36990,36992,37019,37322-37323,37333-37334,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38092,38100,38148-38151,38264-38265,38268,38355,39151,39333,39335,39345,39639,40120,40122-40123,40125,40127-40128,40155,40247,40324,40608,40753,40926-40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41030,41044-41045,41047-41050,41052,41070,41082-41086,41097-41098,41101,41449,41479-41480,41483-41485,41499-41500,41502,41531,41536,41540,41546-41547,41549,43080,43426,43451,43454,43506,43566,43574,43598,43600-43602,43604-43605,43677,43682,43757,43775,43836,43838-43840,43852,43857-43858,43860,43905-43907,43952,43954,43965,43969,43979,43981,43992,44002,44036-44037,44039-44040,44044-44045,44053,44065,44095,44123,44143-44144,44205,44238,44257,44259,44294,44338-44339,44385,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44634,44639,44772,44818,45124,45126-45127,45430,46394,46404,46478,46511,46523-46524,46526,46534-46535,46537-46539,46589,46805,46868,47472,47846-47847,47878,47882 +/branches/ros-branch-0_3_15-lt2013:59059 +/branches/ros-csrss:57561-58762 +/branches/shell-experiments:61927-65494 +/branches/shell32_new-bringup:51893-53652,53661,53700 +/branches/tcp-rewrite-branch:48720,48840-48841,49424-49426,49454 +/branches/usb-bringup:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859 +/branches/usb-bringup-trunk:55019-55543,55548-55554,55556-55567 +/branches/wlan-bringup:54809-54998 Propchange: branches/usb-experiments/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
8 years, 3 months
1
0
0
0
[jimtabor] 72628: [NtGDI] - Fix remaining Path test results. Include Flat Path for Stroke Path. See CORE-4990.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Fri Sep 9 15:07:42 2016 New Revision: 72628 URL:
http://svn.reactos.org/svn/reactos?rev=72628&view=rev
Log: [NtGDI] - Fix remaining Path test results. Include Flat Path for Stroke Path. See CORE-4990. Modified: trunk/reactos/win32ss/gdi/ntgdi/path.c 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] Fri Sep 9 15:07:42 2016 @@ -436,8 +436,8 @@ /* In GM_COMPATIBLE, don't include bottom and right edges */ if (pdcattr->iGraphicsMode == GM_COMPATIBLE) { - if (corners[0].x == corners[1].x) {DPRINT1("PATH_CheckCorners GM_COMPATIBLE x\n"); return FALSE;} - if (corners[0].y == corners[1].y) {DPRINT1("PATH_CheckCorners GM_COMPATIBLE y\n"); return FALSE;} + if (corners[0].x == corners[1].x) return FALSE; + if (corners[0].y == corners[1].y) return FALSE; corners[1].x--; corners[1].y--; } @@ -773,7 +773,6 @@ if (!PATH_CheckCorners(dc, corners, x1, y1, x2, y2)) { - DPRINT1("PATH_Ellipse bad corners\n"); PATH_UnlockPath(pPath); return TRUE; } @@ -1466,13 +1465,6 @@ PREGION Rgn; PDC_ATTR pdcattr = dc->pdcattr; - if (pPath->state != PATH_Closed) - { - DPRINT("PFP : path not closed\n"); - EngSetLastError(ERROR_CAN_NOT_COMPLETE); - return FALSE; - } - /* Allocate a temporary region */ Rgn = IntSysCreateRectpRgn(0, 0, 0, 0); if (!Rgn) @@ -1559,9 +1551,6 @@ PDC_ATTR pdcattr = dc->pdcattr; DPRINT("Enter %s\n", __FUNCTION__); - - if (pPath->state != PATH_Closed) - return FALSE; /* Save the mapping mode info */ mapMode = pdcattr->iMapMode; @@ -2567,7 +2556,16 @@ pNewPath = PATH_FlattenPath(pPath); - ret = PATH_FillPath(dc, pNewPath); + if (pNewPath->state != PATH_Closed) + { + EngSetLastError(ERROR_CAN_NOT_COMPLETE); + ret = FALSE; + } + else if (pNewPath->numEntriesUsed) + { + ret = PATH_FillPath(dc, pNewPath); + } + else ret = TRUE; PATH_UnlockPath(pNewPath); PATH_Delete(pNewPath->BaseObject.hHmgr); @@ -2882,8 +2880,17 @@ pNewPath = PATH_FlattenPath(pPath); - bRet = PATH_FillPath(pDc, pNewPath); - if (bRet) bRet = PATH_StrokePath(pDc, pNewPath); + if (pNewPath->state != PATH_Closed) + { + EngSetLastError(ERROR_CAN_NOT_COMPLETE); + bRet = FALSE; + } + else if (pNewPath->numEntriesUsed) + { + bRet = PATH_FillPath(pDc, pNewPath); + if (bRet) bRet = PATH_StrokePath(pDc, pNewPath); + } + else bRet = TRUE; PATH_UnlockPath(pNewPath); PATH_Delete(pNewPath->BaseObject.hHmgr); @@ -2904,7 +2911,7 @@ { DC *pDc; PDC_ATTR pdcattr; - PPATH pPath; + PPATH pPath, pNewPath; BOOL bRet = FALSE; DPRINT("Enter %s\n", __FUNCTION__); @@ -2929,7 +2936,17 @@ if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY)) DC_vUpdateLineBrush(pDc); - bRet = PATH_StrokePath(pDc, pPath); + pNewPath = PATH_FlattenPath(pPath); + + if (pNewPath->state != PATH_Closed) + { + EngSetLastError(ERROR_CAN_NOT_COMPLETE); + bRet = FALSE; + } + else bRet = PATH_StrokePath(pDc, pNewPath); + + PATH_UnlockPath(pNewPath); + PATH_Delete(pNewPath->BaseObject.hHmgr); DC_vFinishBlit(pDc, NULL);
8 years, 3 months
1
0
0
0
[jimtabor] 72627: [NtGDI] - Fix Ellipse Path test results. See CORE-4990.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Fri Sep 9 14:30:44 2016 New Revision: 72627 URL:
http://svn.reactos.org/svn/reactos?rev=72627&view=rev
Log: [NtGDI] - Fix Ellipse Path test results. See CORE-4990. Modified: trunk/reactos/win32ss/gdi/ntgdi/fillshap.c 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] Fri Sep 9 14:30:44 2016 @@ -214,8 +214,6 @@ PBRUSH pFillBrushObj; BRUSH tmpFillBrushObj; - if ((Left == Right) || (Top == Bottom)) return TRUE; - dc = DC_LockDc(hDC); if (dc == NULL) { @@ -236,6 +234,15 @@ return ret; } + //// + //// Could this use PATH_CheckCorners ? + //// + if ((Left == Right) || (Top == Bottom)) + { + DC_UnlockDc(dc); + return TRUE; + } + if (Right < Left) { INT tmp = Right; Right = Left; Left = tmp; @@ -244,6 +251,7 @@ { INT tmp = Bottom; Bottom = Top; Top = tmp; } + //// pdcattr = dc->pdcattr;
8 years, 3 months
1
0
0
0
[dchapyshev] 72626: [WIN32K] - Add missed checks of size - Initialize cbSize field of structures * Fixes 6 tests for win32knt_apitest:NtUserSystemParametersInfo
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Thu Sep 8 22:46:42 2016 New Revision: 72626 URL:
http://svn.reactos.org/svn/reactos?rev=72626&view=rev
Log: [WIN32K] - Add missed checks of size - Initialize cbSize field of structures * Fixes 6 tests for win32knt_apitest:NtUserSystemParametersInfo Modified: trunk/reactos/win32ss/user/ntuser/sysparams.c Modified: trunk/reactos/win32ss/user/ntuser/sysparams.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/syspar…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/sysparams.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/sysparams.c [iso-8859-1] Thu Sep 8 22:46:42 2016 @@ -304,6 +304,14 @@ gspv.bScrSaverSecure = FALSE; #endif + gspv.accesstimeout.cbSize = sizeof(ACCESSTIMEOUT); + gspv.filterkeys.cbSize = sizeof(FILTERKEYS); + gspv.togglekeys.cbSize = sizeof(TOGGLEKEYS); + gspv.mousekeys.cbSize = sizeof(MOUSEKEYS); + gspv.stickykeys.cbSize = sizeof(STICKYKEYS); + gspv.serialkeys.cbSize = sizeof(SERIALKEYS); + gspv.soundsentry.cbSize = sizeof(SOUNDSENTRY); + /* Make sure we don't use broken values */ SpiFixupValues(); @@ -438,7 +446,7 @@ { Status = _SEH2_GetExceptionCode(); } - _SEH2_END + _SEH2_END; } else { @@ -880,7 +888,7 @@ if (fl & SPIF_UPDATEINIFILE) { SpiStoreFont(L"IconFont", &gspv.im.lfFont); - } + } return (UINT_PTR)KEY_METRIC; case SPI_SETDOUBLECLICKTIME: @@ -894,7 +902,7 @@ case SPI_SETFASTTASKSWITCH: /* According to Winetest this one is unimplemented */ - return 0; + return 1; case SPI_GETDRAGFULLWINDOWS: return SpiGetInt(pvParam, &gspv.bDragFullWindows, fl); @@ -1011,9 +1019,28 @@ break; case SPI_GETFILTERKEYS: + { + LPFILTERKEYS FilterKeys = (LPFILTERKEYS)pvParam; + + if (uiParam != 0 && uiParam != sizeof(FILTERKEYS)) + return 0; + + if (!FilterKeys || FilterKeys->cbSize != sizeof(FILTERKEYS)) + return 0; + return SpiGet(pvParam, &gspv.filterkeys, sizeof(FILTERKEYS), fl); + } case SPI_SETFILTERKEYS: + { + LPFILTERKEYS FilterKeys = (LPFILTERKEYS)pvParam; + + if (uiParam != 0 && uiParam != sizeof(FILTERKEYS)) + return 0; + + if (!FilterKeys || FilterKeys->cbSize != sizeof(FILTERKEYS)) + return 0; + if (!SpiSet(&gspv.filterkeys, pvParam, sizeof(FILTERKEYS), fl)) return 0; if (fl & SPIF_UPDATEINIFILE) @@ -1021,30 +1048,73 @@ // FIXME: What to do? } return (UINT_PTR)KEY_DESKTOP; + } case SPI_GETTOGGLEKEYS: + { + LPTOGGLEKEYS ToggleKeys = (LPTOGGLEKEYS)pvParam; + + if (uiParam != 0 && uiParam != sizeof(TOGGLEKEYS)) + return 0; + + if (!ToggleKeys || ToggleKeys->cbSize != sizeof(TOGGLEKEYS)) + return 0; + return SpiGet(pvParam, &gspv.togglekeys, sizeof(TOGGLEKEYS), fl); + } case SPI_SETTOGGLEKEYS: + { + LPTOGGLEKEYS ToggleKeys = (LPTOGGLEKEYS)pvParam; + + if (uiParam != 0 && uiParam != sizeof(TOGGLEKEYS)) + return 0; + + if (!ToggleKeys || ToggleKeys->cbSize != sizeof(TOGGLEKEYS)) + return 0; + if (!SpiSet(&gspv.togglekeys, pvParam, sizeof(TOGGLEKEYS), fl)) return 0; + if (fl & SPIF_UPDATEINIFILE) { // FIXME: What to do? } return (UINT_PTR)KEY_DESKTOP; + } case SPI_GETMOUSEKEYS: + { + LPMOUSEKEYS MouseKeys = (LPMOUSEKEYS)pvParam; + + if (uiParam != 0 && uiParam != sizeof(MOUSEKEYS)) + return 0; + + if (!MouseKeys || MouseKeys->cbSize != sizeof(MOUSEKEYS)) + return 0; + return SpiGet(pvParam, &gspv.mousekeys, sizeof(MOUSEKEYS), fl); + } case SPI_SETMOUSEKEYS: + { + LPMOUSEKEYS MouseKeys = (LPMOUSEKEYS)pvParam; + + if (uiParam != 0 && uiParam != sizeof(MOUSEKEYS)) + return 0; + + if (!MouseKeys || MouseKeys->cbSize != sizeof(MOUSEKEYS)) + return 0; + if (!SpiSet(&gspv.mousekeys, pvParam, sizeof(MOUSEKEYS), fl)) return 0; + if (fl & SPIF_UPDATEINIFILE) { // FIXME: What to do? } return (UINT_PTR)KEY_DESKTOP; + } case SPI_GETSHOWSOUNDS: return SpiGetInt(pvParam, &gspv.bShowSounds, fl); @@ -1053,56 +1123,140 @@ return SpiSetBool(&gspv.bShowSounds, uiParam, KEY_SHOWSNDS, VAL_ON, fl); case SPI_GETSTICKYKEYS: + { + LPSTICKYKEYS StickyKeys = (LPSTICKYKEYS)pvParam; + if (uiParam != 0 && uiParam != sizeof(STICKYKEYS)) return 0; + + if (!StickyKeys || StickyKeys->cbSize != sizeof(STICKYKEYS)) + return 0; + return SpiGetEx(pvParam, &gspv.stickykeys, sizeof(STICKYKEYS), fl); + } case SPI_SETSTICKYKEYS: + { + LPSTICKYKEYS StickyKeys = (LPSTICKYKEYS)pvParam; + + if (uiParam != 0 && uiParam != sizeof(STICKYKEYS)) + return 0; + + if (!StickyKeys || StickyKeys->cbSize != sizeof(STICKYKEYS)) + return 0; + if (!SpiSet(&gspv.stickykeys, pvParam, sizeof(STICKYKEYS), fl)) return 0; + if (fl & SPIF_UPDATEINIFILE) { // FIXME: What to do? } return (UINT_PTR)KEY_DESKTOP; + } case SPI_GETACCESSTIMEOUT: + { + LPACCESSTIMEOUT AccessTimeout = (LPACCESSTIMEOUT)pvParam; + if (uiParam != 0 && uiParam != sizeof(ACCESSTIMEOUT)) return 0; + + if (!AccessTimeout || AccessTimeout->cbSize != sizeof(ACCESSTIMEOUT)) + return 0; + return SpiGetEx(pvParam, &gspv.accesstimeout, sizeof(ACCESSTIMEOUT), fl); + } case SPI_SETACCESSTIMEOUT: + { + LPACCESSTIMEOUT AccessTimeout = (LPACCESSTIMEOUT)pvParam; + + if (uiParam != 0 && uiParam != sizeof(ACCESSTIMEOUT)) + { + return 0; + } + + if (!AccessTimeout || AccessTimeout->cbSize != sizeof(ACCESSTIMEOUT)) + { + return 0; + } + if (!SpiSet(&gspv.accesstimeout, pvParam, sizeof(ACCESSTIMEOUT), fl)) return 0; + if (fl & SPIF_UPDATEINIFILE) { // FIXME: What to do? } return (UINT_PTR)KEY_DESKTOP; + } case SPI_GETSERIALKEYS: + { + LPSERIALKEYS SerialKeys = (LPSERIALKEYS)pvParam; + + if (uiParam != 0 && uiParam != sizeof(SERIALKEYS)) + return 0; + + if (!SerialKeys || SerialKeys->cbSize != sizeof(SERIALKEYS)) + return 0; + return SpiGet(pvParam, &gspv.serialkeys, sizeof(SERIALKEYS), fl); + } case SPI_SETSERIALKEYS: + { + LPSERIALKEYS SerialKeys = (LPSERIALKEYS)pvParam; + + if (uiParam != 0 && uiParam != sizeof(SERIALKEYS)) + return 0; + + if (!SerialKeys || SerialKeys->cbSize != sizeof(SERIALKEYS)) + return 0; + if (!SpiSet(&gspv.serialkeys, pvParam, sizeof(SERIALKEYS), fl)) return 0; + if (fl & SPIF_UPDATEINIFILE) { // FIXME: What to do? } return (UINT_PTR)KEY_DESKTOP; + } case SPI_GETSOUNDSENTRY: + { + LPSOUNDSENTRY SoundsEntry = (LPSOUNDSENTRY)pvParam; + + if (uiParam != 0 && uiParam != sizeof(SOUNDSENTRY)) + return 0; + + if (!SoundsEntry || SoundsEntry->cbSize != sizeof(SOUNDSENTRY)) + return 0; + return SpiGet(pvParam, &gspv.soundsentry, sizeof(SOUNDSENTRY), fl); + } case SPI_SETSOUNDSENTRY: + { + LPSOUNDSENTRY SoundsEntry = (LPSOUNDSENTRY)pvParam; + + if (uiParam != 0 && uiParam != sizeof(SOUNDSENTRY)) + return 0; + + if (!SoundsEntry || SoundsEntry->cbSize != sizeof(SOUNDSENTRY)) + return 0; + if (!SpiSet(&gspv.soundsentry, pvParam, sizeof(SOUNDSENTRY), fl)) return 0; + if (fl & SPIF_UPDATEINIFILE) { // FIXME: What to do? } return (UINT_PTR)KEY_DESKTOP; + } case SPI_GETHIGHCONTRAST: return SpiGet(pvParam, &gspv.highcontrast, sizeof(HIGHCONTRAST), fl);
8 years, 3 months
1
0
0
0
[jimtabor] 72625: [NtGDI] - Fix Path issues, Sync/Port wine. See CORE-4990 (Fill Path painting?), CORE-9612 (Fixed) and CORE-11916 (Fixed). Maybe more. - Pen width might be related to another issue...
by jimtabor@svn.reactos.org
Author: jimtabor Date: Thu Sep 8 22:37:41 2016 New Revision: 72625 URL:
http://svn.reactos.org/svn/reactos?rev=72625&view=rev
Log: [NtGDI] - Fix Path issues, Sync/Port wine. See CORE-4990 (Fill Path painting?), CORE-9612 (Fixed) and CORE-11916 (Fixed). Maybe more. - Pen width might be related to another issue outside Path. See CORE-2527. Modified: trunk/reactos/win32ss/gdi/ntgdi/arc.c trunk/reactos/win32ss/gdi/ntgdi/dclife.c trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c trunk/reactos/win32ss/gdi/ntgdi/dcstate.c trunk/reactos/win32ss/gdi/ntgdi/path.c trunk/reactos/win32ss/gdi/ntgdi/path.h Modified: trunk/reactos/win32ss/gdi/ntgdi/arc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/arc.c?re…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/arc.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/arc.c [iso-8859-1] Thu Sep 8 22:37:41 2016 @@ -211,6 +211,7 @@ YStartArc, XEndArc, YEndArc, + 0, arctype); } Modified: trunk/reactos/win32ss/gdi/ntgdi/dclife.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dclife.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] Thu Sep 8 22:37:41 2016 @@ -387,8 +387,13 @@ /* Free CLIPOBJ resources */ IntEngFreeClipResources(&pdc->co); - PATH_Delete(pdc->dclevel.hPath); - + if (pdc->dclevel.hPath) + { + DPRINT("DC_vCleanup Path\n"); + PATH_Delete(pdc->dclevel.hPath); + pdc->dclevel.hPath = 0; + pdc->dclevel.flPath = 0; + } if(pdc->dclevel.pSurface) SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface); 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 Sep 8 22:37:41 2016 @@ -496,7 +496,7 @@ int Mode) { PREGION RgnPath; - PPATH pPath; + PPATH pPath, pNewPath; BOOL success = FALSE; PDC_ATTR pdcattr; PDC pdc; @@ -520,8 +520,8 @@ if (pPath->state != PATH_Closed) { EngSetLastError(ERROR_CAN_NOT_COMPLETE); - DC_UnlockDc(pdc); - return FALSE; + success = FALSE; + goto Exit; } /* Construct a region from the path */ @@ -533,24 +533,23 @@ return FALSE; } - if (!PATH_PathToRegion(pPath, pdcattr->jFillMode, RgnPath)) - { - EngSetLastError(ERROR_CAN_NOT_COMPLETE); - REGION_Delete(RgnPath); - DC_UnlockDc(pdc); - return FALSE; - } - - success = IntGdiExtSelectClipRgn(pdc, RgnPath, Mode) != ERROR; + pNewPath = PATH_FlattenPath(pPath); + + success = PATH_PathToRegion(pNewPath, pdcattr->jFillMode, RgnPath); + + PATH_UnlockPath(pNewPath); + PATH_Delete(pNewPath->BaseObject.hHmgr); + + if (success) success = IntGdiExtSelectClipRgn(pdc, RgnPath, Mode) != ERROR; + REGION_Delete(RgnPath); - /* Empty the path */ - if (success) - PATH_EmptyPath(pPath); - - /* FIXME: Should this function delete the path even if it failed? */ - +Exit: PATH_UnlockPath(pPath); + PATH_Delete(pdc->dclevel.hPath); + pdc->dclevel.flPath &= ~DCPATH_ACTIVE; + pdc->dclevel.hPath = NULL; + DC_UnlockDc(pdc); return success; Modified: trunk/reactos/win32ss/gdi/ntgdi/dcstate.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dcstate.…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dcstate.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dcstate.c [iso-8859-1] Thu Sep 8 22:37:41 2016 @@ -88,6 +88,18 @@ DC_vUpdateTextBrush(dc); } + // Remove Path and reset flags. + if (dc->dclevel.hPath) + { + DPRINT("Clean DC Remove Path\n"); + if (!PATH_Delete(dc->dclevel.hPath)) + { + DPRINT1("Failed to remove Path\n"); + } + dc->dclevel.hPath = 0; + dc->dclevel.flPath = 0; + } + /* DC_vCopyState frees the Clip rgn and the Meta rgn. Take care of the other ones * There is no need to clear prgnVis, as UserGetDC updates it immediately. */ if (dc->prgnRao) @@ -175,13 +187,9 @@ if (pdc->dctype == DCTYPE_MEMORY) DC_vSelectSurface(pdc, pdcSave->dclevel.pSurface); - // Restore Path by removing it, if the Save flag is set. - // BeginPath will takecare of the rest. - if (pdc->dclevel.hPath && pdc->dclevel.flPath & DCPATH_SAVE) + if (pdcSave->dclevel.hPath) { - PATH_Delete(pdc->dclevel.hPath); - pdc->dclevel.hPath = 0; - pdc->dclevel.flPath &= ~DCPATH_SAVE; + PATH_RestorePath( pdc, pdcSave ); } } @@ -294,10 +302,11 @@ DC_vSelectSurface(pdcSave, pdc->dclevel.pSurface); /* Copy path */ - /* FIXME: Why this way? */ - pdcSave->dclevel.hPath = pdc->dclevel.hPath; + if (pdc->dclevel.hPath) + { + PATH_SavePath( pdcSave, pdc ); + } pdcSave->dclevel.flPath = pdc->dclevel.flPath | DCPATH_SAVESTATE; - if (pdcSave->dclevel.hPath) pdcSave->dclevel.flPath |= DCPATH_SAVE; /* Set new dc as save dc */ pdcSave->dclevel.hdcSave = pdc->dclevel.hdcSave; 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 Sep 8 22:37:41 2016 @@ -19,12 +19,57 @@ #endif #define NUM_ENTRIES_INITIAL 16 /* Initial size of points / flags arrays */ + #define GROW_FACTOR_NUMER 2 /* Numerator of grow factor for the array */ #define GROW_FACTOR_DENOM 1 /* Denominator of grow factor */ + +#if DBG +static int PathCount = 0; +#endif /*********************************************************************** * Internal functions */ + +PPATH FASTCALL +PATH_CreatePath(int count) +{ + PPATH pPath = PATH_AllocPathWithHandle(); + + if (!pPath) + { + EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); + return NULL; + } + + DPRINT("CreatePath p 0x%p\n", pPath); + // Path handles are shared. Also due to recursion with in the same thread. + GDIOBJ_vUnlockObject((POBJ)pPath); // Unlock + pPath = PATH_LockPath(pPath->BaseObject.hHmgr); // Share Lock. + + /* Make sure that path is empty */ + PATH_EmptyPath(pPath); + + count = max( NUM_ENTRIES_INITIAL, count ); + + pPath->numEntriesAllocated = count; + + pPath->pPoints = (POINT *)ExAllocatePoolWithTag(PagedPool, count * sizeof(POINT), TAG_PATH); + RtlZeroMemory( pPath->pPoints, count * sizeof(POINT)); + pPath->pFlags = (BYTE *)ExAllocatePoolWithTag(PagedPool, count * sizeof(BYTE), TAG_PATH); + RtlZeroMemory( pPath->pFlags, count * sizeof(BYTE)); + + /* Initialize variables for new path */ + pPath->numEntriesUsed = 0; + pPath->newStroke = TRUE; + pPath->state = PATH_Open; + pPath->pos.x = pPath->pos.y = 0; +#if DBG + PathCount++; + DPRINT("Create Path %d\n",PathCount); +#endif + return pPath; +} /* PATH_DestroyGdiPath * @@ -50,6 +95,10 @@ if (!pPath) return FALSE; PATH_DestroyGdiPath(pPath); GDIOBJ_vDeleteObject(&pPath->BaseObject); +#if DBG + PathCount--; + DPRINT("Delete Path %d\n",PathCount); +#endif return TRUE; } @@ -82,97 +131,6 @@ XFORMOBJ_vInit(&xo, &pdc->pdcattr->mxDeviceToWorld); return XFORMOBJ_bApplyXform(&xo, XF_LTOL, count, (PPOINTL)ppt, (PPOINTL)ppt); -} - -/* PATH_FillPath - * - * - */ -BOOL -FASTCALL -PATH_FillPath( - PDC dc, - PPATH pPath) -{ - //INT mapMode, graphicsMode; - //SIZE ptViewportExt, ptWindowExt; - //POINTL ptViewportOrg, ptWindowOrg; - XFORM xform; - PREGION Rgn; - PDC_ATTR pdcattr = dc->pdcattr; - - if (pPath->state != PATH_Closed) - { - EngSetLastError(ERROR_CAN_NOT_COMPLETE); - return FALSE; - } - - /* Allocate a temporary region */ - Rgn = IntSysCreateRectpRgn(0, 0, 0, 0); - if (!Rgn) - { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - if (!PATH_PathToRegion(pPath, pdcattr->jFillMode, Rgn)) - { - /* EngSetLastError ? */ - REGION_Delete(Rgn); - return FALSE; - } - - /* Since PaintRgn interprets the region as being in logical coordinates - * but the points we store for the path are already in device - * coordinates, we have to set the mapping mode to MM_TEXT temporarily. - * Using SaveDC to save information about the mapping mode / world - * transform would be easier but would require more overhead, especially - * now that SaveDC saves the current path. - */ - - /* Save the information about the old mapping mode */ - //mapMode = pdcattr->iMapMode; - //ptViewportExt = pdcattr->szlViewportExt; - //ptViewportOrg = pdcattr->ptlViewportOrg; - //ptWindowExt = pdcattr->szlWindowExt; - //ptWindowOrg = pdcattr->ptlWindowOrg; - - /* Save world transform - * NB: The Windows documentation on world transforms would lead one to - * believe that this has to be done only in GM_ADVANCED; however, my - * tests show that resetting the graphics mode to GM_COMPATIBLE does - * not reset the world transform. - */ - MatrixS2XForm(&xform, &dc->pdcattr->mxWorldToPage); - - /* Set MM_TEXT */ -// IntGdiSetMapMode(dc, MM_TEXT); -// pdcattr->ptlViewportOrg.x = 0; -// pdcattr->ptlViewportOrg.y = 0; -// pdcattr->ptlWindowOrg.x = 0; -// pdcattr->ptlWindowOrg.y = 0; - - // graphicsMode = pdcattr->iGraphicsMode; -// pdcattr->iGraphicsMode = GM_ADVANCED; -// IntGdiModifyWorldTransform(dc, &xform, MWT_IDENTITY); -// pdcattr->iGraphicsMode = graphicsMode; - - /* Paint the region */ - IntGdiPaintRgn(dc, Rgn); - REGION_Delete(Rgn); - /* Restore the old mapping mode */ -// IntGdiSetMapMode(dc, mapMode); -// pdcattr->szlViewportExt = ptViewportExt; -// pdcattr->ptlViewportOrg = ptViewportOrg; -// pdcattr->szlWindowExt = ptWindowExt; -// pdcattr->ptlWindowOrg = ptWindowOrg; - - /* Go to GM_ADVANCED temporarily to restore the world transform */ - //graphicsMode = pdcattr->iGraphicsMode; -// pdcattr->iGraphicsMode = GM_ADVANCED; -// IntGdiModifyWorldTransform(dc, &xform, MWT_MAX+1); -// pdcattr->iGraphicsMode = graphicsMode; - return TRUE; } /* PATH_InitGdiPath @@ -216,14 +174,358 @@ return FALSE; /* Perform the copy operation */ - memcpy(pPathDest->pPoints, pPathSrc->pPoints, - sizeof(POINT)*pPathSrc->numEntriesUsed); - memcpy(pPathDest->pFlags, pPathSrc->pFlags, - sizeof(BYTE)*pPathSrc->numEntriesUsed); - + memcpy(pPathDest->pPoints, pPathSrc->pPoints, sizeof(POINT)*pPathSrc->numEntriesUsed); + memcpy(pPathDest->pFlags, pPathSrc->pFlags, sizeof(BYTE)*pPathSrc->numEntriesUsed); + + pPathDest->pos = pPathSrc->pos; pPathDest->state = pPathSrc->state; pPathDest->numEntriesUsed = pPathSrc->numEntriesUsed; pPathDest->newStroke = pPathSrc->newStroke; + return TRUE; +} + +BOOL PATH_SavePath( DC *dst, DC *src ) +{ + PPATH pdstPath, psrcPath = PATH_LockPath(src->dclevel.hPath); + DPRINT("PATH_SavePath\n"); + if (psrcPath) + { + DPRINT("PATH_SavePath 1\n"); + + pdstPath = PATH_CreatePath(psrcPath->numEntriesAllocated); + + dst->dclevel.flPath = src->dclevel.flPath; + + dst->dclevel.hPath = pdstPath->BaseObject.hHmgr; + + PATH_AssignGdiPath(pdstPath, psrcPath); + + PATH_UnlockPath(pdstPath); + PATH_UnlockPath(psrcPath); + } + return TRUE; +} + +BOOL PATH_RestorePath( DC *dst, DC *src ) +{ + DPRINT("PATH_RestorePath\n"); + + if (dst->dclevel.hPath == NULL) + { + PPATH pdstPath, psrcPath = PATH_LockPath(src->dclevel.hPath); + DPRINT("PATH_RestorePath 1\n"); + pdstPath = PATH_CreatePath(psrcPath->numEntriesAllocated); + dst->dclevel.flPath = src->dclevel.flPath; + dst->dclevel.hPath = pdstPath->BaseObject.hHmgr; + + PATH_AssignGdiPath(pdstPath, psrcPath); + + PATH_UnlockPath(pdstPath); + PATH_UnlockPath(psrcPath); + } + else + { + PPATH pdstPath, psrcPath = PATH_LockPath(src->dclevel.hPath); + pdstPath = PATH_LockPath(dst->dclevel.hPath); + DPRINT("PATH_RestorePath 2\n"); + dst->dclevel.flPath = src->dclevel.flPath & (DCPATH_CLOCKWISE|DCPATH_ACTIVE); + PATH_AssignGdiPath(pdstPath, psrcPath); + + PATH_UnlockPath(pdstPath); + PATH_UnlockPath(psrcPath); + } + return TRUE; +} + +/* PATH_EmptyPath + * + * Removes all entries from the path and sets the path state to PATH_Null. + */ +VOID +FASTCALL +PATH_EmptyPath(PPATH pPath) +{ + ASSERT(pPath != NULL); + + pPath->state = PATH_Null; + pPath->numEntriesUsed = 0; +} + +/* PATH_AddEntry + * + * Adds an entry to the path. For "flags", pass either PT_MOVETO, PT_LINETO + * or PT_BEZIERTO, optionally ORed with PT_CLOSEFIGURE. Returns TRUE if + * successful, FALSE otherwise (e.g. if not enough memory was available). + */ +BOOL +FASTCALL +PATH_AddEntry( + PPATH pPath, + const POINT *pPoint, + BYTE flags) +{ + ASSERT(pPath != NULL); + + /* FIXME: If newStroke is true, perhaps we want to check that we're + * getting a PT_MOVETO + */ + DPRINT("(%d,%d) - %d\n", pPoint->x, pPoint->y, flags); + + /* Reserve enough memory for an extra path entry */ + if (!PATH_ReserveEntries(pPath, pPath->numEntriesUsed + 1)) + return FALSE; + + /* Store information in path entry */ + pPath->pPoints[pPath->numEntriesUsed] = *pPoint; + pPath->pFlags[pPath->numEntriesUsed] = flags; + + /* Increment entry count */ + pPath->numEntriesUsed++; + + return TRUE; +} + +/* PATH_ReserveEntries + * + * Ensures that at least "numEntries" entries (for points and flags) have + * been allocated; allocates larger arrays and copies the existing entries + * to those arrays, if necessary. Returns TRUE if successful, else FALSE. + */ +BOOL +FASTCALL +PATH_ReserveEntries( + PPATH pPath, + INT numEntries) +{ + INT numEntriesToAllocate; + POINT *pPointsNew; + BYTE *pFlagsNew; + + ASSERT(pPath != NULL); + ASSERT(numEntries >= 0); + + /* Do we have to allocate more memory? */ + if (numEntries > pPath->numEntriesAllocated) + { + /* Find number of entries to allocate. We let the size of the array + * grow exponentially, since that will guarantee linear time + * complexity. */ + if (pPath->numEntriesAllocated) + { + numEntriesToAllocate = pPath->numEntriesAllocated; + while (numEntriesToAllocate < numEntries) + numEntriesToAllocate = numEntriesToAllocate * GROW_FACTOR_NUMER / GROW_FACTOR_DENOM; + } + else + numEntriesToAllocate = numEntries; + + /* Allocate new arrays */ + pPointsNew = (POINT *)ExAllocatePoolWithTag(PagedPool, numEntriesToAllocate * sizeof(POINT), TAG_PATH); + if (!pPointsNew) + return FALSE; + + pFlagsNew = (BYTE *)ExAllocatePoolWithTag(PagedPool, numEntriesToAllocate * sizeof(BYTE), TAG_PATH); + if (!pFlagsNew) + { + ExFreePoolWithTag(pPointsNew, TAG_PATH); + return FALSE; + } + + /* Copy old arrays to new arrays and discard old arrays */ + if (pPath->pPoints) + { + ASSERT(pPath->pFlags); + + memcpy(pPointsNew, pPath->pPoints, sizeof(POINT)*pPath->numEntriesUsed); + memcpy(pFlagsNew, pPath->pFlags, sizeof(BYTE)*pPath->numEntriesUsed); + + ExFreePoolWithTag(pPath->pPoints, TAG_PATH); + ExFreePoolWithTag(pPath->pFlags, TAG_PATH); + } + + pPath->pPoints = pPointsNew; + pPath->pFlags = pFlagsNew; + pPath->numEntriesAllocated = numEntriesToAllocate; + } + + return TRUE; +} + +/* PATH_ScaleNormalizedPoint + * + * Scales a normalized point (x, y) with respect to the box whose corners are + * passed in "corners". The point is stored in "*pPoint". The normalized + * coordinates (-1.0, -1.0) correspond to corners[0], the coordinates + * (1.0, 1.0) correspond to corners[1]. + */ +VOID +FASTCALL +PATH_ScaleNormalizedPoint( + FLOAT_POINT corners[], + double x, + double y, + POINT *pPoint) +{ + ASSERT(corners); + ASSERT(pPoint); + + pPoint->x = GDI_ROUND((double)corners[0].x + (double)(corners[1].x - corners[0].x) * 0.5 * (x + 1.0)); + pPoint->y = GDI_ROUND((double)corners[0].y + (double)(corners[1].y - corners[0].y) * 0.5 * (y + 1.0)); +} + +/* PATH_NormalizePoint + * + * Normalizes a point with respect to the box whose corners are passed in + * corners. The normalized coordinates are stored in *pX and *pY. + */ +VOID +FASTCALL +PATH_NormalizePoint( + FLOAT_POINT corners[], + const FLOAT_POINT *pPoint, + double *pX, + double *pY) +{ + ASSERT(corners); + ASSERT(pPoint); + ASSERT(pX); + ASSERT(pY); + + *pX = (double)(pPoint->x - corners[0].x) / (double)(corners[1].x - corners[0].x) * 2.0 - 1.0; + *pY = (double)(pPoint->y - corners[0].y) / (double)(corners[1].y - corners[0].y) * 2.0 - 1.0; +} + +/* PATH_CheckCorners + * + * Helper function for PATH_RoundRect() and PATH_Rectangle() + */ +BOOL +PATH_CheckCorners( + DC *dc, + POINT corners[], + INT x1, + INT y1, + INT x2, + INT y2) +{ + INT temp; + PDC_ATTR pdcattr = dc->pdcattr; + + /* Convert points to device coordinates */ + corners[0].x = x1; + corners[0].y = y1; + corners[1].x = x2; + corners[1].y = y2; + IntLPtoDP(dc, corners, 2); + + /* Make sure first corner is top left and second corner is bottom right */ + if (corners[0].x > corners[1].x) + { + temp = corners[0].x; + corners[0].x = corners[1].x; + corners[1].x = temp; + } + + if (corners[0].y > corners[1].y) + { + temp = corners[0].y; + corners[0].y = corners[1].y; + corners[1].y = temp; + } + + /* In GM_COMPATIBLE, don't include bottom and right edges */ + if (pdcattr->iGraphicsMode == GM_COMPATIBLE) + { + if (corners[0].x == corners[1].x) {DPRINT1("PATH_CheckCorners GM_COMPATIBLE x\n"); return FALSE;} + if (corners[0].y == corners[1].y) {DPRINT1("PATH_CheckCorners GM_COMPATIBLE y\n"); return FALSE;} + corners[1].x--; + corners[1].y--; + } + return TRUE; +} + +/* add a number of points, converting them to device coords */ +/* return a pointer to the first type byte so it can be fixed up if necessary */ +static BYTE *add_log_points( DC *dc, PPATH path, const POINT *points, + DWORD count, BYTE type ) +{ + BYTE *ret; + + if (!PATH_ReserveEntries( path, path->numEntriesUsed + count )) return NULL; + + ret = &path->pFlags[path->numEntriesUsed]; + memcpy( &path->pPoints[path->numEntriesUsed], points, count * sizeof(*points) ); + IntLPtoDP( dc, &path->pPoints[path->numEntriesUsed], count ); + memset( ret, type, count ); + path->numEntriesUsed += count; + return ret; +} + +/* add a number of points that are already in device coords */ +/* return a pointer to the first type byte so it can be fixed up if necessary */ +static BYTE *add_points( PPATH path, const POINT *points, DWORD count, BYTE type ) +{ + BYTE *ret; + + if (!PATH_ReserveEntries( path, path->numEntriesUsed + count )) return NULL; + + ret = &path->pFlags[path->numEntriesUsed]; + memcpy( &path->pPoints[path->numEntriesUsed], points, count * sizeof(*points) ); + memset( ret, type, count ); + path->numEntriesUsed += count; + return ret; +} + +/* reverse the order of an array of points */ +static void reverse_points( POINT *points, UINT count ) +{ + UINT i; + for (i = 0; i < count / 2; i++) + { + POINT pt = points[i]; + points[i] = points[count - i - 1]; + points[count - i - 1] = pt; + } +} + +/* start a new path stroke if necessary */ +static BOOL start_new_stroke( PPATH path ) +{ + if (!path->newStroke && path->numEntriesUsed && + !(path->pFlags[path->numEntriesUsed - 1] & PT_CLOSEFIGURE) && + path->pPoints[path->numEntriesUsed - 1].x == path->pos.x && + path->pPoints[path->numEntriesUsed - 1].y == path->pos.y) + return TRUE; + + path->newStroke = FALSE; + return add_points( path, &path->pos, 1, PT_MOVETO ) != NULL; +} + +/* set current position to the last point that was added to the path */ +static void update_current_pos( PPATH path ) +{ + assert( path->numEntriesUsed ); + path->pos = path->pPoints[path->numEntriesUsed - 1]; +} + +/* close the current figure */ +static void close_figure( PPATH path ) +{ + assert( path->numEntriesUsed ); + path->pFlags[path->numEntriesUsed - 1] |= PT_CLOSEFIGURE; +} + +/* add a number of points, starting a new stroke if necessary */ +static BOOL add_log_points_new_stroke( DC *dc, PPATH path, const POINT *points, + DWORD count, BYTE type ) +{ + if (!start_new_stroke( path )) return FALSE; + if (!add_log_points( dc, path, points, count, type )) return FALSE; + update_current_pos( path ); + + DPRINT("ALPNS : Pos X %d Y %d\n",path->pos.x, path->pos.y); + IntGdiMoveToEx(dc, path->pos.x, path->pos.y, NULL); + return TRUE; } @@ -236,22 +538,23 @@ BOOL FASTCALL PATH_MoveTo( - PDC dc) -{ - PPATH pPath = PATH_LockPath(dc->dclevel.hPath); + PDC dc, + PPATH pPath) +{ if (!pPath) return FALSE; - /* Check that path is open */ - if (pPath->state != PATH_Open) - { - PATH_UnlockPath(pPath); - /* FIXME: Do we have to call SetLastError? */ - return FALSE; - } - /* Start a new stroke */ - pPath->newStroke = TRUE; - PATH_UnlockPath(pPath); - return TRUE; + // GDI32 : Signal from user space of a change in position. + if (dc->pdcattr->ulDirty_ & DIRTY_STYLESTATE) + { + DPRINT("MoveTo has changed\n"); + pPath->newStroke = TRUE; + // Set position and clear the signal flag. + IntGetCurrentPositionEx(dc, &pPath->pos); + IntLPtoDP( dc, &pPath->pos, 1 ); + return TRUE; + } + + return FALSE; } /* PATH_LineTo @@ -275,33 +578,27 @@ pPath = PATH_LockPath(dc->dclevel.hPath); if (!pPath) return FALSE; - /* Check that path is open */ - if (pPath->state != PATH_Open) - { - PATH_UnlockPath(pPath); - return FALSE; - } - - /* Convert point to device coordinates */ point.x = x; point.y = y; - CoordLPtoDP(dc, &point); - - /* Add a PT_MOVETO if necessary */ - if (pPath->newStroke) - { - pPath->newStroke = FALSE; - IntGetCurrentPositionEx(dc, &pointCurPos); - CoordLPtoDP(dc, &pointCurPos); - if (!PATH_AddEntry(pPath, &pointCurPos, PT_MOVETO)) - { - PATH_UnlockPath(pPath); - return FALSE; - } - } - - /* Add a PT_LINETO entry */ - Ret = PATH_AddEntry(pPath, &point, PT_LINETO); + + // Coalesce a MoveTo point. + if ( !PATH_MoveTo(dc, pPath) ) + { + /* Add a PT_MOVETO if necessary */ + if (pPath->newStroke) + { + DPRINT("Line To : New Stroke\n"); + pPath->newStroke = FALSE; + IntGetCurrentPositionEx(dc, &pointCurPos); + CoordLPtoDP(dc, &pointCurPos); + if (!PATH_AddEntry(pPath, &pointCurPos, PT_MOVETO)) + { + PATH_UnlockPath(pPath); + return FALSE; + } + } + } + Ret = add_log_points_new_stroke( dc, pPath, &point, 1, PT_LINETO ); PATH_UnlockPath(pPath); return Ret; } @@ -321,75 +618,33 @@ INT y2) { PPATH pPath; - POINT corners[2], pointTemp; - INT temp; + POINT corners[2], points[4]; + BYTE *type; pPath = PATH_LockPath(dc->dclevel.hPath); if (!pPath) return FALSE; - /* Check that path is open */ - if (pPath->state != PATH_Open) + if (!PATH_CheckCorners(dc, corners, x1, y1, x2, y2)) { PATH_UnlockPath(pPath); - return FALSE; - } - - /* Convert points to device coordinates */ - corners[0].x = x1; - corners[0].y = y1; - corners[1].x = x2; - corners[1].y = y2; - IntLPtoDP(dc, corners, 2); - - /* Make sure first corner is top left and second corner is bottom right */ - if (corners[0].x > corners[1].x) - { - temp = corners[0].x; - corners[0].x = corners[1].x; - corners[1].x = temp; - } - if (corners[0].y > corners[1].y) - { - temp = corners[0].y; - corners[0].y = corners[1].y; - corners[1].y = temp; - } - - /* In GM_COMPATIBLE, don't include bottom and right edges */ - if (dc->pdcattr->iGraphicsMode == GM_COMPATIBLE) - { - corners[1].x--; - corners[1].y--; - } - - /* Close any previous figure */ - IntGdiCloseFigure(pPath); - - /* Add four points to the path */ - pointTemp.x = corners[1].x; - pointTemp.y = corners[0].y; - if (!PATH_AddEntry(pPath, &pointTemp, PT_MOVETO)) - { - PATH_UnlockPath(pPath); - return FALSE; - } - if (!PATH_AddEntry(pPath, corners, PT_LINETO)) - { - PATH_UnlockPath(pPath); - return FALSE; - } - pointTemp.x = corners[0].x; - pointTemp.y = corners[1].y; - if (!PATH_AddEntry(pPath, &pointTemp, PT_LINETO)) - { - PATH_UnlockPath(pPath); - return FALSE; - } - if (!PATH_AddEntry(pPath, corners + 1, PT_LINETO)) - { - PATH_UnlockPath(pPath); - return FALSE; - } + return TRUE; + } + + points[0].x = corners[1].x; + points[0].y = corners[0].y; + points[1] = corners[0]; + points[2].x = corners[0].x; + points[2].y = corners[1].y; + points[3] = corners[1]; + + if (dc->dclevel.flPath & DCPATH_CLOCKWISE) reverse_points( points, 4 ); + + if (!(type = add_points( pPath, points, 4, PT_LINETO ))) + { + PATH_UnlockPath(pPath); + return FALSE; + } + type[0] = PT_MOVETO; /* Close the rectangle figure */ IntGdiCloseFigure(pPath) ; @@ -402,9 +657,6 @@ * Should be called when a call to RoundRect is performed on a DC that has * an open path. Returns TRUE if successful, else FALSE. * - * FIXME: It adds the same entries to the path as windows does, but there - * is an error in the bezier drawing code so that there are small pixel-size - * gaps when the resulting path is drawn by StrokePath() */ BOOL FASTCALL @@ -417,78 +669,81 @@ INT ell_width, INT ell_height) { + const double factor = 0.55428475; /* 4 / 3 * (sqrt(2) - 1) */ PPATH pPath; - POINT corners[2], pointTemp; - FLOAT_POINT ellCorners[2]; + POINT corners[2], ellipse[2], points[16]; + BYTE *type; + double width, height; + + if (!ell_width || !ell_height) return PATH_Rectangle( dc, x1, y1, x2, y2 ); pPath = PATH_LockPath(dc->dclevel.hPath); if (!pPath) return FALSE; - /* Check that path is open */ - if (pPath->state != PATH_Open) + if (!PATH_CheckCorners(dc, corners, x1, y1, x2, y2)) { PATH_UnlockPath(pPath); - return FALSE; - } - - if (!PATH_CheckCorners(dc, corners, x1, y1, x2, y2)) - { - PATH_UnlockPath(pPath); - return FALSE; - } - - /* Add points to the roundrect path */ - ellCorners[0].x = corners[1].x - ell_width; - ellCorners[0].y = corners[0].y; - ellCorners[1].x = corners[1].x; - ellCorners[1].y = corners[0].y + ell_height; - if (!PATH_DoArcPart(pPath, ellCorners, 0, -M_PI_2, PT_MOVETO)) - { - PATH_UnlockPath(pPath); - return FALSE; - } - pointTemp.x = corners[0].x + ell_width / 2; - pointTemp.y = corners[0].y; - if (!PATH_AddEntry(pPath, &pointTemp, PT_LINETO)) - { - PATH_UnlockPath(pPath); - return FALSE; - } - ellCorners[0].x = corners[0].x; - ellCorners[1].x = corners[0].x + ell_width; - if (!PATH_DoArcPart(pPath, ellCorners, -M_PI_2, -M_PI, FALSE)) - { - PATH_UnlockPath(pPath); - return FALSE; - } - pointTemp.x = corners[0].x; - pointTemp.y = corners[1].y - ell_height / 2; - if (!PATH_AddEntry(pPath, &pointTemp, PT_LINETO)) - { - PATH_UnlockPath(pPath); - return FALSE; - } - ellCorners[0].y = corners[1].y - ell_height; - ellCorners[1].y = corners[1].y; - if (!PATH_DoArcPart(pPath, ellCorners, M_PI, M_PI_2, FALSE)) - { - PATH_UnlockPath(pPath); - return FALSE; - } - pointTemp.x = corners[1].x - ell_width / 2; - pointTemp.y = corners[1].y; - if (!PATH_AddEntry(pPath, &pointTemp, PT_LINETO)) - { - PATH_UnlockPath(pPath); - return FALSE; - } - ellCorners[0].x = corners[1].x - ell_width; - ellCorners[1].x = corners[1].x; - if (!PATH_DoArcPart(pPath, ellCorners, M_PI_2, 0, FALSE)) - { - PATH_UnlockPath(pPath); - return FALSE; - } + return TRUE; + } + + ellipse[0].x = ellipse[0].y = 0; + ellipse[1].x = ell_width; + ellipse[1].y = ell_height; + IntLPtoDP( dc, &ellipse, 2 ); + ell_width = min( abs( ellipse[1].x - ellipse[0].x ), corners[1].x - corners[0].x ); + ell_height = min( abs( ellipse[1].y - ellipse[0].y ), corners[1].y - corners[0].y ); + width = ell_width / 2.0; + height = ell_height / 2.0; + + /* starting point */ + points[0].x = corners[1].x; + points[0].y = corners[0].y + GDI_ROUND( height ); + /* first curve */ + points[1].x = corners[1].x; + points[1].y = corners[0].y + GDI_ROUND( height * (1 - factor) ); + points[2].x = corners[1].x - GDI_ROUND( width * (1 - factor) ); + points[2].y = corners[0].y; + points[3].x = corners[1].x - GDI_ROUND( width ); + points[3].y = corners[0].y; + /* horizontal line */ + points[4].x = corners[0].x + GDI_ROUND( width ); + points[4].y = corners[0].y; + /* second curve */ + points[5].x = corners[0].x + GDI_ROUND( width * (1 - factor) ); + points[5].y = corners[0].y; + points[6].x = corners[0].x; + points[6].y = corners[0].y + GDI_ROUND( height * (1 - factor) ); + points[7].x = corners[0].x; + points[7].y = corners[0].y + GDI_ROUND( height ); + /* vertical line */ + points[8].x = corners[0].x; + points[8].y = corners[1].y - GDI_ROUND( height ); + /* third curve */ + points[9].x = corners[0].x; + points[9].y = corners[1].y - GDI_ROUND( height * (1 - factor) ); + points[10].x = corners[0].x + GDI_ROUND( width * (1 - factor) ); + points[10].y = corners[1].y; + points[11].x = corners[0].x + GDI_ROUND( width ); + points[11].y = corners[1].y; + /* horizontal line */ + points[12].x = corners[1].x - GDI_ROUND( width ); + points[12].y = corners[1].y; + /* fourth curve */ + points[13].x = corners[1].x - GDI_ROUND( width * (1 - factor) ); + points[13].y = corners[1].y; + points[14].x = corners[1].x; + points[14].y = corners[1].y - GDI_ROUND( height * (1 - factor) ); + points[15].x = corners[1].x; + points[15].y = corners[1].y - GDI_ROUND( height ); + + if (dc->dclevel.flPath & DCPATH_CLOCKWISE) reverse_points( points, 16 ); + if (!(type = add_points( pPath, points, 16, PT_BEZIERTO ))) + { + PATH_UnlockPath(pPath); + return FALSE; + } + type[0] = PT_MOVETO; + type[4] = type[8] = type[12] = PT_LINETO; IntGdiCloseFigure(pPath); PATH_UnlockPath(pPath); @@ -497,9 +752,6 @@ /* PATH_Ellipse * - * Should be called when a call to Ellipse is performed on a DC that has - * an open path. This adds four Bezier splines representing the ellipse - * to the path. Returns TRUE if successful, else FALSE. */ BOOL FASTCALL @@ -510,18 +762,129 @@ INT x2, INT y2) { + const double factor = 0.55428475; /* 4 / 3 * (sqrt(2) - 1) */ PPATH pPath; - /* TODO: This should probably be revised to call PATH_AngleArc */ - /* (once it exists) */ - BOOL Ret = PATH_Arc(dc, x1, y1, x2, y2, x1, (y1 + y2) / 2, x1, (y1 + y2) / 2, GdiTypeArc); - if (Ret) - { - pPath = PATH_LockPath(dc->dclevel.hPath); - if (!pPath) return FALSE; - IntGdiCloseFigure(pPath); + POINT corners[2], points[13]; + BYTE *type; + double width, height; + + pPath = PATH_LockPath(dc->dclevel.hPath); + if (!pPath) return FALSE; + + if (!PATH_CheckCorners(dc, corners, x1, y1, x2, y2)) + { + DPRINT1("PATH_Ellipse bad corners\n"); PATH_UnlockPath(pPath); - } - return Ret; + return TRUE; + } + + width = (corners[1].x - corners[0].x) / 2.0; + height = (corners[1].y - corners[0].y) / 2.0; + + /* starting point */ + points[0].x = corners[1].x; + points[0].y = corners[0].y + GDI_ROUND( height ); + /* first curve */ + points[1].x = corners[1].x; + points[1].y = corners[0].y + GDI_ROUND( height * (1 - factor) ); + points[2].x = corners[1].x - GDI_ROUND( width * (1 - factor) ); + points[2].y = corners[0].y; + points[3].x = corners[0].x + GDI_ROUND( width ); + points[3].y = corners[0].y; + /* second curve */ + points[4].x = corners[0].x + GDI_ROUND( width * (1 - factor) ); + points[4].y = corners[0].y; + points[5].x = corners[0].x; + points[5].y = corners[0].y + GDI_ROUND( height * (1 - factor) ); + points[6].x = corners[0].x; + points[6].y = corners[0].y + GDI_ROUND( height ); + /* third curve */ + points[7].x = corners[0].x; + points[7].y = corners[1].y - GDI_ROUND( height * (1 - factor) ); + points[8].x = corners[0].x + GDI_ROUND( width * (1 - factor) ); + points[8].y = corners[1].y; + points[9].x = corners[0].x + GDI_ROUND( width ); + points[9].y = corners[1].y; + /* fourth curve */ + points[10].x = corners[1].x - GDI_ROUND( width * (1 - factor) ); + points[10].y = corners[1].y; + points[11].x = corners[1].x; + points[11].y = corners[1].y - GDI_ROUND( height * (1 - factor) ); + points[12].x = corners[1].x; + points[12].y = corners[1].y - GDI_ROUND( height ); + + if (dc->dclevel.flPath & DCPATH_CLOCKWISE) reverse_points( points, 13 ); + if (!(type = add_points( pPath, points, 13, PT_BEZIERTO ))) + { + DPRINT1("PATH_Ellipse No add\n"); + PATH_UnlockPath(pPath); + return FALSE; + } + type[0] = PT_MOVETO; + + IntGdiCloseFigure(pPath); + PATH_UnlockPath(pPath); + return TRUE; +} + +/* PATH_DoArcPart + * + * Creates a Bezier spline that corresponds to part of an arc and appends the + * corresponding points to the path. The start and end angles are passed in + * "angleStart" and "angleEnd"; these angles should span a quarter circle + * at most. If "startEntryType" is non-zero, an entry of that type for the first + * control point is added to the path; otherwise, it is assumed that the current + * position is equal to the first control point. + */ +BOOL +FASTCALL +PATH_DoArcPart( + PPATH pPath, + FLOAT_POINT corners[], + double angleStart, + double angleEnd, + BYTE startEntryType) +{ + double halfAngle, a; + double xNorm[4], yNorm[4]; + POINT points[4]; + BYTE *type; + int i, start; + + ASSERT(fabs(angleEnd - angleStart) <= M_PI_2); + + /* FIXME: Is there an easier way of computing this? */ + + /* Compute control points */ + halfAngle = (angleEnd - angleStart) / 2.0; + if (fabs(halfAngle) > 1e-8) + { + a = 4.0 / 3.0 * (1 - cos(halfAngle)) / sin(halfAngle); + xNorm[0] = cos(angleStart); + yNorm[0] = sin(angleStart); + xNorm[1] = xNorm[0] - a * yNorm[0]; + yNorm[1] = yNorm[0] + a * xNorm[0]; + xNorm[3] = cos(angleEnd); + yNorm[3] = sin(angleEnd); + xNorm[2] = xNorm[3] + a * yNorm[3]; + yNorm[2] = yNorm[3] - a * xNorm[3]; + } + else + for (i = 0; i < 4; i++) + { + xNorm[i] = cos(angleStart); + yNorm[i] = sin(angleStart); + } + + /* Add starting point to path if desired */ + start = !startEntryType; + + /* Add remaining control points */ + for (i = start; i < 4; i++) PATH_ScaleNormalizedPoint(corners, xNorm[i], yNorm[i], &points[i]); + if (!(type = add_points( pPath, points + start, 4 - start, PT_BEZIERTO ))) return FALSE; + if (!start) type[0] = startEntryType; + + return TRUE; } /* PATH_Arc @@ -546,6 +909,7 @@ INT yStart, INT xEnd, INT yEnd, + INT direction, INT lines) { double angleStart, angleEnd, angleStartQuadrant, angleEndQuadrant = 0.0; @@ -566,14 +930,10 @@ pPath = PATH_LockPath(dc->dclevel.hPath); if (!pPath) return FALSE; - clockwise = ((dc->dclevel.flPath & DCPATH_CLOCKWISE) != 0); - - /* Check that path is open */ - if (pPath->state != PATH_Open) - { - Ret = FALSE; - goto ArcExit; - } + if (direction) + clockwise = ((direction == AD_CLOCKWISE) !=0 ); + else + clockwise = ((dc->dclevel.flPath & DCPATH_CLOCKWISE) != 0); /* Check for zero height / width */ /* FIXME: Only in GM_COMPATIBLE? */ @@ -697,7 +1057,11 @@ } while (!end); - /* chord: close figure. pie: add line and close figure */ + if (lines == GdiTypeArcTo) + { + update_current_pos( pPath ); + } + else /* chord: close figure. pie: add line and close figure */ if (lines == GdiTypeChord) // 1 { IntGdiCloseFigure(pPath); @@ -721,9 +1085,8 @@ const POINT *pts, DWORD cbPoints) { - POINT pt; - ULONG i; PPATH pPath; + BOOL ret; ASSERT(dc); ASSERT(pts); @@ -732,35 +1095,10 @@ pPath = PATH_LockPath(dc->dclevel.hPath); if (!pPath) return FALSE; - /* Check that path is open */ - if (pPath->state != PATH_Open) - { - PATH_UnlockPath(pPath); - return FALSE; - } - - /* Add a PT_MOVETO if necessary */ - if (pPath->newStroke) - { - pPath->newStroke = FALSE; - IntGetCurrentPositionEx(dc, &pt); - CoordLPtoDP(dc, &pt); - if (!PATH_AddEntry(pPath, &pt, PT_MOVETO)) - { - PATH_UnlockPath(pPath); - return FALSE; - } - } - - for (i = 0; i < cbPoints; i++) - { - pt = pts[i]; - CoordLPtoDP(dc, &pt); - PATH_AddEntry(pPath, &pt, PT_BEZIERTO); - } + ret = add_log_points_new_stroke( dc, pPath, pts, cbPoints, PT_BEZIERTO ); PATH_UnlockPath(pPath); - return TRUE; + return ret; } BOOL @@ -770,9 +1108,8 @@ const POINT *pts, DWORD cbPoints) { - POINT pt; - ULONG i; PPATH pPath; + BYTE *type; ASSERT(dc); ASSERT(pts); @@ -781,19 +1118,10 @@ pPath = PATH_LockPath(dc->dclevel.hPath); if (!pPath) return FALSE; - /* Check that path is open */ - if (pPath->state != PATH_Open) - { - PATH_UnlockPath(pPath); - return FALSE; - } - - for (i = 0; i < cbPoints; i++) - { - pt = pts[i]; - CoordLPtoDP(dc, &pt); - PATH_AddEntry(pPath, &pt, (i == 0) ? PT_MOVETO : PT_BEZIERTO); - } + type = add_log_points( dc, pPath, pts, cbPoints, PT_BEZIERTO ); + if (!type) return FALSE; + + type[0] = PT_MOVETO; PATH_UnlockPath(pPath); return TRUE; @@ -808,10 +1136,8 @@ DWORD cbPoints) { PPATH pPath; - POINT lastmove, orig_pos; - ULONG i; - PDC_ATTR pdcattr; - BOOL State = FALSE, Ret = FALSE; + POINT orig_pos, cur_pos; + ULONG i, lastmove = 0; pPath = PATH_LockPath(dc->dclevel.hPath); if (!pPath) return FALSE; @@ -822,116 +1148,64 @@ return FALSE; } - pdcattr = dc->pdcattr; - - lastmove.x = orig_pos.x = pdcattr->ptlCurrent.x; - lastmove.y = orig_pos.y = pdcattr->ptlCurrent.y; - - i = pPath->numEntriesUsed; - - while (i != 0) - { - i--; - if (pPath->pFlags[i] == PT_MOVETO) - { - lastmove.x = pPath->pPoints[i].x; - lastmove.y = pPath->pPoints[i].y; - if (!GdiPathDPtoLP(dc, &lastmove, 1)) + for (i = 0; i < pPath->numEntriesUsed; i++) if (pPath->pFlags[i] == PT_MOVETO) lastmove = i; + orig_pos = pPath->pos; + + IntGetCurrentPositionEx(dc, &cur_pos); + + DPRINT("PPD : Current pos X %d Y %d\n",pPath->pos.x, pPath->pos.y); + DPRINT("PPD : last %d pos X %d Y %d\n",lastmove, pPath->pPoints[lastmove].x, pPath->pPoints[lastmove].y); + + + for(i = 0; i < cbPoints; i++) + { + switch (types[i]) + { + case PT_MOVETO: + pPath->newStroke = TRUE; + pPath->pos = pts[i]; + IntLPtoDP( dc, &pPath->pos, 1); + lastmove = pPath->numEntriesUsed; + break; + case PT_LINETO: + case PT_LINETO | PT_CLOSEFIGURE: + if (!add_log_points_new_stroke( dc, pPath, &pts[i], 1, PT_LINETO )) { - PATH_UnlockPath(pPath); - return FALSE; + PATH_UnlockPath(pPath); + return FALSE; } break; - } - } - - for (i = 0; i < cbPoints; i++) - { - if (types[i] == PT_MOVETO) - { - pPath->newStroke = TRUE; - lastmove.x = pts[i].x; - lastmove.y = pts[i].y; - } - else if ((types[i] & ~PT_CLOSEFIGURE) == PT_LINETO) - { - PATH_LineTo(dc, pts[i].x, pts[i].y); - } - else if (types[i] == PT_BEZIERTO) - { - if (!((i + 2 < cbPoints) && (types[i + 1] == PT_BEZIERTO) - && ((types[i + 2] & ~PT_CLOSEFIGURE) == PT_BEZIERTO))) - goto err; - PATH_PolyBezierTo(dc, &(pts[i]), 3); - i += 2; - } - else - goto err; - - pdcattr->ptlCurrent.x = pts[i].x; - pdcattr->ptlCurrent.y = pts[i].y; - State = TRUE; + case PT_BEZIERTO: + if ((i + 2 < cbPoints) && (types[i + 1] == PT_BEZIERTO) && + (types[i + 2] & ~PT_CLOSEFIGURE) == PT_BEZIERTO) + { + if (!add_log_points_new_stroke( dc, pPath, &pts[i], 3, PT_BEZIERTO )) + { + PATH_UnlockPath(pPath); + return FALSE; + } + i += 2; + break; + } + /* fall through */ + default: + /* restore original position */ + pPath->pos = orig_pos; + + DPRINT("PPD Bad : pos X %d Y %d\n",pPath->pos.x, pPath->pos.y); + + IntGdiMoveToEx(dc, cur_pos.x, cur_pos.y, NULL); + + PATH_UnlockPath(pPath); + return FALSE; + } if (types[i] & PT_CLOSEFIGURE) { - pPath->pFlags[pPath->numEntriesUsed - 1] |= PT_CLOSEFIGURE; - pPath->newStroke = TRUE; - pdcattr->ptlCurrent.x = lastmove.x; - pdcattr->ptlCurrent.y = lastmove.y; - State = TRUE; - } - } - Ret = TRUE; - goto Exit; - -err: - if ((pdcattr->ptlCurrent.x != orig_pos.x) || (pdcattr->ptlCurrent.y != orig_pos.y)) - { - pPath->newStroke = TRUE; - pdcattr->ptlCurrent.x = orig_pos.x; - pdcattr->ptlCurrent.y = orig_pos.y; - State = TRUE; - } -Exit: - if (State) // State change? - { - pdcattr->ptfxCurrent = pdcattr->ptlCurrent; - CoordLPtoDP(dc, &pdcattr->ptfxCurrent); // Update fx - pdcattr->ulDirty_ &= ~(DIRTY_PTLCURRENT | DIRTY_PTFXCURRENT | DIRTY_STYLESTATE); - } - PATH_UnlockPath(pPath); - return Ret; -} - -BOOL -FASTCALL -PATH_Polyline( - PDC dc, - const POINT *pts, - DWORD cbPoints) -{ - POINT pt; - ULONG i; - PPATH pPath; - - ASSERT(dc); - ASSERT(pts); - ASSERT(cbPoints); - - pPath = PATH_LockPath(dc->dclevel.hPath); - if (!pPath) return FALSE; - - /* Check that path is open */ - if (pPath->state != PATH_Open) - { - PATH_UnlockPath(pPath); - return FALSE; - } - for (i = 0; i < cbPoints; i++) - { - pt = pts[i]; - CoordLPtoDP(dc, &pt); - PATH_AddEntry(pPath, &pt, (i == 0) ? PT_MOVETO : PT_LINETO); + close_figure( pPath ); + pPath->pos = pPath->pPoints[lastmove]; + DPRINT("PPD close : pos X %d Y %d\n",pPath->pos.x, pPath->pos.y); + } } PATH_UnlockPath(pPath); return TRUE; @@ -944,83 +1218,21 @@ const POINT *pts, DWORD cbPoints) { - POINT pt; - ULONG i; PPATH pPath; + BOOL ret; ASSERT(dc); ASSERT(pts); ASSERT(cbPoints); + if (cbPoints < 1) return FALSE; + pPath = PATH_LockPath(dc->dclevel.hPath); if (!pPath) return FALSE; - /* Check that path is open */ - if (pPath->state != PATH_Open) - { - PATH_UnlockPath(pPath); - return FALSE; - } - - /* Add a PT_MOVETO if necessary */ - if (pPath->newStroke) - { - pPath->newStroke = FALSE; - IntGetCurrentPositionEx(dc, &pt); - CoordLPtoDP(dc, &pt); - if (!PATH_AddEntry(pPath, &pt, PT_MOVETO)) - { - PATH_UnlockPath(pPath); - return FALSE; - } - } - - for (i = 0; i < cbPoints; i++) - { - pt = pts[i]; - CoordLPtoDP(dc, &pt); - PATH_AddEntry(pPath, &pt, PT_LINETO); - } + ret = add_log_points_new_stroke( dc, pPath, pts, cbPoints, PT_LINETO ); PATH_UnlockPath(pPath); - return TRUE; -} - - -BOOL -FASTCALL -PATH_Polygon( - PDC dc, - const POINT *pts, - DWORD cbPoints) -{ - POINT pt; - ULONG i; - PPATH pPath; - - ASSERT(dc); - ASSERT(pts); - - pPath = PATH_LockPath(dc->dclevel.hPath); - if (!pPath) return FALSE; - - /* Check that path is open */ - if (pPath->state != PATH_Open) - { - PATH_UnlockPath(pPath); - return FALSE; - } - - for (i = 0; i < cbPoints; i++) - { - pt = pts[i]; - CoordLPtoDP(dc, &pt); - PATH_AddEntry(pPath, &pt, (i == 0) ? PT_MOVETO : - ((i == cbPoints - 1) ? PT_LINETO | PT_CLOSEFIGURE : - PT_LINETO)); - } - - PATH_UnlockPath(pPath); - return TRUE; + return ret; } BOOL @@ -1031,8 +1243,8 @@ const INT* counts, UINT polygons) { - POINT pt, startpt; - ULONG poly, point, i; + UINT poly, count; + BYTE *type; PPATH pPath; ASSERT(dc); @@ -1040,30 +1252,35 @@ ASSERT(counts); ASSERT(polygons); + if (!polygons) return FALSE; + pPath = PATH_LockPath(dc->dclevel.hPath); if (!pPath) return FALSE; - /* Check that path is open */ - if (pPath->state != PATH_Open) - { - PATH_UnlockPath(pPath); - return FALSE; - } - - for (i = 0, poly = 0; poly < polygons; poly++) - { - for (point = 0; point < (ULONG) counts[poly]; point++, i++) - { - pt = pts[i]; - CoordLPtoDP(dc, &pt); - if (point == 0) startpt = pt; - PATH_AddEntry(pPath, &pt, (point == 0) ? PT_MOVETO : PT_LINETO); - } - - /* Win98 adds an extra line to close the figure for some reason */ - PATH_AddEntry(pPath, &startpt, PT_LINETO | PT_CLOSEFIGURE); - } - + + for (poly = count = 0; poly < polygons; poly++) + { + if (counts[poly] < 2) + { + PATH_UnlockPath(pPath); + return FALSE; + } + count += counts[poly]; + } + + type = add_log_points( dc, pPath, pts, count, PT_LINETO ); + if (!type) + { + PATH_UnlockPath(pPath); + return FALSE; + } + + /* make the first point of each polyline a PT_MOVETO, and close the last one */ + for (poly = 0; poly < polygons; type += counts[poly++]) + { + type[0] = PT_MOVETO; + type[counts[poly] - 1] = PT_LINETO | PT_CLOSEFIGURE; + } PATH_UnlockPath(pPath); return TRUE; } @@ -1086,13 +1303,9 @@ ASSERT(polylines); pPath = PATH_LockPath(dc->dclevel.hPath); - if (!pPath) return FALSE; - - /* Check that path is open */ - if (pPath->state != PATH_Open) - { - PATH_UnlockPath(pPath); - return FALSE; + if (!pPath) + { + return FALSE; } for (i = 0, poly = 0; poly < polylines; poly++) @@ -1104,61 +1317,10 @@ PATH_AddEntry(pPath, &pt, (point == 0) ? PT_MOVETO : PT_LINETO); } } - + DPRINT("PATH_PolyPolyline end count %d\n",pPath->numEntriesUsed); PATH_UnlockPath(pPath); return TRUE; } - - -/* PATH_CheckCorners - * - * Helper function for PATH_RoundRect() and PATH_Rectangle() - */ -BOOL -PATH_CheckCorners( - DC *dc, - POINT corners[], - INT x1, - INT y1, - INT x2, - INT y2) -{ - INT temp; - PDC_ATTR pdcattr = dc->pdcattr; - - /* Convert points to device coordinates */ - corners[0].x = x1; - corners[0].y = y1; - corners[1].x = x2; - corners[1].y = y2; - CoordLPtoDP(dc, &corners[0]); - CoordLPtoDP(dc, &corners[1]); - - /* Make sure first corner is top left and second corner is bottom right */ - if (corners[0].x > corners[1].x) - { - temp = corners[0].x; - corners[0].x = corners[1].x; - corners[1].x = temp; - } - - if (corners[0].y > corners[1].y) - { - temp = corners[0].y; - corners[0].y = corners[1].y; - corners[1].y = temp; - } - - /* In GM_COMPATIBLE, don't include bottom and right edges */ - if (pdcattr->iGraphicsMode == GM_COMPATIBLE) - { - corners[1].x--; - corners[1].y--; - } - - return TRUE; -} - /* PATH_AddFlatBezier * @@ -1171,16 +1333,20 @@ BOOL closed) { POINT *pts; + BOOL ret = FALSE; INT no, i; pts = GDI_Bezier(pt, 4, &no); if (!pts) return FALSE; for (i = 1; i < no; i++) - PATH_AddEntry(pPath, &pts[i], (i == no - 1 && closed) ? PT_LINETO | PT_CLOSEFIGURE : PT_LINETO); + { + if (!(ret = PATH_AddEntry(pPath, &pts[i], (i == no - 1 && closed) ? PT_LINETO | PT_CLOSEFIGURE : PT_LINETO))) + break; + } ExFreePoolWithTag(pts, TAG_BEZIER); - return TRUE; + return ret; } /* PATH_FlattenPath @@ -1188,349 +1354,193 @@ * Replaces Beziers with line segments * */ -BOOL +PPATH FASTCALL PATH_FlattenPath(PPATH pPath) { - PATH newPath; + PPATH newPath; INT srcpt; - - RtlZeroMemory(&newPath, sizeof(newPath)); - newPath.state = PATH_Open; + DPRINT("PATH_FlattenPath\n"); + if (!(newPath = PATH_CreatePath(pPath->numEntriesUsed))) return NULL; + for (srcpt = 0; srcpt < pPath->numEntriesUsed; srcpt++) { switch(pPath->pFlags[srcpt] & ~PT_CLOSEFIGURE) { case PT_MOVETO: case PT_LINETO: - PATH_AddEntry(&newPath, &pPath->pPoints[srcpt], pPath->pFlags[srcpt]); + if (!PATH_AddEntry(newPath, &pPath->pPoints[srcpt], pPath->pFlags[srcpt])) + { + PATH_UnlockPath(newPath); + PATH_Delete(newPath->BaseObject.hHmgr); + return NULL; + } break; case PT_BEZIERTO: - PATH_AddFlatBezier(&newPath, &pPath->pPoints[srcpt - 1], pPath->pFlags[srcpt + 2] & PT_CLOSEFIGURE); + if(!PATH_AddFlatBezier(newPath, &pPath->pPoints[srcpt - 1], pPath->pFlags[srcpt + 2] & PT_CLOSEFIGURE)) + { + PATH_UnlockPath(newPath); + PATH_Delete(newPath->BaseObject.hHmgr); + return NULL; + } srcpt += 2; break; } } - - newPath.state = PATH_Closed; - PATH_AssignGdiPath(pPath, &newPath); - PATH_EmptyPath(&newPath); - return TRUE; -} - + DPRINT("PATH_FlattenPath good\n"); + newPath->state = pPath->state; + return newPath; +} /* PATH_PathToRegion * * Creates a region from the specified path using the specified polygon * filling mode. The path is left unchanged. A handle to the region that - * was created is stored in *pHrgn. If successful, TRUE is returned; if an - * error occurs, SetLastError is called with the appropriate value and - * FALSE is returned. + * was created is stored in *pHrgn. */ BOOL FASTCALL PATH_PathToRegion( PPATH pPath, - INT nPolyFillMode, + INT Mode, PREGION Rgn) { - int numStrokes, iStroke, i; - PULONG pNumPointsInStroke; - BOOL Ret; - - ASSERT(pPath != NULL); - ASSERT(Rgn != NULL); - - PATH_FlattenPath(pPath); - - /* First pass: Find out how many strokes there are in the path */ - /* FIXME: We could eliminate this with some bookkeeping in GdiPath */ - numStrokes = 0; - for (i = 0; i < pPath->numEntriesUsed; i++) - if ((pPath->pFlags[i] & ~PT_CLOSEFIGURE) == PT_MOVETO) - numStrokes++; - - if (numStrokes == 0) - { - DPRINT1("numStrokes is 0\n"); - return FALSE; - } - - /* Allocate memory for number-of-points-in-stroke array */ - pNumPointsInStroke = ExAllocatePoolWithTag(PagedPool, sizeof(ULONG) * numStrokes, TAG_PATH); - if (!pNumPointsInStroke) - { - DPRINT1("Failed to allocate %lu strokes\n", numStrokes); + int i, pos, polygons; + PULONG counts; + int Ret; + + if (!pPath->numEntriesUsed) return FALSE; + + counts = ExAllocatePoolWithTag(PagedPool, (pPath->numEntriesUsed / 2) * sizeof(counts), TAG_PATH); + if (!counts) + { + DPRINT1("Failed to allocate %lu strokes\n", (pPath->numEntriesUsed / 2) * sizeof(*counts)); EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } - /* Second pass: remember number of points in each polygon */ - iStroke = -1; /* Will get incremented to 0 at beginning of first stroke */ - for (i = 0; i < pPath->numEntriesUsed; i++) - { - /* Is this the beginning of a new stroke? */ - if ((pPath->pFlags[i] & ~PT_CLOSEFIGURE) == PT_MOVETO) - { - iStroke++; - _PRAGMA_WARNING_SUPPRESS(__WARNING_WRITE_OVERRUN) - pNumPointsInStroke[iStroke] = 0; - } - - _PRAGMA_WARNING_SUPPRESS(__WARNING_READ_OVERRUN) - pNumPointsInStroke[iStroke]++; - } + pos = polygons = 0; + ASSERT( pPath->pFlags[0] == PT_MOVETO ); + for (i = 1; i < pPath->numEntriesUsed; i++) + { + if (pPath->pFlags[i] != PT_MOVETO) continue; + counts[polygons++] = i - pos; + pos = i; + } + if (i > pos + 1) counts[polygons++] = i - pos; + + ASSERT( polygons <= pPath->numEntriesUsed / 2 ); /* Fill the region with the strokes */ Ret = REGION_SetPolyPolygonRgn(Rgn, pPath->pPoints, - pNumPointsInStroke, - numStrokes, - nPolyFillMode); + counts, + polygons, + Mode); if (!Ret) { DPRINT1("REGION_SetPolyPolygonRgn failed\n"); } - /* Free memory for number-of-points-in-stroke array */ - ExFreePoolWithTag(pNumPointsInStroke, TAG_PATH); + ExFreePoolWithTag(counts, TAG_PATH); /* Success! */ return Ret; } -/* PATH_EmptyPath +/* PATH_FillPath * - * Removes all entries from the path and sets the path state to PATH_Null. + * You can play with this as long as you like, but if you break Area.exe the purge will Begain on Path!!! + * */ -VOID -FASTCALL -PATH_EmptyPath(PPATH pPath) -{ - ASSERT(pPath != NULL); - - pPath->state = PATH_Null; - pPath->numEntriesUsed = 0; -} - -/* PATH_AddEntry - * - * Adds an entry to the path. For "flags", pass either PT_MOVETO, PT_LINETO - * or PT_BEZIERTO, optionally ORed with PT_CLOSEFIGURE. Returns TRUE if - * successful, FALSE otherwise (e.g. if not enough memory was available). - */ -BOOL -FASTCALL -PATH_AddEntry( - PPATH pPath, - const POINT *pPoint, - BYTE flags) -{ - ASSERT(pPath != NULL); - - /* FIXME: If newStroke is true, perhaps we want to check that we're - * getting a PT_MOVETO +BOOL +FASTCALL +PATH_FillPath( + PDC dc, + PPATH pPath) +{ + INT mapMode, graphicsMode; + SIZE ptViewportExt, ptWindowExt; + POINTL ptViewportOrg, ptWindowOrg; + XFORML xform; + PREGION Rgn; + PDC_ATTR pdcattr = dc->pdcattr; + + if (pPath->state != PATH_Closed) + { + DPRINT("PFP : path not closed\n"); + EngSetLastError(ERROR_CAN_NOT_COMPLETE); + return FALSE; + } + + /* Allocate a temporary region */ + Rgn = IntSysCreateRectpRgn(0, 0, 0, 0); + if (!Rgn) + { + EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + if (!PATH_PathToRegion(pPath, pdcattr->jFillMode, Rgn)) + { + DPRINT("PFP : Fail P2R\n"); + /* EngSetLastError ? */ + REGION_Delete(Rgn); + return FALSE; + } + + /* Since PaintRgn interprets the region as being in logical coordinates + * but the points we store for the path are already in device + * coordinates, we have to set the mapping mode to MM_TEXT temporarily. + * Using SaveDC to save information about the mapping mode / world + * transform would be easier but would require more overhead, especially + * now that SaveDC saves the current path. */ - /* Check that path is open */ - if (pPath->state != PATH_Open) - return FALSE; - - /* Reserve enough memory for an extra path entry */ - if (!PATH_ReserveEntries(pPath, pPath->numEntriesUsed + 1)) - return FALSE; - - /* Store information in path entry */ - pPath->pPoints[pPath->numEntriesUsed] = *pPoint; - pPath->pFlags[pPath->numEntriesUsed] = flags; - - /* If this is PT_CLOSEFIGURE, we have to start a new stroke next time */ - if ((flags & PT_CLOSEFIGURE) == PT_CLOSEFIGURE) - pPath->newStroke = TRUE; - - /* Increment entry count */ - pPath->numEntriesUsed++; - + /* Save the information about the old mapping mode */ + mapMode = pdcattr->iMapMode; + ptViewportExt = pdcattr->szlViewportExt; + ptViewportOrg = pdcattr->ptlViewportOrg; + ptWindowExt = pdcattr->szlWindowExt; + ptWindowOrg = pdcattr->ptlWindowOrg; + + /* Save world transform + * NB: The Windows documentation on world transforms would lead one to + * believe that this has to be done only in GM_ADVANCED; however, my + * tests show that resetting the graphics mode to GM_COMPATIBLE does + * not reset the world transform. + */ + MatrixS2XForm(&xform, &dc->pdcattr->mxWorldToPage); + + /* Set MM_TEXT */ + IntGdiSetMapMode(dc, MM_TEXT); + pdcattr->ptlViewportOrg.x = 0; + pdcattr->ptlViewportOrg.y = 0; + pdcattr->ptlWindowOrg.x = 0; + pdcattr->ptlWindowOrg.y = 0; + + graphicsMode = pdcattr->iGraphicsMode; + pdcattr->iGraphicsMode = GM_ADVANCED; + GreModifyWorldTransform(dc, &xform, MWT_IDENTITY); + pdcattr->iGraphicsMode = graphicsMode; + + /* Paint the region */ + IntGdiPaintRgn(dc, Rgn); + REGION_Delete(Rgn); + /* Restore the old mapping mode */ + IntGdiSetMapMode(dc, mapMode); + pdcattr->szlViewportExt = ptViewportExt; + pdcattr->ptlViewportOrg = ptViewportOrg; + pdcattr->szlWindowExt = ptWindowExt; + pdcattr->ptlWindowOrg = ptWindowOrg; + + /* Go to GM_ADVANCED temporarily to restore the world transform */ + graphicsMode = pdcattr->iGraphicsMode; + pdcattr->iGraphicsMode = GM_ADVANCED; + GreModifyWorldTransform(dc, &xform, MWT_MAX+1); + pdcattr->iGraphicsMode = graphicsMode; return TRUE; } - -/* PATH_ReserveEntries - * - * Ensures that at least "numEntries" entries (for points and flags) have - * been allocated; allocates larger arrays and copies the existing entries - * to those arrays, if necessary. Returns TRUE if successful, else FALSE. - */ -BOOL -FASTCALL -PATH_ReserveEntries( - PPATH pPath, - INT numEntries) -{ - INT numEntriesToAllocate; - POINT *pPointsNew; - BYTE *pFlagsNew; - - ASSERT(pPath != NULL); - ASSERT(numEntries >= 0); - - /* Do we have to allocate more memory? */ - if (numEntries > pPath->numEntriesAllocated) - { - /* Find number of entries to allocate. We let the size of the array - * grow exponentially, since that will guarantee linear time - * complexity. */ - if (pPath->numEntriesAllocated) - { - numEntriesToAllocate = pPath->numEntriesAllocated; - while (numEntriesToAllocate < numEntries) - numEntriesToAllocate = numEntriesToAllocate * GROW_FACTOR_NUMER / GROW_FACTOR_DENOM; - } - else - numEntriesToAllocate = numEntries; - - /* Allocate new arrays */ - pPointsNew = (POINT *)ExAllocatePoolWithTag(PagedPool, numEntriesToAllocate * sizeof(POINT), TAG_PATH); - if (!pPointsNew) - return FALSE; - - pFlagsNew = (BYTE *)ExAllocatePoolWithTag(PagedPool, numEntriesToAllocate * sizeof(BYTE), TAG_PATH); - if (!pFlagsNew) - { - ExFreePoolWithTag(pPointsNew, TAG_PATH); - return FALSE; - } - - /* Copy old arrays to new arrays and discard old arrays */ - if (pPath->pPoints) - { - ASSERT(pPath->pFlags); - - memcpy(pPointsNew, pPath->pPoints, sizeof(POINT)*pPath->numEntriesUsed); - memcpy(pFlagsNew, pPath->pFlags, sizeof(BYTE)*pPath->numEntriesUsed); - - ExFreePoolWithTag(pPath->pPoints, TAG_PATH); - ExFreePoolWithTag(pPath->pFlags, TAG_PATH); - } - - pPath->pPoints = pPointsNew; - pPath->pFlags = pFlagsNew; - pPath->numEntriesAllocated = numEntriesToAllocate; - } - - return TRUE; -} - -/* PATH_DoArcPart - * - * Creates a Bezier spline that corresponds to part of an arc and appends the - * corresponding points to the path. The start and end angles are passed in - * "angleStart" and "angleEnd"; these angles should span a quarter circle - * at most. If "startEntryType" is non-zero, an entry of that type for the first - * control point is added to the path; otherwise, it is assumed that the current - * position is equal to the first control point. - */ -BOOL -FASTCALL -PATH_DoArcPart( - PPATH pPath, - FLOAT_POINT corners[], - double angleStart, - double angleEnd, - BYTE startEntryType) -{ - double halfAngle, a; - double xNorm[4], yNorm[4]; - POINT point; - int i; - - ASSERT(fabs(angleEnd - angleStart) <= M_PI_2); - - /* FIXME: Is there an easier way of computing this? */ - - /* Compute control points */ - halfAngle = (angleEnd - angleStart) / 2.0; - if (fabs(halfAngle) > 1e-8) - { - a = 4.0 / 3.0 * (1 - cos(halfAngle)) / sin(halfAngle); - xNorm[0] = cos(angleStart); - yNorm[0] = sin(angleStart); - xNorm[1] = xNorm[0] - a * yNorm[0]; - yNorm[1] = yNorm[0] + a * xNorm[0]; - xNorm[3] = cos(angleEnd); - yNorm[3] = sin(angleEnd); - xNorm[2] = xNorm[3] + a * yNorm[3]; - yNorm[2] = yNorm[3] - a * xNorm[3]; - } - else - for (i = 0; i < 4; i++) - { - xNorm[i] = cos(angleStart); - yNorm[i] = sin(angleStart); - } - - /* Add starting point to path if desired */ - if (startEntryType) - { - PATH_ScaleNormalizedPoint(corners, xNorm[0], yNorm[0], &point); - if (!PATH_AddEntry(pPath, &point, startEntryType)) - return FALSE; - } - - /* Add remaining control points */ - for (i = 1; i < 4; i++) - { - PATH_ScaleNormalizedPoint(corners, xNorm[i], yNorm[i], &point); - if (!PATH_AddEntry(pPath, &point, PT_BEZIERTO)) - return FALSE; - } - - return TRUE; -} - -/* PATH_ScaleNormalizedPoint - * - * Scales a normalized point (x, y) with respect to the box whose corners are - * passed in "corners". The point is stored in "*pPoint". The normalized - * coordinates (-1.0, -1.0) correspond to corners[0], the coordinates - * (1.0, 1.0) correspond to corners[1]. - */ -VOID -FASTCALL -PATH_ScaleNormalizedPoint( - FLOAT_POINT corners[], - double x, - double y, - POINT *pPoint) -{ - ASSERT(corners); - ASSERT(pPoint); - - pPoint->x = GDI_ROUND((double)corners[0].x + (double)(corners[1].x - corners[0].x) * 0.5 * (x + 1.0)); - pPoint->y = GDI_ROUND((double)corners[0].y + (double)(corners[1].y - corners[0].y) * 0.5 * (y + 1.0)); -} - -/* PATH_NormalizePoint - * - * Normalizes a point with respect to the box whose corners are passed in - * corners. The normalized coordinates are stored in *pX and *pY. - */ -VOID -FASTCALL -PATH_NormalizePoint( - FLOAT_POINT corners[], - const FLOAT_POINT *pPoint, - double *pX, - double *pY) -{ - ASSERT(corners); - ASSERT(pPoint); - ASSERT(pX); - ASSERT(pY); - - *pX = (double)(pPoint->x - corners[0].x) / (double)(corners[1].x - corners[0].x) * 2.0 - 1.0; - *pY = (double)(pPoint->y - corners[0].y) / (double)(corners[1].y - corners[0].y) * 2.0 - 1.0; -} - BOOL FASTCALL @@ -1711,32 +1721,36 @@ #define round(x) ((int)((x)>0?(x)+0.5:(x)-0.5)) static -BOOL +PPATH FASTCALL PATH_WidenPath(DC *dc) { INT i, j, numStrokes, numOldStrokes, penWidth, penWidthIn, penWidthOut, size, penStyle; - BOOL ret = FALSE; - PPATH pPath, pNewPath, *pStrokes = NULL, *pOldStrokes, pUpPath, pDownPath; + PPATH pPath, flat_path, pNewPath, *pStrokes = NULL, *pOldStrokes, pUpPath, pDownPath; EXTLOGPEN *elp; + BYTE *type; DWORD obj_type, joint, endcap, penType; PDC_ATTR pdcattr = dc->pdcattr; pPath = PATH_LockPath(dc->dclevel.hPath); - if (!pPath) return FALSE; - - if (pPath->state == PATH_Open) - { + if (!pPath) + { + EngSetLastError( ERROR_CAN_NOT_COMPLETE ); + return NULL; + } + + if (pPath->state != PATH_Closed) + { + DPRINT("PWP 1\n"); PATH_UnlockPath(pPath); EngSetLastError(ERROR_CAN_NOT_COMPLETE); - return FALSE; - } - - PATH_FlattenPath(pPath); + return NULL; + } size = GreGetObject(pdcattr->hpen, 0, NULL); if (!size) { + DPRINT("PWP 2\n"); PATH_UnlockPath(pPath); EngSetLastError(ERROR_CAN_NOT_COMPLETE); return FALSE; @@ -1745,6 +1759,7 @@ elp = ExAllocatePoolWithTag(PagedPool, size, TAG_PATH); if (elp == NULL) { + DPRINT("PWP 3\n"); PATH_UnlockPath(pPath); EngSetLastError(ERROR_OUTOFMEMORY); return FALSE; @@ -1763,6 +1778,7 @@ } else { + DPRINT("PWP 4\n"); EngSetLastError(ERROR_CAN_NOT_COMPLETE); ExFreePoolWithTag(elp, TAG_PATH); PATH_UnlockPath(pPath); @@ -1779,10 +1795,18 @@ /* The function cannot apply to cosmetic pens */ if (obj_type == GDI_OBJECT_TYPE_EXTPEN && penType == PS_COSMETIC) { + DPRINT("PWP 5\n"); PATH_UnlockPath(pPath); EngSetLastError(ERROR_CAN_NOT_COMPLETE); return FALSE; } + + if (!(flat_path = PATH_FlattenPath(pPath))) + { + PATH_UnlockPath(pPath); + return NULL; + } + PATH_UnlockPath(pPath); penWidthIn = penWidth / 2; penWidthOut = penWidth / 2; @@ -1791,18 +1815,20 @@ numStrokes = 0; - for (i = 0, j = 0; i < pPath->numEntriesUsed; i++, j++) + for (i = 0, j = 0; i < flat_path->numEntriesUsed; i++, j++) { POINT point; - if ((i == 0 || (pPath->pFlags[i - 1] & PT_CLOSEFIGURE)) && - (pPath->pFlags[i] != PT_MOVETO)) + if ((i == 0 || (flat_path->pFlags[i - 1] & PT_CLOSEFIGURE)) && + (flat_path->pFlags[i] != PT_MOVETO)) { DPRINT1("Expected PT_MOVETO %s, got path flag %c\n", i == 0 ? "as first point" : "after PT_CLOSEFIGURE", - pPath->pFlags[i]); + flat_path->pFlags[i]); + PATH_UnlockPath(flat_path); + PATH_Delete(flat_path->BaseObject.hHmgr); return FALSE; } - switch(pPath->pFlags[i]) + switch(flat_path->pFlags[i]) { case PT_MOVETO: if (numStrokes > 0) @@ -1813,47 +1839,52 @@ numStrokes++; j = 0; if (numStrokes == 1) - pStrokes = ExAllocatePoolWithTag(PagedPool, numStrokes * sizeof(PPATH), TAG_PATH); + pStrokes = ExAllocatePoolWithTag(PagedPool, sizeof(*pStrokes), TAG_PATH); else { pOldStrokes = pStrokes; // Save old pointer. - pStrokes = ExAllocatePoolWithTag(PagedPool, numStrokes * sizeof(PPATH), TAG_PATH); - if (!pStrokes) return FALSE; + pStrokes = ExAllocatePoolWithTag(PagedPool, numStrokes * sizeof(*pStrokes), TAG_PATH); + if (!pStrokes) + { + PATH_UnlockPath(flat_path); + PATH_Delete(flat_path->BaseObject.hHmgr); + return FALSE; + } RtlCopyMemory(pStrokes, pOldStrokes, numOldStrokes * sizeof(PPATH)); ExFreePoolWithTag(pOldStrokes, TAG_PATH); // Free old pointer. } - if (!pStrokes) return FALSE; + if (!pStrokes) + { + PATH_UnlockPath(flat_path); + PATH_Delete(flat_path->BaseObject.hHmgr); + return FALSE; + } pStrokes[numStrokes - 1] = ExAllocatePoolWithTag(PagedPool, sizeof(PATH), TAG_PATH); if (!pStrokes[numStrokes - 1]) { ASSERT(FALSE); // FIXME } - PATH_InitGdiPath(pStrokes[numStrokes - 1]); pStrokes[numStrokes - 1]->state = PATH_Open; case PT_LINETO: case (PT_LINETO | PT_CLOSEFIGURE): - point.x = pPath->pPoints[i].x; - point.y = pPath->pPoints[i].y; - PATH_AddEntry(pStrokes[numStrokes - 1], &point, pPath->pFlags[i]); + point.x = flat_path->pPoints[i].x; + point.y = flat_path->pPoints[i].y; + PATH_AddEntry(pStrokes[numStrokes - 1], &point, flat_path->pFlags[i]); break; case PT_BEZIERTO: /* Should never happen because of the FlattenPath call */ DPRINT1("Should never happen\n"); break; default: - DPRINT1("Got path flag %c\n", pPath->pFlags[i]); + DPRINT1("Got path flag %c\n", flat_path->pFlags[i]); + PATH_UnlockPath(flat_path); + PATH_Delete(flat_path->BaseObject.hHmgr); return FALSE; } } - pNewPath = ExAllocatePoolWithTag(PagedPool, sizeof(PATH), TAG_PATH); - if (!pNewPath) - { - ASSERT(FALSE); // FIXME - } - PATH_InitGdiPath(pNewPath); - pNewPath->state = PATH_Open; + pNewPath = PATH_CreatePath( flat_path->numEntriesUsed ); for (i = 0; i < numStrokes; i++) { @@ -2059,20 +2090,11 @@ } } } - for (j = 0; j < pUpPath->numEntriesUsed; j++) - { - POINT pt; - pt.x = pUpPath->pPoints[j].x; - pt.y = pUpPath->pPoints[j].y; - PATH_AddEntry(pNewPath, &pt, (j == 0 ? PT_MOVETO : PT_LINETO)); - } - for (j = 0; j < pDownPath->numEntriesUsed; j++) - { - POINT pt; - pt.x = pDownPath->pPoints[pDownPath->numEntriesUsed - j - 1].x; - pt.y = pDownPath->pPoints[pDownPath->numEntriesUsed - j - 1].y; - PATH_AddEntry(pNewPath, &pt, ((j == 0 && (pStrokes[i]->pFlags[pStrokes[i]->numEntriesUsed - 1] & PT_CLOSEFIGURE)) ? PT_MOVETO : PT_LINETO)); - } + type = add_points( pNewPath, pUpPath->pPoints, pUpPath->numEntriesUsed, PT_LINETO ); + type[0] = PT_MOVETO; + reverse_points( pDownPath->pPoints, pDownPath->numEntriesUsed ); + type = add_points( pNewPath, pDownPath->pPoints, pDownPath->numEntriesUsed, PT_LINETO ); + if (pStrokes[i]->pFlags[pStrokes[i]->numEntriesUsed - 1] & PT_CLOSEFIGURE) type[0] = PT_MOVETO; PATH_DestroyGdiPath(pStrokes[i]); ExFreePoolWithTag(pStrokes[i], TAG_PATH); @@ -2083,13 +2105,11 @@ } if (pStrokes) ExFreePoolWithTag(pStrokes, TAG_PATH); + PATH_UnlockPath(flat_path); + PATH_Delete(flat_path->BaseObject.hHmgr); pNewPath->state = PATH_Closed; - if (!(ret = PATH_AssignGdiPath(pPath, pNewPath))) - DPRINT1("Assign path failed\n"); - PATH_DestroyGdiPath(pNewPath); - ExFreePoolWithTag(pNewPath, TAG_PATH); - PATH_UnlockPath(pPath); - return ret; + PATH_UnlockPath(pNewPath); + return pNewPath; } static inline INT int_from_fixed(FIXED f) @@ -2118,9 +2138,7 @@ } else if (n == 3) { - PATH_AddEntry(pPath, &lppt[0], PT_BEZIERTO); - PATH_AddEntry(pPath, &lppt[1], PT_BEZIERTO); - PATH_AddEntry(pPath, &lppt[2], PT_BEZIERTO); + add_points( pPath, lppt, 3, PT_BEZIERTO ); } else { @@ -2136,7 +2154,7 @@ pt[1] = lppt[i + 1]; pt[2].x = (lppt[i + 2].x + lppt[i + 1].x) / 2; pt[2].y = (lppt[i + 2].y + lppt[i + 1].y) / 2; - PATH_BezierTo(pPath, pt, 3); + add_points( pPath, pt, 3, PT_BEZIERTO ); n--; i++; } @@ -2144,7 +2162,7 @@ pt[0] = pt[2]; pt[1] = lppt[i + 1]; pt[2] = lppt[i + 2]; - PATH_BezierTo(pPath, pt, 3); + add_points( pPath, pt, 3, PT_BEZIERTO ); } } @@ -2153,23 +2171,17 @@ FASTCALL PATH_add_outline( PDC dc, + PPATH pPath, INT x, INT y, TTPOLYGONHEADER *header, DWORD size) { - PPATH pPath; TTPOLYGONHEADER *start; POINT pt; BOOL bResult = FALSE; start = header; - - pPath = PATH_LockPath(dc->dclevel.hPath); - if (!pPath) - { - return FALSE; - } while ((char *)header < (char *)start + size) { @@ -2246,7 +2258,6 @@ cleanup: IntGdiCloseFigure(pPath); - PATH_UnlockPath(pPath); return bResult; } @@ -2265,10 +2276,24 @@ UINT count, const INT *dx) { - unsigned int idx; + PPATH pPath; + unsigned int idx, ggo_flags = GGO_NATIVE; POINT offset = {0, 0}; + pPath = PATH_LockPath(dc->dclevel.hPath); + if (!pPath) + { + return FALSE; + } + + if (pPath->state != PATH_Open) + { + DPRINT1("PATH_ExtTextOut not open\n"); + return FALSE; + } + if (!count) return TRUE; + if (flags & ETO_GLYPH_INDEX) ggo_flags |= GGO_GLYPH_INDEX; for (idx = 0; idx < count; idx++) { @@ -2279,30 +2304,38 @@ dwSize = ftGdiGetGlyphOutline(dc, str[idx], - GGO_GLYPH_INDEX | GGO_NATIVE, + ggo_flags, &gm, 0, NULL, &identity, TRUE); - if (dwSize == GDI_ERROR) return FALSE; + if (dwSize == GDI_ERROR) + { + PATH_UnlockPath(pPath); + return FALSE; + } /* Add outline only if char is printable */ if (dwSize) { outline = ExAllocatePoolWithTag(PagedPool, dwSize, TAG_PATH); - if (!outline) return FALSE; + if (!outline) + { + PATH_UnlockPath(pPath); + return FALSE; + } ftGdiGetGlyphOutline(dc, str[idx], - GGO_GLYPH_INDEX | GGO_NATIVE, + ggo_flags, &gm, dwSize, outline, &identity, TRUE); - PATH_add_outline(dc, x + offset.x, y + offset.y, outline, dwSize); + PATH_add_outline(dc, pPath, x + offset.x, y + offset.y, outline, dwSize); ExFreePoolWithTag(outline, TAG_PATH); } @@ -2323,6 +2356,7 @@ offset.y += gm.gmCellIncY; } } + PATH_UnlockPath(pPath); return TRUE; } @@ -2335,7 +2369,6 @@ APIENTRY NtGdiAbortPath(HDC hDC) { - PPATH pPath; PDC dc = DC_LockDc(hDC); if (!dc) { @@ -2343,16 +2376,19 @@ return FALSE; } - pPath = PATH_LockPath(dc->dclevel.hPath); - if (!pPath) - { - DC_UnlockDc(dc); - return FALSE; - } - - PATH_EmptyPath(pPath); - - PATH_UnlockPath(pPath); + if (!dc->dclevel.hPath) + { + DC_UnlockDc(dc); + return TRUE; + } + + if (!PATH_Delete(dc->dclevel.hPath)) + { + DC_UnlockDc(dc); + return FALSE; + } + + dc->dclevel.hPath = 0; dc->dclevel.flPath &= ~DCPATH_ACTIVE; DC_UnlockDc(dc); @@ -2399,35 +2435,19 @@ dc->dclevel.hPath = NULL; } } - pPath = PATH_AllocPathWithHandle(); - if (!pPath) - { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } + pPath = PATH_CreatePath(NUM_ENTRIES_INITIAL); dc->dclevel.flPath |= DCPATH_ACTIVE; // Set active ASAP! - dc->dclevel.hPath = pPath->BaseObject.hHmgr; - - DPRINT("BeginPath 2 h 0x%p p 0x%p\n", dc->dclevel.hPath, pPath); - // Path handles are shared. Also due to recursion with in the same thread. - GDIOBJ_vUnlockObject((POBJ)pPath); // Unlock - pPath = PATH_LockPath(dc->dclevel.hPath); // Share Lock. - - /* Make sure that path is empty */ - PATH_EmptyPath(pPath); - - pPath->numEntriesAllocated = NUM_ENTRIES_INITIAL; - - pPath->pPoints = (POINT *)ExAllocatePoolWithTag(PagedPool, NUM_ENTRIES_INITIAL * sizeof(POINT), TAG_PATH); - pPath->pFlags = (BYTE *)ExAllocatePoolWithTag(PagedPool, NUM_ENTRIES_INITIAL * sizeof(BYTE), TAG_PATH); - - /* Initialize variables for new path */ - pPath->newStroke = TRUE; - pPath->state = PATH_Open; - + IntGetCurrentPositionEx(dc, &pPath->pos); + IntLPtoDP( dc, &pPath->pos, 1 ); + DPRINT("BP : Current pos X %d Y %d\n",pPath->pos.x, pPath->pos.y); PATH_UnlockPath(pPath); DC_UnlockDc(dc); + + if (!pPath) + { + return FALSE; + } return TRUE; } @@ -2462,7 +2482,6 @@ } else { - // FIXME: Check if lasterror is set correctly EngSetLastError(ERROR_CAN_NOT_COMPLETE); } @@ -2496,7 +2515,7 @@ /* Check that path is currently being constructed */ if ((pPath->state != PATH_Open) || !(dc->dclevel.flPath & DCPATH_ACTIVE)) { - DPRINT1("EndPath ERROR! 0x%p\n", dc->dclevel.hPath); + DPRINT("EndPath ERROR! 0x%p\n", dc->dclevel.hPath); EngSetLastError(ERROR_CAN_NOT_COMPLETE); ret = FALSE; } @@ -2518,7 +2537,7 @@ NtGdiFillPath(HDC hDC) { BOOL ret = FALSE; - PPATH pPath; + PPATH pPath, pNewPath; PDC_ATTR pdcattr; PDC dc; @@ -2546,15 +2565,18 @@ if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY)) DC_vUpdateFillBrush(dc); - ret = PATH_FillPath(dc, pPath); - if (ret) - { - /* FIXME: Should the path be emptied even if conversion - failed? */ - PATH_EmptyPath(pPath); - } + pNewPath = PATH_FlattenPath(pPath); + + ret = PATH_FillPath(dc, pNewPath); + + PATH_UnlockPath(pNewPath); + PATH_Delete(pNewPath->BaseObject.hHmgr); PATH_UnlockPath(pPath); + PATH_Delete(pPath->BaseObject.hHmgr); + dc->dclevel.hPath = 0; + dc->dclevel.flPath &= ~DCPATH_ACTIVE; + DC_vFinishBlit(dc, NULL); DC_UnlockDc(dc); return ret; @@ -2566,7 +2588,7 @@ { BOOL Ret = FALSE; DC *pDc; - PPATH pPath; + PPATH pPath, pNewPath = NULL; DPRINT("Enter %s\n", __FUNCTION__); @@ -2580,13 +2602,26 @@ pPath = PATH_LockPath(pDc->dclevel.hPath); if (!pPath) { + EngSetLastError( ERROR_CAN_NOT_COMPLETE ); DC_UnlockDc(pDc); return FALSE; } - if (pPath->state == PATH_Open) - Ret = PATH_FlattenPath(pPath); + + if (pPath->state == PATH_Closed) + { + pNewPath = PATH_FlattenPath(pPath); + } PATH_UnlockPath(pPath); + + if (pNewPath) + { + PATH_Delete(pDc->dclevel.hPath); + pDc->dclevel.hPath = pNewPath->BaseObject.hHmgr; + PATH_UnlockPath(pNewPath); + Ret = TRUE; + } + DC_UnlockDc(pDc); return Ret; } @@ -2636,6 +2671,7 @@ PPATH pPath; DC *dc = DC_LockDc(hDC); + DPRINT("NtGdiGetPath start\n"); if (!dc) { DPRINT1("Can't lock dc!\n"); @@ -2689,6 +2725,7 @@ } done: + DPRINT("NtGdiGetPath exit %d\n",ret); PATH_UnlockPath(pPath); DC_UnlockDc(dc); return ret; @@ -2698,8 +2735,9 @@ APIENTRY NtGdiPathToRegion(HDC hDC) { - PPATH pPath; + PPATH pPath, pNewPath; HRGN hrgnRval = 0; + int Ret; PREGION Rgn; DC *pDc; PDC_ATTR pdcattr; @@ -2709,7 +2747,7 @@ pDc = DC_LockDc(hDC); if (!pDc) { - DPRINT1("Failed to lock DC %p\n", hDC); + DPRINT("Failed to lock DC %p\n", hDC); EngSetLastError(ERROR_INVALID_PARAMETER); return NULL; } @@ -2719,7 +2757,7 @@ pPath = PATH_LockPath(pDc->dclevel.hPath); if (!pPath) { - DPRINT1("Failed to lock DC path %p\n", pDc->dclevel.hPath); + DPRINT("Failed to lock DC path %p\n", pDc->dclevel.hPath); DC_UnlockDc(pDc); return NULL; } @@ -2727,7 +2765,7 @@ if (pPath->state != PATH_Closed) { // FIXME: Check that setlasterror is being called correctly - DPRINT1("Path is not closed!\n"); + DPRINT("Path is not closed!\n"); EngSetLastError(ERROR_CAN_NOT_COMPLETE); } else @@ -2736,27 +2774,35 @@ Rgn = REGION_AllocUserRgnWithHandle(1); if (!Rgn) { - DPRINT1("Failed to allocate a region\n"); + DPRINT("Failed to allocate a region\n"); PATH_UnlockPath(pPath); DC_UnlockDc(pDc); return NULL; } hrgnRval = Rgn->BaseObject.hHmgr; - /* FIXME: Should we empty the path even if conversion failed? */ - if (PATH_PathToRegion(pPath, pdcattr->jFillMode, Rgn)) - { - PATH_EmptyPath(pPath); - REGION_UnlockRgn(Rgn); - } - else - { - DPRINT1("PATH_PathToRegion failed\n"); + + pNewPath = PATH_FlattenPath(pPath); + + Ret = PATH_PathToRegion(pNewPath, pdcattr->jFillMode, Rgn); + + PATH_UnlockPath(pNewPath); + PATH_Delete(pNewPath->BaseObject.hHmgr); + + if (!Ret) + { + DPRINT("PATH_PathToRegion failed\n"); REGION_Delete(Rgn); hrgnRval = NULL; } + else + REGION_UnlockRgn(Rgn); } PATH_UnlockPath(pPath); + PATH_Delete(pDc->dclevel.hPath); + pDc->dclevel.hPath = NULL; + pDc->dclevel.flPath &= ~DCPATH_ACTIVE; + DC_UnlockDc(pDc); return hrgnRval; } @@ -2807,10 +2853,10 @@ { DC *pDc; PDC_ATTR pdcattr; - PPATH pPath; + PPATH pPath, pNewPath; BOOL bRet = FALSE; - DPRINT1("Enter %s\n", __FUNCTION__); + DPRINT("Enter %s\n", __FUNCTION__); if (!(pDc = DC_LockDc(hDC))) { @@ -2834,11 +2880,19 @@ if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY)) DC_vUpdateLineBrush(pDc); - bRet = PATH_FillPath(pDc, pPath); - if (bRet) bRet = PATH_StrokePath(pDc, pPath); - if (bRet) PATH_EmptyPath(pPath); + pNewPath = PATH_FlattenPath(pPath); + + bRet = PATH_FillPath(pDc, pNewPath); + if (bRet) bRet = PATH_StrokePath(pDc, pNewPath); + + PATH_UnlockPath(pNewPath); + PATH_Delete(pNewPath->BaseObject.hHmgr); PATH_UnlockPath(pPath); + PATH_Delete(pPath->BaseObject.hHmgr); + pDc->dclevel.hPath = 0; + pDc->dclevel.flPath &= ~DCPATH_ACTIVE; + DC_vFinishBlit(pDc, NULL); DC_UnlockDc(pDc); return bRet; @@ -2878,9 +2932,12 @@ bRet = PATH_StrokePath(pDc, pPath); DC_vFinishBlit(pDc, NULL); - PATH_EmptyPath(pPath); PATH_UnlockPath(pPath); + PATH_Delete(pPath->BaseObject.hHmgr); + pDc->dclevel.hPath = 0; + pDc->dclevel.flPath &= ~DCPATH_ACTIVE; + DC_UnlockDc(pDc); return bRet; } @@ -2889,16 +2946,26 @@ APIENTRY NtGdiWidenPath(HDC hDC) { - BOOL Ret; + PPATH pPath; + BOOL Ret = FALSE; PDC pdc = DC_LockDc(hDC); + DPRINT("NtGdiWidenPat Enter\n"); if (!pdc) { EngSetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - Ret = PATH_WidenPath(pdc); + pPath = PATH_WidenPath(pdc); + if (pPath) + { + DPRINT("WindenPath New Path\n"); + PATH_Delete(pdc->dclevel.hPath); + pdc->dclevel.hPath = pPath->BaseObject.hHmgr; + Ret = TRUE; + } DC_UnlockDc(pdc); + DPRINT("NtGdiWidenPat Ret %d\n",Ret); return Ret; } Modified: trunk/reactos/win32ss/gdi/ntgdi/path.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/path.h?r…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/path.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/path.h [iso-8859-1] Thu Sep 8 22:37:41 2016 @@ -34,6 +34,7 @@ int numEntriesUsed; int numEntriesAllocated; BOOL newStroke; + POINT pos; } PATH, *PPATH; typedef struct _EPATHOBJ @@ -50,15 +51,13 @@ #define PATH_IsPathOpen(dclevel) ( ((dclevel).hPath) && ((dclevel).flPath & DCPATH_ACTIVE) ) -BOOL FASTCALL PATH_Arc (PDC dc, INT x1, INT y1, INT x2, INT y2, INT xStart, INT yStart, INT xEnd, INT yEnd, INT lines); +BOOL FASTCALL PATH_Arc (PDC dc, INT x1, INT y1, INT x2, INT y2, INT xStart, INT yStart, INT xEnd, INT yEnd, INT direction, INT lines); BOOL FASTCALL PATH_Ellipse (PDC dc, INT x1, INT y1, INT x2, INT y2); VOID FASTCALL PATH_EmptyPath (PPATH pPath); BOOL FASTCALL PATH_LineTo (PDC dc, INT x, INT y); BOOL FASTCALL PATH_PolyBezier (PDC dc, const POINT *pts, DWORD cbPoints); BOOL FASTCALL PATH_PolyBezierTo (PDC dc, const POINT *pts, DWORD cbPoints); BOOL FASTCALL PATH_PolyDraw(PDC dc, const POINT *pts, const BYTE *types, DWORD cbPoints); -BOOL FASTCALL PATH_Polygon (PDC dc, const POINT *pts, DWORD cbPoints); -BOOL FASTCALL PATH_Polyline (PDC dc, const POINT *pts, DWORD cbPoints); BOOL FASTCALL PATH_PolylineTo (PDC dc, const POINT *pts, DWORD cbPoints); BOOL FASTCALL PATH_PolyPolygon ( PDC dc, const POINT* pts, const INT* counts, UINT polygons); BOOL FASTCALL PATH_PolyPolyline( PDC dc, const POINT* pts, const DWORD* counts, DWORD polylines); @@ -71,7 +70,7 @@ BOOL FASTCALL PATH_AddFlatBezier (PPATH pPath, POINT *pt, BOOL closed); BOOL FASTCALL PATH_DoArcPart (PPATH pPath, FLOAT_POINT corners[], double angleStart, double angleEnd, BYTE startEntryType); BOOL FASTCALL PATH_FillPath( PDC dc, PPATH pPath ); -BOOL FASTCALL PATH_FlattenPath (PPATH pPath); +PPATH FASTCALL PATH_FlattenPath (PPATH pPath); VOID FASTCALL PATH_NormalizePoint (FLOAT_POINT corners[], const FLOAT_POINT *pPoint, double *pX, double *pY); BOOL FASTCALL PATH_ReserveEntries (PPATH pPath, INT numEntries); @@ -83,3 +82,6 @@ BOOL FASTCALL PATH_Delete(HPATH hPath); VOID FASTCALL IntGetCurrentPositionEx(PDC dc, LPPOINT pt); + +BOOL PATH_RestorePath( DC *, DC *); +BOOL PATH_SavePath( DC *, DC *);
8 years, 3 months
1
0
0
0
[akhaldi] 72624: [WIN32K] Add some missing parameter checks. Fixes all but 4 tests in win32knt:NtUserEnumDisplaySettings. By Peter Hater. CORE-11524
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Sep 8 20:25:30 2016 New Revision: 72624 URL:
http://svn.reactos.org/svn/reactos?rev=72624&view=rev
Log: [WIN32K] Add some missing parameter checks. Fixes all but 4 tests in win32knt:NtUserEnumDisplaySettings. By Peter Hater. CORE-11524 Modified: trunk/reactos/win32ss/user/ntuser/display.c Modified: trunk/reactos/win32ss/user/ntuser/display.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/displa…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] Thu Sep 8 20:25:30 2016 @@ -572,8 +572,28 @@ TRACE("Enter NtUserEnumDisplaySettings(%wZ, %lu, %p, 0x%lx)\n", pustrDevice, iModeNum, lpDevMode, dwFlags); + _SEH2_TRY + { + ProbeForWrite(lpDevMode, sizeof(DEVMODEW), 1); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + _SEH2_YIELD(return _SEH2_GetExceptionCode()); + } + _SEH2_END + + if (lpDevMode->dmSize != sizeof(DEVMODEW)) + { + return STATUS_BUFFER_TOO_SMALL; + } + if (pustrDevice) { + if (pustrDevice->Buffer == NULL || pustrDevice->Length == 0) + { + Status = STATUS_INVALID_PARAMETER_1; + } + /* Initialize destination string */ RtlInitEmptyUnicodeString(&ustrDevice, awcDevice, sizeof(awcDevice)); @@ -647,10 +667,16 @@ } _SEH2_END; } + else + { + if (Status == STATUS_UNSUCCESSFUL) + { + Status = STATUS_INVALID_PARAMETER_1; + } + } return Status; } - VOID UserUpdateFullscreen( DWORD flags)
8 years, 3 months
1
0
0
0
[akhaldi] 72623: [WIN32K] Fix a crash in win32knt:NTUserSystemParametersInfo tests. Brought to you by Peter Hater. CORE-11525
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Sep 8 20:18:41 2016 New Revision: 72623 URL:
http://svn.reactos.org/svn/reactos?rev=72623&view=rev
Log: [WIN32K] Fix a crash in win32knt:NTUserSystemParametersInfo tests. Brought to you by Peter Hater. CORE-11525 Modified: trunk/reactos/win32ss/user/ntuser/sysparams.c Modified: trunk/reactos/win32ss/user/ntuser/sysparams.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/syspar…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/sysparams.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/sysparams.c [iso-8859-1] Thu Sep 8 20:18:41 2016 @@ -1053,7 +1053,7 @@ return SpiSetBool(&gspv.bShowSounds, uiParam, KEY_SHOWSNDS, VAL_ON, fl); case SPI_GETSTICKYKEYS: - if (uiParam != sizeof(STICKYKEYS)) + if (uiParam != 0 && uiParam != sizeof(STICKYKEYS)) return 0; return SpiGetEx(pvParam, &gspv.stickykeys, sizeof(STICKYKEYS), fl);
8 years, 3 months
1
0
0
0
[tfaber] 72622: [OLE32] - Gracefully handle NULL clipbrd in clipbrd_wndproc. This is probably not the right fix, but avoids crashing for now. CORE-11905
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Sep 8 11:01:43 2016 New Revision: 72622 URL:
http://svn.reactos.org/svn/reactos?rev=72622&view=rev
Log: [OLE32] - Gracefully handle NULL clipbrd in clipbrd_wndproc. This is probably not the right fix, but avoids crashing for now. CORE-11905 Modified: trunk/reactos/dll/win32/ole32/clipboard.c Modified: trunk/reactos/dll/win32/ole32/clipboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/clipboard.…
============================================================================== --- trunk/reactos/dll/win32/ole32/clipboard.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/clipboard.c [iso-8859-1] Thu Sep 8 11:01:43 2016 @@ -2001,6 +2001,10 @@ ole_clipbrd *clipbrd; get_ole_clipbrd(&clipbrd); +#ifdef __REACTOS__ + if(clipbrd == NULL) + return DefWindowProcW(hwnd, message, wparam, lparam); +#endif switch (message) {
8 years, 3 months
1
0
0
0
[akhaldi] 72621: [CRT] Apply Wine commit 190c67c by Piotr Caban: Fix __pioinfo block size. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Sep 8 10:56:41 2016 New Revision: 72621 URL:
http://svn.reactos.org/svn/reactos?rev=72621&view=rev
Log: [CRT] Apply Wine commit 190c67c by Piotr Caban: Fix __pioinfo block size. CORE-11866 Modified: trunk/reactos/sdk/lib/crt/stdio/file.c Modified: trunk/reactos/sdk/lib/crt/stdio/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/crt/stdio/file.c?r…
============================================================================== --- trunk/reactos/sdk/lib/crt/stdio/file.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/crt/stdio/file.c [iso-8859-1] Thu Sep 8 10:56:41 2016 @@ -108,7 +108,7 @@ /* FIXME: this should be allocated dynamically */ #define MSVCRT_MAX_FILES 2048 -#define MSVCRT_FD_BLOCK_SIZE 64 +#define MSVCRT_FD_BLOCK_SIZE 32 #define MSVCRT_INTERNAL_BUFSIZ 4096 @@ -123,7 +123,7 @@ /********************************************************************* * __pioinfo (MSVCRT.@) - * array of pointers to ioinfo arrays [64] + * array of pointers to ioinfo arrays [32] */ ioinfo * __pioinfo[MSVCRT_MAX_FILES/MSVCRT_FD_BLOCK_SIZE] = { 0 };
8 years, 3 months
1
0
0
0
← Newer
1
...
22
23
24
25
26
27
28
...
35
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
Results per page:
10
25
50
100
200