Rev 4338 | Rev 4342 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4338 | Rev 4339 | ||
|---|---|---|---|
| Line 183... | Line 183... | ||
| 183 | [8 + COLOR_MAGENTA] = 0xff00ff, |
183 | [8 + COLOR_MAGENTA] = 0xff00ff, |
| 184 | [8 + COLOR_YELLOW] = 0xffff00, |
184 | [8 + COLOR_YELLOW] = 0xffff00, |
| 185 | [8 + COLOR_WHITE] = 0xffffff, |
185 | [8 + COLOR_WHITE] = 0xffffff, |
| 186 | }; |
186 | }; |
| 187 | 187 | ||
| - | 188 | static int rgb_from_attr(attr_rgb_t *rgb, const attrs_t *a); |
|
| 188 | static int rgb_from_style(attr_rgb_t *rgb, int style); |
189 | static int rgb_from_style(attr_rgb_t *rgb, int style); |
| 189 | static int rgb_from_idx(attr_rgb_t *rgb, ipcarg_t fg_color, |
190 | static int rgb_from_idx(attr_rgb_t *rgb, ipcarg_t fg_color, |
| 190 | ipcarg_t bg_color, ipcarg_t flags); |
191 | ipcarg_t bg_color, ipcarg_t flags); |
| 191 | 192 | ||
| 192 | static int fb_set_color(viewport_t *vport, ipcarg_t fg_color, |
193 | static int fb_set_color(viewport_t *vport, ipcarg_t fg_color, |
| Line 875... | Line 876... | ||
| 875 | unsigned int row = i / vport->cols; |
876 | unsigned int row = i / vport->cols; |
| 876 | 877 | ||
| 877 | bbp = &vport->backbuf[BB_POS(vport, col, row)]; |
878 | bbp = &vport->backbuf[BB_POS(vport, col, row)]; |
| 878 | uint8_t glyph = bbp->glyph; |
879 | uint8_t glyph = bbp->glyph; |
| 879 | 880 | ||
| 880 | if (glyph != data[i].character) { |
- | |
| 881 | bbp->glyph = data[i].character; |
- | |
| 882 | a = &data[i].attrs; |
881 | a = &data[i].attrs; |
| 883 | - | ||
| 884 | switch (a->t) { |
- | |
| 885 | case at_style: |
- | |
| 886 | rgb_from_style(&rgb, a->a.s.style); |
882 | rgb_from_attr(&rgb, a); |
| 887 | break; |
- | |
| 888 | case at_idx: |
- | |
| 889 | rgb_from_idx(&rgb, a->a.i.fg_color, |
- | |
| 890 | a->a.i.bg_color, a->a.i.flags); |
- | |
| 891 | break; |
- | |
| 892 | case at_rgb: |
- | |
| 893 | rgb = a->a.r; |
- | |
| 894 | break; |
- | |
| 895 | } |
- | |
| 896 | 883 | ||
| - | 884 | bbp->glyph = data[i].character; |
|
| 897 | bbp->fg_color = rgb.fg_color; |
885 | bbp->fg_color = rgb.fg_color; |
| 898 | bbp->bg_color = rgb.bg_color; |
886 | bbp->bg_color = rgb.bg_color; |
| 899 | 887 | ||
| 900 | draw_vp_glyph(vport, false, col, row); |
888 | draw_vp_glyph(vport, false, col, row); |
| 901 | } |
- | |
| 902 | } |
889 | } |
| 903 | cursor_show(vport); |
890 | cursor_show(vport); |
| 904 | } |
891 | } |
| 905 | 892 | ||
| 906 | 893 | ||
| Line 1442... | Line 1429... | ||
| 1442 | rgb->bg_color = color_table[bg_color]; |
1429 | rgb->bg_color = color_table[bg_color]; |
| 1443 | 1430 | ||
| 1444 | return EOK; |
1431 | return EOK; |
| 1445 | } |
1432 | } |
| 1446 | 1433 | ||
| - | 1434 | static int rgb_from_attr(attr_rgb_t *rgb, const attrs_t *a) |
|
| - | 1435 | { |
|
| - | 1436 | int rc; |
|
| - | 1437 | ||
| - | 1438 | switch (a->t) { |
|
| - | 1439 | case at_style: |
|
| - | 1440 | rc = rgb_from_style(rgb, a->a.s.style); |
|
| - | 1441 | break; |
|
| - | 1442 | case at_idx: |
|
| - | 1443 | rc = rgb_from_idx(rgb, a->a.i.fg_color, |
|
| - | 1444 | a->a.i.bg_color, a->a.i.flags); |
|
| - | 1445 | break; |
|
| - | 1446 | case at_rgb: |
|
| - | 1447 | *rgb = a->a.r; |
|
| - | 1448 | rc = EOK; |
|
| - | 1449 | break; |
|
| - | 1450 | } |
|
| - | 1451 | ||
| - | 1452 | return rc; |
|
| - | 1453 | } |
|
| - | 1454 | ||
| 1447 | static int fb_set_style(viewport_t *vport, ipcarg_t style) |
1455 | static int fb_set_style(viewport_t *vport, ipcarg_t style) |
| 1448 | { |
1456 | { |
| 1449 | return rgb_from_style(&vport->attr, (int) style); |
1457 | return rgb_from_style(&vport->attr, (int) style); |
| 1450 | } |
1458 | } |
| 1451 | 1459 | ||