From a02535fc030f4fc586d7284c6eec24615ef907dc Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Wed, 18 Sep 2013 19:14:42 +0430 Subject: [PATCH] pad: replace FN_C() with FN_C mask --- fbpad.h | 5 +++-- pad.c | 9 ++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/fbpad.h b/fbpad.h index b479d1b..5e2956f 100644 --- a/fbpad.h +++ b/fbpad.h @@ -47,8 +47,9 @@ void term_hist(int pos); void term_redraw(void); /* pad.c */ -#define FN_I 0x100 -#define FN_B 0x200 +#define FN_I 0x100 /* italic font */ +#define FN_B 0x200 /* bold font */ +#define FN_C 0x0ff /* font color mask */ int pad_init(void); void pad_free(void); diff --git a/pad.c b/pad.c index 2fa7b36..2bf485c 100644 --- a/pad.c +++ b/pad.c @@ -6,7 +6,6 @@ #include "draw.h" #include "fbpad.h" -#define FN_C(fg) ((fg) & ~(FN_I | FN_B)) #define NCACHE (1 << 11) #define MAXFBWIDTH (1 << 12) @@ -129,7 +128,7 @@ static fbval_t *ch2fb(int fn, int c, short fg, short bg) if (font_bitmap(fonts[fn], bits, c)) return NULL; fbbits = glyph_add(c, fg, bg); - bmp2fb(fbbits, bits, FN_C(fg), FN_C(bg), + bmp2fb(fbbits, bits, fg & FN_C, bg & FN_C, font_rows(fonts[fn]), font_cols(fonts[fn])); return fbbits; } @@ -166,7 +165,7 @@ void pad_put(int ch, int r, int c, int fg, int bg) if (!bits) bits = ch2fb(0, ch, fg, bg); if (!bits) - fb_box(sr, sc, sr + fnrows, sc + fncols, color2fb(FN_C(bg))); + fb_box(sr, sc, sr + fnrows, sc + fncols, color2fb(bg & FN_C)); else for (i = 0; i < fnrows; i++) fb_set(sr + i, sc, bits + (i * fncols), fncols); @@ -174,14 +173,14 @@ void pad_put(int ch, int r, int c, int fg, int bg) void pad_blank(int c) { - fb_box(0, 0, fb_rows(), fb_cols(), color2fb(FN_C(c))); + fb_box(0, 0, fb_rows(), fb_cols(), color2fb(c & FN_C)); } void pad_blankrow(int r, int bg) { int sr = r * fnrows; int er = r == rows - 1 ? fb_rows() : (r + 1) * fnrows; - fb_box(sr, 0, er, fb_cols(), color2fb(FN_C(bg))); + fb_box(sr, 0, er, fb_cols(), color2fb(bg & FN_C)); } int pad_rows(void) -- 2.11.4.GIT