mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
box-drawing: wedges: pre-load x_halfs[] and y_thirds[]
This reduces the number of loads in the rest of the function.
This commit is contained in:
parent
0e10d2b1a2
commit
97e64e2caf
1 changed files with 71 additions and 64 deletions
135
box-drawing.c
135
box-drawing.c
|
|
@ -2118,242 +2118,249 @@ draw_wedge_triangle(struct buf *buf, wchar_t wc)
|
|||
const int width = buf->width;
|
||||
const int height = buf->height;
|
||||
|
||||
int halfs0 = buf->x_halfs[0];
|
||||
int halfs1 = buf->x_halfs[1];
|
||||
int thirds0 = buf->y_thirds[0];
|
||||
int thirds1 = buf->y_thirds[1];
|
||||
int thirds2 = buf->y_thirds[2];
|
||||
int thirds3 = buf->y_thirds[3];
|
||||
|
||||
int p1_x, p1_y, p2_x, p2_y, p3_x, p3_y;
|
||||
|
||||
switch (wc) {
|
||||
case 0x1fb3c: /* 🬼 */
|
||||
p1_x = p2_x = 0; p3_x = buf->x_halfs[0];
|
||||
p1_y = buf->y_thirds[3]; p2_y = p3_y = height;
|
||||
p1_x = p2_x = 0; p3_x = halfs0;
|
||||
p1_y = thirds3; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb52: /* 🭒 */
|
||||
p1_x = p2_x = 0; p3_x = buf->x_halfs[0];
|
||||
p1_y = buf->y_thirds[2]; p2_y = p3_y = height;
|
||||
p1_x = p2_x = 0; p3_x = halfs0;
|
||||
p1_y = thirds2; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb3d: /* 🬽 */
|
||||
p1_x = p2_x = 0; p3_x = width;
|
||||
p1_y = buf->y_thirds[3]; p2_y = p3_y = height;
|
||||
p1_y = thirds3; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb53: /* 🭓 */
|
||||
p1_x = p2_x = 0; p3_x = width;
|
||||
p1_y = buf->y_thirds[2]; p2_y = p3_y = height;
|
||||
p1_y = thirds2; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb3e: /* 🬾 */
|
||||
p1_x = p2_x = 0; p3_x = buf->x_halfs[0];
|
||||
p1_y = buf->y_thirds[1]; p2_y = p3_y = height;
|
||||
p1_x = p2_x = 0; p3_x = halfs0;
|
||||
p1_y = thirds1; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb54: /* 🭔 */
|
||||
p1_x = p2_x = 0; p3_x = buf->x_halfs[0];
|
||||
p1_y = buf->y_thirds[0]; p2_y = p3_y = height;
|
||||
p1_x = p2_x = 0; p3_x = halfs0;
|
||||
p1_y = thirds0; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb3f: /* 🬿 */
|
||||
p1_x = p2_x = 0; p3_x = width;
|
||||
p1_y = buf->y_thirds[1]; p2_y = p3_y = height;
|
||||
p1_y = thirds1; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb55: /* 🭕 */
|
||||
p1_x = p2_x = 0; p3_x = width;
|
||||
p1_y = buf->y_thirds[0]; p2_y = p3_y = height;
|
||||
p1_y = thirds0; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb40: /* 🭀 */
|
||||
case 0x1fb56: /* 🭖 */
|
||||
p1_x = p2_x = 0; p3_x = buf->x_halfs[0];
|
||||
p1_x = p2_x = 0; p3_x = halfs0;
|
||||
p1_y = 0; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb47: /* 🭇 */
|
||||
p1_x = p2_x = width; p3_x = buf->x_halfs[1];
|
||||
p1_y = buf->y_thirds[3]; p2_y = p3_y = height;
|
||||
p1_x = p2_x = width; p3_x = halfs1;
|
||||
p1_y = thirds3; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb5d: /* 🭝 */
|
||||
p1_x = p2_x = width; p3_x = buf->x_halfs[1];
|
||||
p1_y = buf->y_thirds[2]; p2_y = p3_y = height;
|
||||
p1_x = p2_x = width; p3_x = halfs1;
|
||||
p1_y = thirds2; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb48: /* 🭈 */
|
||||
p1_x = p2_x = width; p3_x = 0;
|
||||
p1_y = buf->y_thirds[3]; p2_y = p3_y = height;
|
||||
p1_y = thirds3; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb5e: /* 🭞 */
|
||||
p1_x = p2_x = width; p3_x = 0;
|
||||
p1_y = buf->y_thirds[2]; p2_y = p3_y = height;
|
||||
p1_y = thirds2; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb49: /* 🭉 */
|
||||
p1_x = p2_x = width; p3_x = buf->x_halfs[1];
|
||||
p1_y = buf->y_thirds[1]; p2_y = p3_y = height;
|
||||
p1_x = p2_x = width; p3_x = halfs1;
|
||||
p1_y = thirds1; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb5f: /* 🭟 */
|
||||
p1_x = p2_x = width; p3_x = buf->x_halfs[1];
|
||||
p1_y = buf->y_thirds[0]; p2_y = p3_y = height;
|
||||
p1_x = p2_x = width; p3_x = halfs1;
|
||||
p1_y = thirds0; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb4a: /* 🭊 */
|
||||
p1_x = p2_x = width; p3_x = 0;
|
||||
p1_y = buf->y_thirds[1]; p2_y = p3_y = height;
|
||||
p1_y = thirds1; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb60: /* 🭠 */
|
||||
p1_x = p2_x = width; p3_x = 0;
|
||||
p1_y = buf->y_thirds[0]; p2_y = p3_y = height;
|
||||
p1_y = thirds0; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb4b: /* 🭋 */
|
||||
case 0x1fb61: /* 🭡 */
|
||||
p1_x = p2_x = width; p3_x = buf->x_halfs[1];
|
||||
p1_x = p2_x = width; p3_x = halfs1;
|
||||
p1_y = 0; p2_y = p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb57: /* 🭗 */
|
||||
p1_x = p2_x = 0; p3_x = buf->x_halfs[0];
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[0];
|
||||
p1_x = p2_x = 0; p3_x = halfs0;
|
||||
p1_y = p3_y = 0; p2_y = thirds0;
|
||||
break;
|
||||
|
||||
case 0x1fb41: /* 🭁 */
|
||||
p1_x = p2_x = 0; p3_x = buf->x_halfs[0];
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[1];
|
||||
p1_x = p2_x = 0; p3_x = halfs0;
|
||||
p1_y = p3_y = 0; p2_y = thirds1;
|
||||
break;
|
||||
|
||||
case 0x1fb58: /* 🭘 */
|
||||
p1_x = p2_x = 0; p3_x = width;
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[0];
|
||||
p1_y = p3_y = 0; p2_y = thirds0;
|
||||
break;
|
||||
|
||||
case 0x1fb42: /* 🭂 */
|
||||
p1_x = p2_x = 0; p3_x = width;
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[1];
|
||||
p1_y = p3_y = 0; p2_y = thirds1;
|
||||
break;
|
||||
|
||||
case 0x1fb59: /* 🭙 */
|
||||
p1_x = p2_x = 0; p3_x = buf->x_halfs[0];
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[2];
|
||||
p1_x = p2_x = 0; p3_x = halfs0;
|
||||
p1_y = p3_y = 0; p2_y = thirds2;
|
||||
break;
|
||||
|
||||
case 0x1fb43: /* 🭃 */
|
||||
p1_x = p2_x = 0; p3_x = buf->x_halfs[0];
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[3];
|
||||
p1_x = p2_x = 0; p3_x = halfs0;
|
||||
p1_y = p3_y = 0; p2_y = thirds3;
|
||||
break;
|
||||
|
||||
case 0x1fb5a: /* 🭚 */
|
||||
p1_x = p2_x = 0; p3_x = width;
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[2];
|
||||
p1_y = p3_y = 0; p2_y = thirds2;
|
||||
break;
|
||||
|
||||
case 0x1fb44: /* 🭄 */
|
||||
p1_x = p2_x = 0; p3_x = width;
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[3];
|
||||
p1_y = p3_y = 0; p2_y = thirds3;
|
||||
break;
|
||||
|
||||
case 0x1fb5b: /* 🭛 */
|
||||
case 0x1fb45: /* 🭅 */
|
||||
p1_x = p2_x = 0; p3_x = buf->x_halfs[0];
|
||||
p1_x = p2_x = 0; p3_x = halfs0;
|
||||
p1_y = p3_y = 0; p2_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb62: /* 🭢 */
|
||||
p1_x = p2_x = width; p3_x = buf->x_halfs[1];
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[0];
|
||||
p1_x = p2_x = width; p3_x = halfs1;
|
||||
p1_y = p3_y = 0; p2_y = thirds0;
|
||||
break;
|
||||
|
||||
case 0x1fb4c: /* 🭌 */
|
||||
p1_x = p2_x = width; p3_x = buf->x_halfs[1];
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[1];
|
||||
p1_x = p2_x = width; p3_x = halfs1;
|
||||
p1_y = p3_y = 0; p2_y = thirds1;
|
||||
break;
|
||||
|
||||
case 0x1fb63: /* 🭣 */
|
||||
p1_x = p2_x = width; p3_x = 0;
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[0];
|
||||
p1_y = p3_y = 0; p2_y = thirds0;
|
||||
break;
|
||||
|
||||
case 0x1fb4d: /* 🭍 */
|
||||
p1_x = p2_x = width; p3_x = 0;
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[1];
|
||||
p1_y = p3_y = 0; p2_y = thirds1;
|
||||
break;
|
||||
|
||||
case 0x1fb64: /* 🭤 */
|
||||
p1_x = p2_x = width; p3_x = buf->x_halfs[1];
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[2];
|
||||
p1_x = p2_x = width; p3_x = halfs1;
|
||||
p1_y = p3_y = 0; p2_y = thirds2;
|
||||
break;
|
||||
|
||||
case 0x1fb4e: /* 🭎 */
|
||||
p1_x = p2_x = width; p3_x = buf->x_halfs[1];
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[3];
|
||||
p1_x = p2_x = width; p3_x = halfs1;
|
||||
p1_y = p3_y = 0; p2_y = thirds3;
|
||||
break;
|
||||
|
||||
case 0x1fb65: /* 🭥 */
|
||||
p1_x = p2_x = width; p3_x = 0;
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[2];
|
||||
p1_y = p3_y = 0; p2_y = thirds2;
|
||||
break;
|
||||
|
||||
case 0x1fb4f: /* 🭏 */
|
||||
p1_x = p2_x = width; p3_x = 0;
|
||||
p1_y = p3_y = 0; p2_y = buf->y_thirds[3];
|
||||
p1_y = p3_y = 0; p2_y = thirds3;
|
||||
break;
|
||||
|
||||
case 0x1fb66: /* 🭦 */
|
||||
case 0x1fb50: /* 🭐 */
|
||||
p1_x = p2_x = width; p3_x = buf->x_halfs[1];
|
||||
p1_x = p2_x = width; p3_x = halfs1;
|
||||
p1_y = p3_y = 0; p2_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb46: /* 🭆 */
|
||||
p1_x = 0; p1_y = buf->y_thirds[2];
|
||||
p2_x = width; p2_y = buf->y_thirds[1];
|
||||
p1_x = 0; p1_y = thirds2;
|
||||
p2_x = width; p2_y = thirds1;
|
||||
p3_x = width; p3_y = p1_y;
|
||||
break;
|
||||
|
||||
case 0x1fb51: /* 🭑 */
|
||||
p1_x = 0; p1_y = buf->y_thirds[1];
|
||||
p2_x = 0; p2_y = buf->y_thirds[2];
|
||||
p1_x = 0; p1_y = thirds1;
|
||||
p2_x = 0; p2_y = thirds2;
|
||||
p3_x = width; p3_y = p2_y;
|
||||
break;
|
||||
|
||||
case 0x1fb5c: /* 🭜 */
|
||||
p1_x = 0; p1_y = buf->y_thirds[1];
|
||||
p2_x = 0; p2_y = buf->y_thirds[2];
|
||||
p1_x = 0; p1_y = thirds1;
|
||||
p2_x = 0; p2_y = thirds2;
|
||||
p3_x = width; p3_y = p1_y;
|
||||
break;
|
||||
|
||||
case 0x1fb67: /* 🭧 */
|
||||
p1_x = 0; p1_y = buf->y_thirds[1];
|
||||
p1_x = 0; p1_y = thirds1;
|
||||
p2_x = width; p2_y = p1_y;
|
||||
p3_x = width; p3_y = buf->y_thirds[2];
|
||||
p3_x = width; p3_y = thirds2;
|
||||
break;
|
||||
|
||||
case 0x1fb6c: /* 🭬 */
|
||||
case 0x1fb68: /* 🭨 */
|
||||
p1_x = 0; p1_y = 0;
|
||||
p2_x = buf->x_halfs[0]; p2_y = height / 2;
|
||||
p2_x = halfs0; p2_y = height / 2;
|
||||
p3_x = 0; p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb6d: /* 🭭 */
|
||||
case 0x1fb69: /* 🭩 */
|
||||
p1_x = 0; p1_y = 0;
|
||||
p2_x = buf->x_halfs[1]; p2_y = height / 2;
|
||||
p2_x = halfs1; p2_y = height / 2;
|
||||
p3_x = width; p3_y = 0;
|
||||
break;
|
||||
|
||||
case 0x1fb6e: /* 🭮 */
|
||||
case 0x1fb6a: /* 🭪 */
|
||||
p1_x = width; p1_y = 0;
|
||||
p2_x = buf->x_halfs[1]; p2_y = height / 2;
|
||||
p2_x = halfs1; p2_y = height / 2;
|
||||
p3_x = width; p3_y = height;
|
||||
break;
|
||||
|
||||
case 0x1fb6f: /* 🭯 */
|
||||
case 0x1fb6b: /* 🭫 */
|
||||
p1_x = 0; p1_y = height;
|
||||
p2_x = buf->x_halfs[1]; p2_y = height / 2;
|
||||
p2_x = halfs1; p2_y = height / 2;
|
||||
p3_x = width; p3_y = height;
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue