From dc9f5a9775723dde76b7a0940b549531002d16ef Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Thu, 26 Oct 2017 16:44:57 +0900 Subject: [PATCH] pen width dirty hack --- win32ss/gdi/ntgdi/line.c | 112 +++++++++++++++++++++++++++++++++-------------- win32ss/gdi/ntgdi/path.c | 1 - 2 files changed, 79 insertions(+), 34 deletions(-) diff --git a/win32ss/gdi/ntgdi/line.c b/win32ss/gdi/ntgdi/line.c index 5e53b0b24b..efec739e5d 100644 --- a/win32ss/gdi/ntgdi/line.c +++ b/win32ss/gdi/ntgdi/line.c @@ -3,7 +3,7 @@ * LICENSE: GPL - See COPYING in the top level directory * FILE: win32ss/gdi/ntgdi/line.c * PURPOSE: Line functions - * PROGRAMMERS: ... + * PROGRAMMERS: Katayama Hirofumi MZ */ #include @@ -144,6 +144,19 @@ IntGetCurrentPositionEx(PDC dc, LPPOINT pt) } } +PPATH FASTCALL +PATH_CreatePath(int count); + +BOOL +FASTCALL +PATH_MoveTo( + PDC dc, + PPATH pPath); + +PPATH +FASTCALL +PATH_WidenPath(DC *dc); + BOOL FASTCALL IntGdiLineTo(DC *dc, int XEnd, @@ -170,46 +183,79 @@ IntGdiLineTo(DC *dc, return FALSE; } - Points[0].x = pdcattr->ptlCurrent.x; - Points[0].y = pdcattr->ptlCurrent.y; - Points[1].x = XEnd; - Points[1].y = YEnd; - - IntLPtoDP(dc, Points, 2); - - /* The DCOrg is in device coordinates */ - Points[0].x += dc->ptlDCOrig.x; - Points[0].y += dc->ptlDCOrig.y; - Points[1].x += dc->ptlDCOrig.x; - Points[1].y += dc->ptlDCOrig.y; - - Bounds.left = min(Points[0].x, Points[1].x); - Bounds.top = min(Points[0].y, Points[1].y); - Bounds.right = max(Points[0].x, Points[1].x); - Bounds.bottom = max(Points[0].y, Points[1].y); - /* Get BRUSH from current pen. */ pbrLine = dc->dclevel.pbrLine; ASSERT(pbrLine); - if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR)) + if (((pbrLine->ulPenStyle & PS_TYPE_MASK) & PS_GEOMETRIC) || + pbrLine->lWidth > 1) { - DPRINT("Bounds dc %p l %d t %d\n",dc,Bounds.left,Bounds.top); - DPRINT(" r %d b %d\n",Bounds.right,Bounds.bottom); - AddPenLinesBounds(dc, 2, Points); - } + EBRUSHOBJ eboFill; - if (!(pbrLine->flAttrs & BR_IS_NULL)) - { - Ret = IntEngLineTo(&psurf->SurfObj, - (CLIPOBJ *)&dc->co, - &dc->eboLine.BrushObject, - Points[0].x, Points[0].y, - Points[1].x, Points[1].y, - &Bounds, - ROP2_TO_MIX(pdcattr->jROP2)); + PPATH pPath = PATH_CreatePath(2); + + if (dc->dclevel.hPath) + { + PATH_Delete(dc->dclevel.hPath); + } + dc->dclevel.hPath = pPath->BaseObject.hHmgr; + + PATH_MoveTo(dc, pPath); + PATH_LineTo(dc, XEnd, YEnd); + + pPath->state = PATH_Closed; + dc->dclevel.flPath &= ~DCPATH_ACTIVE; + + pPath = PATH_WidenPath(dc); + + eboFill = dc->eboFill; + dc->eboFill = dc->eboLine; + Ret = PATH_FillPath(dc, pPath); + dc->eboFill = eboFill; + + if (dc->dclevel.hPath) + { + PATH_Delete(dc->dclevel.hPath); + dc->dclevel.hPath = NULL; + } } + else + { + Points[0].x = pdcattr->ptlCurrent.x; + Points[0].y = pdcattr->ptlCurrent.y; + Points[1].x = XEnd; + Points[1].y = YEnd; + IntLPtoDP(dc, Points, 2); + + /* The DCOrg is in device coordinates */ + Points[0].x += dc->ptlDCOrig.x; + Points[0].y += dc->ptlDCOrig.y; + Points[1].x += dc->ptlDCOrig.x; + Points[1].y += dc->ptlDCOrig.y; + + Bounds.left = min(Points[0].x, Points[1].x); + Bounds.top = min(Points[0].y, Points[1].y); + Bounds.right = max(Points[0].x, Points[1].x); + Bounds.bottom = max(Points[0].y, Points[1].y); + if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR)) + { + DPRINT("Bounds dc %p l %d t %d\n",dc,Bounds.left,Bounds.top); + DPRINT(" r %d b %d\n",Bounds.right,Bounds.bottom); + AddPenLinesBounds(dc, 2, Points); + } + + if (!(pbrLine->flAttrs & BR_IS_NULL)) + { + Ret = IntEngLineTo(&psurf->SurfObj, + (CLIPOBJ *)&dc->co, + &dc->eboLine.BrushObject, + Points[0].x, Points[0].y, + Points[1].x, Points[1].y, + &Bounds, + ROP2_TO_MIX(pdcattr->jROP2)); + } + } } if (Ret) diff --git a/win32ss/gdi/ntgdi/path.c b/win32ss/gdi/ntgdi/path.c index 5a014a3e03..b80d7f3803 100644 --- a/win32ss/gdi/ntgdi/path.c +++ b/win32ss/gdi/ntgdi/path.c @@ -1709,7 +1709,6 @@ end: #define round(x) ((int)((x)>0?(x)+0.5:(x)-0.5)) -static PPATH FASTCALL PATH_WidenPath(DC *dc) -- 2.14.2