summaryrefslogtreecommitdiff
path: root/packages/graph
diff options
context:
space:
mode:
authornickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-08-22 12:54:00 +0000
committernickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-08-22 12:54:00 +0000
commit50ca59ed94b8b99a62d69e2265f3b9884aa22fc5 (patch)
treecaf87ecb5ea4c6701099c9ab32b00375016c0a31 /packages/graph
parentb65083cf950fafe3f3b57263d765cca427de252f (diff)
downloadfpc-50ca59ed94b8b99a62d69e2265f3b9884aa22fc5.tar.gz
* fixed Rectangle, Bar and Bar3D for the cases when x1>x2 or y1>y2
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@15874 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/graph')
-rw-r--r--packages/graph/src/inc/graph.inc34
1 files changed, 33 insertions, 1 deletions
diff --git a/packages/graph/src/inc/graph.inc b/packages/graph/src/inc/graph.inc
index e1a08a216a..69d5b9bc97 100644
--- a/packages/graph/src/inc/graph.inc
+++ b/packages/graph/src/inc/graph.inc
@@ -896,8 +896,21 @@ var
procedure Rectangle(x1,y1,x2,y2:smallint);
-
+ var
+ tmp: smallint;
begin
+ if x1 > x2 then
+ begin
+ tmp := x1;
+ x1 := x2;
+ x2 := tmp;
+ end;
+ if y1 > y2 then
+ begin
+ tmp := y1;
+ y1 := y2;
+ y2 := tmp;
+ end;
{ Do not draw the end points }
Line(x1,y1,x2-1,y1);
Line(x1,y1+1,x1,y2);
@@ -1561,6 +1574,12 @@ end;
y1:=y2;
y2:=y;
end;
+ if x1>x2 then
+ begin
+ y:=x1;
+ x1:=x2;
+ x2:=y;
+ end;
{ Always copy mode for Bars }
origwritemode := CurrentWriteMode;
@@ -1603,6 +1622,19 @@ var
origwritemode : smallint;
OldX, OldY : smallint;
begin
+ if x1 > x2 then
+ begin
+ OldX := x1;
+ x1 := x2;
+ x2 := OldX;
+ end;
+ if y1 > y2 then
+ begin
+ OldY := y1;
+ y1 := y2;
+ y2 := OldY;
+ end;
+
origwritemode := CurrentWriteMode;
CurrentWriteMode := CopyPut;
Bar(x1,y1,x2,y2);