Rev 4167 | Rev 4226 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4167 | Rev 4211 | ||
---|---|---|---|
Line 95... | Line 95... | ||
95 | rgb_conv_t rgb_conv; |
95 | rgb_conv_t rgb_conv; |
96 | } screen; |
96 | } screen; |
97 | 97 | ||
98 | /** Backbuffer character cell. */ |
98 | /** Backbuffer character cell. */ |
99 | typedef struct { |
99 | typedef struct { |
100 | uint8_t glyph; |
100 | uint32_t glyph; |
101 | uint32_t fg_color; |
101 | uint32_t fg_color; |
102 | uint32_t bg_color; |
102 | uint32_t bg_color; |
103 | } bb_cell_t; |
103 | } bb_cell_t; |
104 | 104 | ||
105 | typedef struct { |
105 | typedef struct { |
Line 192... | Line 192... | ||
192 | 192 | ||
193 | 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, |
194 | ipcarg_t bg_color, ipcarg_t attr); |
194 | ipcarg_t bg_color, ipcarg_t attr); |
195 | 195 | ||
196 | static void draw_glyph_aligned(unsigned int x, unsigned int y, bool cursor, |
196 | static void draw_glyph_aligned(unsigned int x, unsigned int y, bool cursor, |
197 | uint8_t *glyphs, uint8_t glyph, uint32_t fg_color, uint32_t bg_color); |
197 | uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color); |
198 | static void draw_glyph_fallback(unsigned int x, unsigned int y, bool cursor, |
198 | static void draw_glyph_fallback(unsigned int x, unsigned int y, bool cursor, |
199 | uint8_t *glyphs, uint8_t glyph, uint32_t fg_color, uint32_t bg_color); |
199 | uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color); |
200 | 200 | ||
201 | static void draw_vp_glyph(viewport_t *vport, bool cursor, unsigned int col, |
201 | static void draw_vp_glyph(viewport_t *vport, bool cursor, unsigned int col, |
202 | unsigned int row); |
202 | unsigned int row); |
203 | 203 | ||
204 | 204 | ||
Line 657... | Line 657... | ||
657 | * @param glyph Code of the glyph to draw. |
657 | * @param glyph Code of the glyph to draw. |
658 | * @param fg_color Foreground color. |
658 | * @param fg_color Foreground color. |
659 | * @param bg_color Backgroudn color. |
659 | * @param bg_color Backgroudn color. |
660 | */ |
660 | */ |
661 | static void draw_glyph_aligned(unsigned int x, unsigned int y, bool cursor, |
661 | static void draw_glyph_aligned(unsigned int x, unsigned int y, bool cursor, |
662 | uint8_t *glyphs, uint8_t glyph, uint32_t fg_color, uint32_t bg_color) |
662 | uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color) |
663 | { |
663 | { |
664 | unsigned int i, yd; |
664 | unsigned int i, yd; |
665 | unsigned long fg_buf, bg_buf; |
665 | unsigned long fg_buf, bg_buf; |
666 | unsigned long *maskp, *dp; |
666 | unsigned long *maskp, *dp; |
667 | unsigned long mask; |
667 | unsigned long mask; |
668 | unsigned int ww, d_add; |
668 | unsigned int ww, d_add; |
669 | 669 | ||
- | 670 | /* Check glyph range. */ |
|
- | 671 | if (glyph >= FONT_GLYPHS) |
|
- | 672 | return; |
|
- | 673 | ||
670 | /* |
674 | /* |
671 | * Prepare a pair of words, one filled with foreground-color |
675 | * Prepare a pair of words, one filled with foreground-color |
672 | * pattern and the other filled with background-color pattern. |
676 | * pattern and the other filled with background-color pattern. |
673 | */ |
677 | */ |
674 | for (i = 0; i < sizeof(unsigned long) / screen.pixelbytes; i++) { |
678 | for (i = 0; i < sizeof(unsigned long) / screen.pixelbytes; i++) { |
Line 676... | Line 680... | ||
676 | fg_color); |
680 | fg_color); |
677 | screen.rgb_conv(&((uint8_t *)&bg_buf)[i * screen.pixelbytes], |
681 | screen.rgb_conv(&((uint8_t *)&bg_buf)[i * screen.pixelbytes], |
678 | bg_color); |
682 | bg_color); |
679 | } |
683 | } |
680 | 684 | ||
681 | - | ||
682 | /* Pointer to the current position in the mask. */ |
685 | /* Pointer to the current position in the mask. */ |
683 | maskp = (unsigned long *) &glyphs[GLYPH_POS(glyph, 0, cursor)]; |
686 | maskp = (unsigned long *) &glyphs[GLYPH_POS(glyph, 0, cursor)]; |
684 | 687 | ||
685 | /* Pointer to the current position on the screen. */ |
688 | /* Pointer to the current position on the screen. */ |
686 | dp = (unsigned long *) &screen.fb_addr[FB_POS(x, y)]; |
689 | dp = (unsigned long *) &screen.fb_addr[FB_POS(x, y)]; |
Line 718... | Line 721... | ||
718 | * @param glyph Code of the glyph to draw. |
721 | * @param glyph Code of the glyph to draw. |
719 | * @param fg_color Foreground color. |
722 | * @param fg_color Foreground color. |
720 | * @param bg_color Backgroudn color. |
723 | * @param bg_color Backgroudn color. |
721 | */ |
724 | */ |
722 | void draw_glyph_fallback(unsigned int x, unsigned int y, bool cursor, |
725 | void draw_glyph_fallback(unsigned int x, unsigned int y, bool cursor, |
723 | uint8_t *glyphs, uint8_t glyph, uint32_t fg_color, uint32_t bg_color) |
726 | uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color) |
724 | { |
727 | { |
725 | unsigned int i, j, yd; |
728 | unsigned int i, j, yd; |
726 | uint8_t fg_buf[4], bg_buf[4]; |
729 | uint8_t fg_buf[4], bg_buf[4]; |
727 | uint8_t *dp, *sp; |
730 | uint8_t *dp, *sp; |
728 | unsigned int d_add; |
731 | unsigned int d_add; |
729 | uint8_t b; |
732 | uint8_t b; |
730 | 733 | ||
- | 734 | /* Check glyph range. */ |
|
- | 735 | if (glyph >= FONT_GLYPHS) |
|
- | 736 | return; |
|
- | 737 | ||
731 | /* Pre-render 1x the foreground and background color pixels. */ |
738 | /* Pre-render 1x the foreground and background color pixels. */ |
732 | if (cursor) { |
739 | if (cursor) { |
733 | screen.rgb_conv(fg_buf, bg_color); |
740 | screen.rgb_conv(fg_buf, bg_color); |
734 | screen.rgb_conv(bg_buf, fg_color); |
741 | screen.rgb_conv(bg_buf, fg_color); |
735 | } else { |
742 | } else { |
Line 777... | Line 784... | ||
777 | unsigned int row) |
784 | unsigned int row) |
778 | { |
785 | { |
779 | unsigned int x = vport->x + COL2X(col); |
786 | unsigned int x = vport->x + COL2X(col); |
780 | unsigned int y = vport->y + ROW2Y(row); |
787 | unsigned int y = vport->y + ROW2Y(row); |
781 | 788 | ||
782 | uint8_t glyph; |
789 | uint32_t glyph; |
783 | uint32_t fg_color; |
790 | uint32_t fg_color; |
784 | uint32_t bg_color; |
791 | uint32_t bg_color; |
785 | 792 | ||
786 | glyph = vport->backbuf[BB_POS(vport, col, row)].glyph; |
793 | glyph = vport->backbuf[BB_POS(vport, col, row)].glyph; |
787 | fg_color = vport->backbuf[BB_POS(vport, col, row)].fg_color; |
794 | fg_color = vport->backbuf[BB_POS(vport, col, row)].fg_color; |
Line 834... | Line 841... | ||
834 | * @param c Character to draw |
841 | * @param c Character to draw |
835 | * @param col Screen position relative to viewport |
842 | * @param col Screen position relative to viewport |
836 | * @param row Screen position relative to viewport |
843 | * @param row Screen position relative to viewport |
837 | * |
844 | * |
838 | */ |
845 | */ |
839 | static void draw_char(viewport_t *vport, uint8_t c, unsigned int col, unsigned int row) |
846 | static void draw_char(viewport_t *vport, wchar_t c, unsigned int col, unsigned int row) |
840 | { |
847 | { |
841 | bb_cell_t *bbp; |
848 | bb_cell_t *bbp; |
842 | 849 | ||
843 | /* Do not hide cursor if we are going to overwrite it */ |
850 | /* Do not hide cursor if we are going to overwrite it */ |
844 | if ((vport->cursor_active) && (vport->cursor_shown) && |
851 | if ((vport->cursor_active) && (vport->cursor_shown) && |
845 | ((vport->cur_col != col) || (vport->cur_row != row))) |
852 | ((vport->cur_col != col) || (vport->cur_row != row))) |
846 | cursor_hide(vport); |
853 | cursor_hide(vport); |
847 | 854 | ||
848 | bbp = &vport->backbuf[BB_POS(vport, col, row)]; |
855 | bbp = &vport->backbuf[BB_POS(vport, col, row)]; |
849 | bbp->glyph = c; |
856 | bbp->glyph = (uint32_t) c; |
850 | bbp->fg_color = vport->attr.fg_color; |
857 | bbp->fg_color = vport->attr.fg_color; |
851 | bbp->bg_color = vport->attr.bg_color; |
858 | bbp->bg_color = vport->attr.bg_color; |
852 | 859 | ||
853 | draw_vp_glyph(vport, false, col, row); |
860 | draw_vp_glyph(vport, false, col, row); |
854 | 861 | ||
Line 887... | Line 894... | ||
887 | for (i = 0; i < w; i++) { |
894 | for (i = 0; i < w; i++) { |
888 | unsigned int col = x + i; |
895 | unsigned int col = x + i; |
889 | unsigned int row = y + j; |
896 | unsigned int row = y + j; |
890 | 897 | ||
891 | bbp = &vport->backbuf[BB_POS(vport, col, row)]; |
898 | bbp = &vport->backbuf[BB_POS(vport, col, row)]; |
892 | uint8_t glyph = bbp->glyph; |
899 | uint32_t glyph = bbp->glyph; |
893 | 900 | ||
894 | a = &data[j * w + i].attrs; |
901 | a = &data[j * w + i].attrs; |
895 | rgb_from_attr(&rgb, a); |
902 | rgb_from_attr(&rgb, a); |
896 | 903 | ||
897 | bbp->glyph = data[j * w + i].character; |
904 | bbp->glyph = data[j * w + i].character; |
Line 1508... | Line 1515... | ||
1508 | ipc_callid_t callid; |
1515 | ipc_callid_t callid; |
1509 | ipc_call_t call; |
1516 | ipc_call_t call; |
1510 | int retval; |
1517 | int retval; |
1511 | unsigned int i; |
1518 | unsigned int i; |
1512 | int scroll; |
1519 | int scroll; |
1513 | uint8_t glyph; |
1520 | uint32_t glyph; |
1514 | unsigned int row, col; |
1521 | unsigned int row, col; |
1515 | 1522 | ||
1516 | if ((vport->cursor_active) || (anims_enabled)) |
1523 | if ((vport->cursor_active) || (anims_enabled)) |
1517 | callid = async_get_call_timeout(&call, 250000); |
1524 | callid = async_get_call_timeout(&call, 250000); |
1518 | else |
1525 | else |