Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solves bug drawing rectangles and dashed lines. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions bgrapen.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion geometrytypes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down