Skip to content

Commit 895906f

Browse files
committed
[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. svn path=/trunk/; revision=72625
1 parent 4e5e90c commit 895906f

File tree

6 files changed

+1079
-996
lines changed

6 files changed

+1079
-996
lines changed

reactos/win32ss/gdi/ntgdi/arc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ IntGdiArcInternal(
211211
YStartArc,
212212
XEndArc,
213213
YEndArc,
214+
0,
214215
arctype);
215216
}
216217

reactos/win32ss/gdi/ntgdi/dclife.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,13 @@ DC_vCleanup(PVOID ObjectBody)
387387
/* Free CLIPOBJ resources */
388388
IntEngFreeClipResources(&pdc->co);
389389

390-
PATH_Delete(pdc->dclevel.hPath);
391-
390+
if (pdc->dclevel.hPath)
391+
{
392+
DPRINT("DC_vCleanup Path\n");
393+
PATH_Delete(pdc->dclevel.hPath);
394+
pdc->dclevel.hPath = 0;
395+
pdc->dclevel.flPath = 0;
396+
}
392397
if(pdc->dclevel.pSurface)
393398
SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
394399

reactos/win32ss/gdi/ntgdi/dcobjs.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ NtGdiSelectClipPath(
496496
int Mode)
497497
{
498498
PREGION RgnPath;
499-
PPATH pPath;
499+
PPATH pPath, pNewPath;
500500
BOOL success = FALSE;
501501
PDC_ATTR pdcattr;
502502
PDC pdc;
@@ -520,8 +520,8 @@ NtGdiSelectClipPath(
520520
if (pPath->state != PATH_Closed)
521521
{
522522
EngSetLastError(ERROR_CAN_NOT_COMPLETE);
523-
DC_UnlockDc(pdc);
524-
return FALSE;
523+
success = FALSE;
524+
goto Exit;
525525
}
526526

527527
/* Construct a region from the path */
@@ -533,24 +533,23 @@ NtGdiSelectClipPath(
533533
return FALSE;
534534
}
535535

536-
if (!PATH_PathToRegion(pPath, pdcattr->jFillMode, RgnPath))
537-
{
538-
EngSetLastError(ERROR_CAN_NOT_COMPLETE);
539-
REGION_Delete(RgnPath);
540-
DC_UnlockDc(pdc);
541-
return FALSE;
542-
}
536+
pNewPath = PATH_FlattenPath(pPath);
543537

544-
success = IntGdiExtSelectClipRgn(pdc, RgnPath, Mode) != ERROR;
545-
REGION_Delete(RgnPath);
538+
success = PATH_PathToRegion(pNewPath, pdcattr->jFillMode, RgnPath);
546539

547-
/* Empty the path */
548-
if (success)
549-
PATH_EmptyPath(pPath);
540+
PATH_UnlockPath(pNewPath);
541+
PATH_Delete(pNewPath->BaseObject.hHmgr);
550542

551-
/* FIXME: Should this function delete the path even if it failed? */
543+
if (success) success = IntGdiExtSelectClipRgn(pdc, RgnPath, Mode) != ERROR;
552544

545+
REGION_Delete(RgnPath);
546+
547+
Exit:
553548
PATH_UnlockPath(pPath);
549+
PATH_Delete(pdc->dclevel.hPath);
550+
pdc->dclevel.flPath &= ~DCPATH_ACTIVE;
551+
pdc->dclevel.hPath = NULL;
552+
554553
DC_UnlockDc(pdc);
555554

556555
return success;

reactos/win32ss/gdi/ntgdi/dcstate.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ IntGdiCleanDC(HDC hDC)
8888
DC_vUpdateTextBrush(dc);
8989
}
9090

91+
// Remove Path and reset flags.
92+
if (dc->dclevel.hPath)
93+
{
94+
DPRINT("Clean DC Remove Path\n");
95+
if (!PATH_Delete(dc->dclevel.hPath))
96+
{
97+
DPRINT1("Failed to remove Path\n");
98+
}
99+
dc->dclevel.hPath = 0;
100+
dc->dclevel.flPath = 0;
101+
}
102+
91103
/* DC_vCopyState frees the Clip rgn and the Meta rgn. Take care of the other ones
92104
* There is no need to clear prgnVis, as UserGetDC updates it immediately. */
93105
if (dc->prgnRao)
@@ -175,13 +187,9 @@ DC_vRestoreDC(
175187
if (pdc->dctype == DCTYPE_MEMORY)
176188
DC_vSelectSurface(pdc, pdcSave->dclevel.pSurface);
177189

178-
// Restore Path by removing it, if the Save flag is set.
179-
// BeginPath will takecare of the rest.
180-
if (pdc->dclevel.hPath && pdc->dclevel.flPath & DCPATH_SAVE)
190+
if (pdcSave->dclevel.hPath)
181191
{
182-
PATH_Delete(pdc->dclevel.hPath);
183-
pdc->dclevel.hPath = 0;
184-
pdc->dclevel.flPath &= ~DCPATH_SAVE;
192+
PATH_RestorePath( pdc, pdcSave );
185193
}
186194
}
187195

@@ -294,10 +302,11 @@ NtGdiSaveDC(
294302
DC_vSelectSurface(pdcSave, pdc->dclevel.pSurface);
295303

296304
/* Copy path */
297-
/* FIXME: Why this way? */
298-
pdcSave->dclevel.hPath = pdc->dclevel.hPath;
305+
if (pdc->dclevel.hPath)
306+
{
307+
PATH_SavePath( pdcSave, pdc );
308+
}
299309
pdcSave->dclevel.flPath = pdc->dclevel.flPath | DCPATH_SAVESTATE;
300-
if (pdcSave->dclevel.hPath) pdcSave->dclevel.flPath |= DCPATH_SAVE;
301310

302311
/* Set new dc as save dc */
303312
pdcSave->dclevel.hdcSave = pdc->dclevel.hdcSave;

0 commit comments

Comments
 (0)