From 4784315908502f9531450ee4b713cef27d81b91e Mon Sep 17 00:00:00 2001 From: James Tabor Date: Fri, 27 Jun 2008 10:58:11 +0000 Subject: [PATCH] Path needed some love Phase II: - Fixed path coordinate problem by enabling old code and fixing arc move to issues. See that code that everyone thought that had no real use was usefull after all. - Found more image and region problems, see bug 3402. svn path=/trunk/; revision=34128 --- reactos/subsystems/win32/win32k/objects/arc.c | 11 ++----- .../subsystems/win32/win32k/objects/line.c | 4 +-- .../subsystems/win32/win32k/objects/path.c | 32 +++++++++--------- .../subsystems/win32/win32k/objects/region.c | 33 ++++++------------- 4 files changed, 30 insertions(+), 50 deletions(-) diff --git a/reactos/subsystems/win32/win32k/objects/arc.c b/reactos/subsystems/win32/win32k/objects/arc.c index 28b6c574b1f..b0b32749f4f 100644 --- a/reactos/subsystems/win32/win32k/objects/arc.c +++ b/reactos/subsystems/win32/win32k/objects/arc.c @@ -1,4 +1,3 @@ - #include #define NDEBUG @@ -259,8 +258,7 @@ IntGdiArcInternal( if (arctype == GdiTypeArcTo) { - dc->ptlDCOrig.x = EfCx; - dc->ptlDCOrig.y = EfCy; + IntGdiMoveToEx(dc, EfCx, EfCy, NULL); } return Ret; @@ -306,12 +304,7 @@ IntGdiAngleArc( PDC pDC, if (result) { - POINT point; - point.x=x2; - point.y=y2; -// CoordLPtoDP ( pDC, &point ); - pDC->ptlDCOrig.x = point.x; - pDC->ptlDCOrig.y = point.y; + IntGdiMoveToEx(pDC, x2, y2, NULL); } return result; } diff --git a/reactos/subsystems/win32/win32k/objects/line.c b/reactos/subsystems/win32/win32k/objects/line.c index aba8820c5ab..d965426fb36 100644 --- a/reactos/subsystems/win32/win32k/objects/line.c +++ b/reactos/subsystems/win32/win32k/objects/line.c @@ -102,7 +102,7 @@ IntGdiLineTo(DC *dc, if (PATH_IsPathOpen(dc->DcLevel)) { Ret = PATH_LineTo(dc, XEnd, YEnd); -#if 0 +//#if 0 if (Ret) { // FIXME - PATH_LineTo should maybe do this... @@ -112,7 +112,7 @@ IntGdiLineTo(DC *dc, CoordLPtoDP(dc, &Dc_Attr->ptfxCurrent); // Update fx Dc_Attr->ulDirty_ &= ~(DIRTY_PTLCURRENT|DIRTY_PTFXCURRENT|DIRTY_STYLESTATE); } -#endif +//#endif return Ret; } else diff --git a/reactos/subsystems/win32/win32k/objects/path.c b/reactos/subsystems/win32/win32k/objects/path.c index fff456e3587..7947435e560 100644 --- a/reactos/subsystems/win32/win32k/objects/path.c +++ b/reactos/subsystems/win32/win32k/objects/path.c @@ -123,32 +123,32 @@ PATH_FillPath( PDC dc, PPATH pPath ) xform = dc->DcLevel.xformWorld2Wnd; /* Set MM_TEXT */ - IntGdiSetMapMode( dc, MM_TEXT ); - Dc_Attr->ptlViewportOrg.x = 0; - Dc_Attr->ptlViewportOrg.y = 0; - Dc_Attr->ptlWindowOrg.x = 0; - Dc_Attr->ptlWindowOrg.y = 0; +// IntGdiSetMapMode( dc, MM_TEXT ); +// Dc_Attr->ptlViewportOrg.x = 0; +// Dc_Attr->ptlViewportOrg.y = 0; +// Dc_Attr->ptlWindowOrg.x = 0; +// Dc_Attr->ptlWindowOrg.y = 0; graphicsMode = Dc_Attr->iGraphicsMode; - Dc_Attr->iGraphicsMode = GM_ADVANCED; - IntGdiModifyWorldTransform( dc, &xform, MWT_IDENTITY ); - Dc_Attr->iGraphicsMode = graphicsMode; +// Dc_Attr->iGraphicsMode = GM_ADVANCED; +// IntGdiModifyWorldTransform( dc, &xform, MWT_IDENTITY ); +// Dc_Attr->iGraphicsMode = graphicsMode; /* Paint the region */ IntGdiPaintRgn( dc, hrgn ); NtGdiDeleteObject( hrgn ); /* Restore the old mapping mode */ - IntGdiSetMapMode( dc, mapMode ); - Dc_Attr->szlViewportExt = ptViewportExt; - Dc_Attr->ptlViewportOrg = ptViewportOrg; - Dc_Attr->szlWindowExt = ptWindowExt; - Dc_Attr->ptlWindowOrg = ptWindowOrg; +// IntGdiSetMapMode( dc, mapMode ); +// Dc_Attr->szlViewportExt = ptViewportExt; +// Dc_Attr->ptlViewportOrg = ptViewportOrg; +// Dc_Attr->szlWindowExt = ptWindowExt; +// Dc_Attr->ptlWindowOrg = ptWindowOrg; /* Go to GM_ADVANCED temporarily to restore the world transform */ graphicsMode = Dc_Attr->iGraphicsMode; - Dc_Attr->iGraphicsMode = GM_ADVANCED; - IntGdiModifyWorldTransform( dc, &xform, MWT_MAX+1 ); - Dc_Attr->iGraphicsMode = graphicsMode; +// Dc_Attr->iGraphicsMode = GM_ADVANCED; +// IntGdiModifyWorldTransform( dc, &xform, MWT_MAX+1 ); +// Dc_Attr->iGraphicsMode = graphicsMode; return TRUE; } return FALSE; diff --git a/reactos/subsystems/win32/win32k/objects/region.c b/reactos/subsystems/win32/win32k/objects/region.c index 1b8b1a73e00..2b8320e4ad1 100644 --- a/reactos/subsystems/win32/win32k/objects/region.c +++ b/reactos/subsystems/win32/win32k/objects/region.c @@ -1959,7 +1959,7 @@ REGION_CreateFrameRgn( BOOL FASTCALL REGION_LPTODP( - HDC hdc, + PDC dc, HRGN hDest, HRGN hSrc) { @@ -1967,7 +1967,6 @@ REGION_LPTODP( PROSRGNDATA srcObj = NULL; PROSRGNDATA destObj = NULL; - DC * dc = DC_LockDc(hdc); RECT tmpRect; BOOL ret = FALSE; PDC_ATTR Dc_Attr; @@ -2027,7 +2026,6 @@ REGION_LPTODP( REGION_UnlockRgn(destObj); done: - DC_UnlockDc(dc); return ret; } @@ -2878,8 +2876,7 @@ IntGdiPaintRgn( HRGN hRgn ) { - //RECT box; - HRGN tmpVisRgn; //, prevVisRgn; + HRGN tmpVisRgn; PROSRGNDATA visrgn; CLIPOBJ* ClipRegion; BOOL bRet = FALSE; @@ -2889,36 +2886,26 @@ IntGdiPaintRgn( BITMAPOBJ *BitmapObj; PDC_ATTR Dc_Attr; - if (!dc) - return FALSE; + if (!dc) return FALSE; Dc_Attr = dc->pDc_Attr; if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr; - if (!(tmpVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0))) + if (!(tmpVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0))) return FALSE; + + // Transform region into device co-ords + if (!REGION_LPTODP(dc, tmpVisRgn, hRgn) || + NtGdiOffsetRgn(tmpVisRgn, dc->ptlDCOrig.x, dc->ptlDCOrig.y) == ERROR) { - DC_UnlockDc(dc); + NtGdiDeleteObject(tmpVisRgn); return FALSE; } - /* ei enable later - // Transform region into device co-ords - if (!REGION_LPTODP(hDC, tmpVisRgn, hRgn) || NtGdiOffsetRgn(tmpVisRgn, dc->ptlDCOrig.x, dc->ptlDCOrig.y) == ERROR) - { - NtGdiDeleteObject(tmpVisRgn); - DC_UnlockDc(dc); - return FALSE; - } - */ - /* enable when clipping is implemented NtGdiCombineRgn(tmpVisRgn, tmpVisRgn, dc->w.hGCClipRgn, RGN_AND); - */ - //visrgn = REGION_LockRgn(tmpVisRgn); - visrgn = REGION_LockRgn(hRgn); + visrgn = REGION_LockRgn(tmpVisRgn); if (visrgn == NULL) { NtGdiDeleteObject(tmpVisRgn); - DC_UnlockDc(dc); return FALSE; }