From 4985f77483adc443fe04abb2e7392e10275266ed Mon Sep 17 00:00:00 2001 From: Domingo Date: Fri, 5 Apr 2019 15:48:17 +0200 Subject: [PATCH] Solves bug drawing regtangles and dashed lines. --- bgrapen.pas | 13 ++++++++++--- geometrytypes.inc | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/bgrapen.pas b/bgrapen.pas index 9bf5ea7..df7325a 100644 --- a/bgrapen.pas +++ b/bgrapen.pas @@ -694,8 +694,15 @@ procedure ApplyPenStyle(const leftPts, rightPts: array of TPointF; const penstyl procedure StartDash(index: integer; t: single); begin dashStartIndex := index; - dashLeftStartPos := leftPts[index] + (leftPts[index+1]-leftPts[index])*t; - dashRightStartPos := rightPts[index] + (rightPts[index+1]-rightPts[index])*t; + if t = 0 then + begin + dashLeftStartPos := leftPts[index]; + dashRightStartPos := rightPts[index]; + end else + begin + dashLeftStartPos := leftPts[index] + (leftPts[index+1]-leftPts[index])*t; + dashRightStartPos := rightPts[index] + (rightPts[index+1]-rightPts[index])*t; + end; betweenDash := false; end; @@ -799,7 +806,7 @@ procedure ApplyPenStyle(const leftPts, rightPts: array of TPointF; const penstyl begin if len-lenDone < remainingDash then begin - remainingDash := remainingDash -len-lenDone; + remainingDash := remainingDash - (len-lenDone); if remainingDash = 0 then NextStyleIndex; lenDone := len; end else diff --git a/geometrytypes.inc b/geometrytypes.inc index 165a034..7b15091 100644 --- a/geometrytypes.inc +++ b/geometrytypes.inc @@ -1065,7 +1065,7 @@ end; class operator TPointF.NotEqual(const pt1, pt2: TPointF): boolean; begin - result := (pt1.x <> pt2.x) and (pt1.y <> pt2.y); + result := (pt1.x <> pt2.x) or (pt1.y <> pt2.y); end; class operator TPointF.Subtract(const pt1, pt2: TPointF): TPointF;