Changeset 198a9ef in mainline
- Timestamp:
- 2009-02-10T10:31:46Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fd72312
- Parents:
- 753d851
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fb/ega.c
r753d851 r198a9ef 73 73 #define INVERTED_COLOR ega_inverted_color 74 74 75 #define EGA_STYLE(fg,bg) ((fg) > (bg) ? NORMAL_COLOR : INVERTED_COLOR)76 77 75 /* Allow only 1 connection */ 78 76 static int client_connected = 0; … … 83 81 84 82 static unsigned int style; 83 84 static unsigned attr_to_ega_style(const attrs_t *a); 85 85 86 86 static void clrscr(void) … … 157 157 for (i = 0; i < scr_width * scr_height; i++) { 158 158 scr_addr[i * 2] = data[i].character; 159 /* FIXME 160 scr_addr[i * 2 + 1] = EGA_STYLE(data[i].style.fg_color, 161 data[i].style.bg_color); 162 */ 159 scr_addr[i * 2 + 1] = attr_to_ega_style(&data[i].attrs); 163 160 } 164 161 } … … 189 186 } 190 187 188 static int style_to_ega_style(int style) 189 { 190 unsigned int ega_style; 191 192 switch (style) { 193 case STYLE_NORMAL: 194 ega_style = INVERTED_COLOR; 195 break; 196 case STYLE_EMPHASIS: 197 ega_style = INVERTED_COLOR | 4; 198 break; 199 default: 200 return INVERTED_COLOR; 201 } 202 203 return ega_style; 204 } 205 206 static unsigned int color_to_ega_style(int fg_color, int bg_color, int attr) 207 { 208 unsigned int style; 209 210 style = (fg_color & 7) | ((bg_color & 7) << 4); 211 if (attr & CATTR_BRIGHT) 212 style = style | 0x08; 213 214 return style; 215 } 216 217 static unsigned int rgb_to_ega_style(uint32_t fg, uint32_t bg) 218 { 219 return (fg > bg) ? NORMAL_COLOR : INVERTED_COLOR; 220 } 221 222 static unsigned attr_to_ega_style(const attrs_t *a) 223 { 224 switch (a->t) { 225 case at_style: return style_to_ega_style(a->a.s.style); 226 case at_rgb: return rgb_to_ega_style(a->a.r.fg_color, a->a.r.bg_color); 227 case at_idx: return color_to_ega_style(a->a.i.fg_color, 228 a->a.i.bg_color, a->a.i.flags); 229 default: return INVERTED_COLOR; 230 } 231 } 191 232 192 233 static void ega_client_connection(ipc_callid_t iid, ipc_call_t *icall) … … 197 238 char c; 198 239 unsigned int row, col; 199 int bgcolor,fgcolor; 240 int bg_color, fg_color, attr; 241 uint32_t bg_rgb, fg_rgb; 200 242 keyfield_t *interbuf = NULL; 201 243 size_t intersize = 0; … … 280 322 break; 281 323 case FB_SET_STYLE: 282 retval = 0; 283 switch (IPC_GET_ARG1(call)) { 284 case STYLE_NORMAL: style = INVERTED_COLOR; break; 285 case STYLE_EMPHASIS: style = INVERTED_COLOR | 4; break; 286 default: retval = EINVAL; 287 } 324 style = style_to_ega_style(IPC_GET_ARG1(call)); 325 retval = 0; 288 326 break; 289 327 case FB_SET_COLOR: 290 fgcolor = IPC_GET_ARG1(call); 291 bgcolor = IPC_GET_ARG2(call); 292 style = (fgcolor & 7) | ((bgcolor & 7) << 4); 293 if (IPC_GET_ARG3(call) & CATTR_BRIGHT) 294 style = style | 0x08; 328 fg_color = IPC_GET_ARG1(call); 329 bg_color = IPC_GET_ARG2(call); 330 attr = IPC_GET_ARG3(call); 331 style = color_to_ega_style(fg_color, bg_color, attr); 295 332 retval = 0; 296 333 break; 297 334 case FB_SET_RGB_COLOR: 298 fg color= IPC_GET_ARG1(call);299 bg color= IPC_GET_ARG2(call);300 style = EGA_STYLE(fgcolor, bgcolor);335 fg_rgb = IPC_GET_ARG1(call); 336 bg_rgb = IPC_GET_ARG2(call); 337 style = rgb_to_ega_style(fg_rgb, bg_rgb); 301 338 retval = 0; 302 339 break; … … 336 373 scr_width = sysinfo_value("fb.width"); 337 374 scr_height = sysinfo_value("fb.height"); 338 if(sysinfo_value("fb.blinking")) 339 { 340 ega_normal_color &= 0x77; 341 ega_inverted_color &= 0x77; 342 } 375 376 if(sysinfo_value("fb.blinking")) { 377 ega_normal_color &= 0x77; 378 ega_inverted_color &= 0x77; 379 } 380 343 381 style = NORMAL_COLOR; 344 382
Note:
See TracChangeset
for help on using the changeset viewer.