From 6dddf567f41d43335698598d310c161fb01462ac Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Sun, 29 Sep 2019 05:58:54 +0100 Subject: fix toggle trapezium type --- draw.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++------------ gramscii.h | 4 ++++ 2 files changed, 61 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