static void vt_bitblt_char(struct vt_device *vd, struct vt_font *vf, term_char_t c, int iscursor, unsigned int row, unsigned int col) { term_color_t fg, bg; vt_determine_colors(c, iscursor, &fg, &bg); if (vf != NULL) { const uint8_t *src; vt_axis_t top, left; src = vtfont_lookup(vf, c); /* * Align the terminal to the centre of the screen. * Fonts may not always be able to fill the entire * screen. */ top = row * vf->vf_height + vd->vd_offset.tp_row; left = col * vf->vf_width + vd->vd_offset.tp_col; vd->vd_driver->vd_bitbltchr(vd, src, NULL, 0, top, left, vf->vf_width, vf->vf_height, fg, bg); } else { vd->vd_driver->vd_putchar(vd, TCHAR_CHARACTER(c), row, col, fg, bg); } }
void vt_fb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, const term_rect_t *area) { unsigned int col, row, x, y; struct vt_font *vf; term_char_t c; term_color_t fg, bg; const uint8_t *pattern; vf = vw->vw_font; for (row = area->tr_begin.tp_row; row < area->tr_end.tp_row; ++row) { for (col = area->tr_begin.tp_col; col < area->tr_end.tp_col; ++col) { x = col * vf->vf_width + vw->vw_draw_area.tr_begin.tp_col; y = row * vf->vf_height + vw->vw_draw_area.tr_begin.tp_row; c = VTBUF_GET_FIELD(&vw->vw_buf, row, col); pattern = vtfont_lookup(vf, c); vt_determine_colors(c, VTBUF_ISCURSOR(&vw->vw_buf, row, col), &fg, &bg); vt_fb_bitblt_bitmap(vd, vw, pattern, NULL, vf->vf_width, vf->vf_height, x, y, fg, bg); } } #ifndef SC_NO_CUTPASTE if (!vd->vd_mshown) return; term_rect_t drawn_area; drawn_area.tr_begin.tp_col = area->tr_begin.tp_col * vf->vf_width; drawn_area.tr_begin.tp_row = area->tr_begin.tp_row * vf->vf_height; drawn_area.tr_end.tp_col = area->tr_end.tp_col * vf->vf_width; drawn_area.tr_end.tp_row = area->tr_end.tp_row * vf->vf_height; if (vt_is_cursor_in_area(vd, &drawn_area)) { vt_fb_bitblt_bitmap(vd, vw, vd->vd_mcursor->map, vd->vd_mcursor->mask, vd->vd_mcursor->width, vd->vd_mcursor->height, vd->vd_mx_drawn + vw->vw_draw_area.tr_begin.tp_col, vd->vd_my_drawn + vw->vw_draw_area.tr_begin.tp_row, vd->vd_mcursor_fg, vd->vd_mcursor_bg); } #endif }