sprintf (attr, "%08x = fg %d bg %d%s%s%s%s%s%s",
(int)r,
- GET_FGCOLOR (r), GET_BGCOLOR (r),
+ fgcolor_of (r), bgcolor_of (r),
r & RS_Bold ? " bold" : "",
r & RS_Italic ? " italic" : "",
r & RS_Blink ? " blink" : "",
/* how to build & extract colors and attributes */
#define GET_BASEFG(x) (((x) & RS_fgMask))
#define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits)
-#ifndef NO_BRIGHTCOLOR
-# define GET_FGCOLOR(x) ( \
- !((x) & RS_Bold) \
- || (ENABLE_STYLES && !(options & Opt_intensityStyles)) \
- || !IN_RANGE_INC (GET_BASEFG (x), minCOLOR, minBrightCOLOR) \
- ? GET_BASEFG (x) \
- : (GET_BASEFG (x) + (minBrightCOLOR - minCOLOR)))
-# define GET_BGCOLOR(x) ( \
- !((x) & RS_Blink) \
- || (ENABLE_STYLES && !(options & Opt_intensityStyles)) \
- || !IN_RANGE_INC (GET_BASEBG (x), minCOLOR, minBrightCOLOR) \
- ? GET_BASEBG (x) \
- : (GET_BASEBG (x) + (minBrightCOLOR - minCOLOR)))
-#else
-# define GET_FGCOLOR(x) GET_BASEFG(x)
-# define GET_BGCOLOR(x) GET_BASEBG(x)
-#endif
#define GET_FONT(x) (((x) & RS_fontMask) >> RS_fontShift)
#define SET_FONT(x,fid) (((x) & ~RS_fontMask) | ((fid) << RS_fontShift))
scr_blank_line (l, prev_ncol, ncol - prev_ncol, DEFAULT_RSTYLE);
}
+ int fgcolor_of (rend_t r)
+ {
+ int base = GET_BASEFG (r);
+#ifndef NO_BRIGHTCOLOR
+ if (r & RS_Bold
+ && (!ENABLE_STYLES || options & Opt_intensityStyles)
+ && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR))
+ base += minBrightCOLOR - minCOLOR;
+#endif
+ return base;
+ }
+
+ int bgcolor_of (rend_t r)
+ {
+ int base = GET_BASEBG (r);
+#ifndef NO_BRIGHTCOLOR
+ if (r & RS_Blink
+ && (!ENABLE_STYLES || options & Opt_intensityStyles)
+ && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR))
+ base += minBrightCOLOR - minCOLOR;
+#endif
+ return base;
+ }
+
void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs);
void scr_blank_screen_mem (line_t &l, rend_t efs);
int scr_scroll_text (int row1, int row2, int count);
else
{
ren = rstyle & (RS_fgMask | RS_bgMask);
- gcvalue.foreground = pix_colors[GET_BGCOLOR (rstyle)];
+ gcvalue.foreground = pix_colors[bgcolor_of (rstyle)];
XChangeGC (display->display, gc, GCForeground, &gcvalue);
ERASE_ROWS (row, num);
gcvalue.foreground = pix_colors[Color_fg];
ccol1 = Color_cursor;
else
#ifdef CURSOR_COLOR_IS_RENDITION_COLOR
- ccol1 = GET_FGCOLOR (rstyle);
+ ccol1 = fgcolor_of (rstyle);
#else
ccol1 = Color_fg;
#endif
ccol2 = Color_cursor2;
else
#ifdef CURSOR_COLOR_IS_RENDITION_COLOR
- ccol2 = GET_BGCOLOR (rstyle);
+ ccol2 = bgcolor_of (rstyle);
#else
ccol2 = Color_bg;
#endif
/*
* Determine the attributes for the string
*/
- int fore = GET_FGCOLOR (rend); // desired foreground
- int back = GET_BGCOLOR (rend); // desired background
+ int fore = fgcolor_of (rend); // desired foreground
+ int back = bgcolor_of (rend); // desired background
// only do special processing if any attributes are set, which is unlikely
if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful))