summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2019-09-29 21:08:57 +0100
committerKatolaZ <katolaz@freaknet.org>2019-09-29 21:08:57 +0100
commitc5123472d732ee8d512c914707251b0053d758e1 (patch)
tree2f356cd85697cc20412d75759e28d9b5a0b8e4ce
parent6dddf567f41d43335698598d310c161fb01462ac (diff)
fix short side in left and right trapezium
-rw-r--r--draw.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/draw.c b/draw.c
index 30d0945..711d1ae 100644
--- a/draw.c
+++ b/draw.c
@@ -215,9 +215,12 @@ void draw_trapezium(int x1, int y1, char st, char fix){
xmax = MAX(x, x1);
ymin = MIN(y, y1);
ymax = MAX(y, y1);
- dx = xmax - xmin;
+ dx = (xmax - xmin);
dy = ymax - ymin;
-
+ /* dy = MAX(dx2, dy); */
+#ifdef DEBUG
+ fprintf(stderr, "dy: %d dx: %d\n", dy, dx);
+#endif
if (fix == FIX){
f = set_xy;
copy_lines_to_ring(ymin, ymax, PRV_STATE);
@@ -252,15 +255,12 @@ void draw_trapezium(int x1, int y1, char st, char fix){
for(i=xmin+1; i<=xmax; i++){
f(i, ylong, line_h);
}
- /* short side */
- for(i=xmin+xoff; i<=xmax-xoff; i++){
- f(i, yshort, line_h);
- }
if (STYLE_IS(st, BOX_TRAP_L)){
+ /* short side */
left_c = '/';
right_c = line_v;
- for(i=xmax-xoff;i<xmax; i++){
+ for(i=xmin+xoff;i<xmax; i++){
f(i, yshort, line_h);
}
xoff = dy;
@@ -272,14 +272,13 @@ void draw_trapezium(int x1, int y1, char st, char fix){
f(xmin+xoff, i, left_c);
f(xmax, i, right_c);
}
- xoff = dy;
- f(xmin+xoff, yshort, corner);
+ f(xmin+dy, yshort, corner);
f(xmax, yshort, corner);
}
else if (STYLE_IS(st, BOX_TRAP_R)){
right_c = '\\';
left_c = line_v;
- for(i=xmin; i<xmin+xoff; i++){
+ for(i=xmin; i<xmax-xoff; i++){
f(i, yshort, line_h);
}
xoff = dy-1;
@@ -291,11 +290,14 @@ void draw_trapezium(int x1, int y1, char st, char fix){
f(xmin, i, left_c);
f(xmax-xoff, i, right_c);
}
- xoff = dy;
f(xmin, yshort, corner);
- f(xmax-xoff, yshort, corner);
+ f(xmax-dy, yshort, corner);
}
else if (STYLE_IS(st, BOX_TRAP_C)){
+ xoff = dy;
+ for (i=xmin+xoff; i<=xmax-xoff; i++){
+ f(i, yshort, line_h);
+ }
xoff = dy - 1;
if (STYLE_IS(st, BOX_TRAP_D))
xoff = 1;
@@ -303,9 +305,8 @@ void draw_trapezium(int x1, int y1, char st, char fix){
f(xmin + xoff, i, left_c);
f(xmax - xoff, i, right_c);
}
- xoff = dy;
- f(xmin+xoff, yshort, corner);
- f(xmax-xoff, yshort, corner);
+ f(xmin+dy, yshort, corner);
+ f(xmax-dy, yshort, corner);
}