summaryrefslogtreecommitdiff
path: root/draw.c
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2019-09-29 05:58:54 +0100
committerKatolaZ <katolaz@freaknet.org>2019-09-29 05:58:54 +0100
commit6dddf567f41d43335698598d310c161fb01462ac (patch)
tree9b006d56e73d93555293a5532e913436e7d11892 /draw.c
parent646c1c1cc7ecc0cef7f619ae01457659817e5d05 (diff)
fix toggle trapezium type
Diffstat (limited to 'draw.c')
-rw-r--r--draw.c70
1 files changed, 57 insertions, 13 deletions
diff --git a/draw.c b/draw.c
index 51a27b2..30d0945 100644
--- a/draw.c
+++ b/draw.c
@@ -226,7 +226,7 @@ void draw_trapezium(int x1, int y1, char st, char fix){
f = draw_xy;
/* This is valid only for "upper" trapezoids */
- if ((st & BOX_TRAP_U) == BOX_TRAP_U){
+ if (STYLE_IS(st, BOX_TRAP_U)){
#ifdef DEBUG
fprintf(stderr, "This is an 'upward' trapezium\n");
#endif
@@ -237,7 +237,7 @@ void draw_trapezium(int x1, int y1, char st, char fix){
left_c = '/';
right_c = '\\';
}
- else if ((st & BOX_TRAP_D) == BOX_TRAP_D){
+ else if (STYLE_IS(st, BOX_TRAP_D)){
#ifdef DEBUG
fprintf(stderr, "This is a 'downward' trapezium\n");
#endif
@@ -248,25 +248,69 @@ void draw_trapezium(int x1, int y1, char st, char fix){
right_c = '/';
left_c = '\\';
}
+ /* Long side */
for(i=xmin+1; i<=xmax; i++){
f(i, ylong, line_h);
}
- if (st & 0x02){ /* Centred trapezium */
- for(i=xmin+xoff; i<=xmax-xoff; i++){
+ /* short side */
+ for(i=xmin+xoff; i<=xmax-xoff; i++){
+ f(i, yshort, line_h);
+ }
+
+ if (STYLE_IS(st, BOX_TRAP_L)){
+ left_c = '/';
+ right_c = line_v;
+ for(i=xmax-xoff;i<xmax; i++){
f(i, yshort, line_h);
}
+ xoff = dy;
+ if (STYLE_IS(st, BOX_TRAP_D)){
+ xoff = 0;
+ left_c = '\\';
+ }
+ for(i=ymin; i<ymax; i++, xoff += xincr){
+ f(xmin+xoff, i, left_c);
+ f(xmax, i, right_c);
+ }
+ xoff = dy;
+ f(xmin+xoff, yshort, corner);
+ f(xmax, yshort, corner);
}
- f(xmin+xoff, yshort, corner);
+ else if (STYLE_IS(st, BOX_TRAP_R)){
+ right_c = '\\';
+ left_c = line_v;
+ for(i=xmin; i<xmin+xoff; i++){
+ f(i, yshort, line_h);
+ }
+ xoff = dy-1;
+ if (STYLE_IS(st, BOX_TRAP_D)){
+ xoff = 1;
+ right_c = '/';
+ }
+ for(i=ymin+1; i<ymax; i++, xoff += xincr){
+ f(xmin, i, left_c);
+ f(xmax-xoff, i, right_c);
+ }
+ xoff = dy;
+ f(xmin, yshort, corner);
+ f(xmax-xoff, yshort, corner);
+ }
+ else if (STYLE_IS(st, BOX_TRAP_C)){
+ xoff = dy - 1;
+ if (STYLE_IS(st, BOX_TRAP_D))
+ xoff = 1;
+ for(i=ymin+1; i<ymax; i++, xoff += xincr){
+ 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, ylong, corner);
- f(xmax-xoff, yshort, corner);
f(xmax, ylong, corner);
- xoff --;
- if ((st & BOX_TRAP_DC) == BOX_TRAP_DC)
- xoff = 1;
- for(i=ymin+1; i<ymax; i++, xoff += xincr){
- f(xmin + xoff, i, left_c);
- f(xmax - xoff, i, right_c);
- }
if (fix == FIX)