INLINE void map_attr_to_fg_bg(unsigned char attr, rgb_t *fg, rgb_t *bg) { *bg = MAKE_ARGB(0xff,0xff,0xff,0xff); *fg = MAKE_ARGB(0xff,0x00,0x00,0x00); if(attr & DCA_ANCILLARY) *bg = MAKE_ARGB(0xff,0xe0,0xe0,0xe0); if(attr & DCA_SELECTED) { *bg = MAKE_ARGB(0xff,0xff,0x80,0x80); } if(attr & DCA_CURRENT) { *bg = MAKE_ARGB(0xff,0xff,0xff,0x00); } if(attr & DCA_CHANGED) { *fg = MAKE_ARGB(0xff,0xff,0x00,0x00); } if(attr & DCA_INVALID) { *fg = MAKE_ARGB(0xff,0x00,0x00,0xff); } if(attr & DCA_DISABLED) { *fg = MAKE_ARGB(RGB_ALPHA(*fg), (RGB_RED(*fg)+RGB_RED(*bg)) >> 1, (RGB_GREEN(*fg)+RGB_GREEN(*bg)) >> 1, (RGB_BLUE(*fg)+RGB_BLUE(*bg)) >> 1); }
INLINE rgb_t adjust_palette_entry(rgb_t entry, float brightness, float contrast, const UINT8 *gamma_map) { int r = rgb_clamp((float)gamma_map[RGB_RED(entry)] * contrast + brightness); int g = rgb_clamp((float)gamma_map[RGB_GREEN(entry)] * contrast + brightness); int b = rgb_clamp((float)gamma_map[RGB_BLUE(entry)] * contrast + brightness); int a = RGB_ALPHA(entry); return MAKE_ARGB(a,r,g,b); }
static inline void ALPHA(uint8_t *v, Tsize c) { *(Tsize*)v = RGB_ALPHA(*(Tsize*)v, RGB_MUL(c, g_pRLX->pGX->csp_cfg.color)); }