vt(4): Remove vd_bitbltchr_t

It's replaced by vd_bitblt_text_t, which gives more context to the
backend and allows it to perform more efficiently when redrawing a given
area.

MFC after:	1 week
This commit is contained in:
Jean-Sébastien Pédron 2014-08-24 09:22:03 +00:00
parent 69ce0dbce3
commit 9de6b2c587
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=270446
2 changed files with 3 additions and 90 deletions

View File

@ -294,15 +294,6 @@ typedef int vd_init_t(struct vt_device *vd);
typedef int vd_probe_t(struct vt_device *vd);
typedef void vd_postswitch_t(struct vt_device *vd);
typedef void vd_blank_t(struct vt_device *vd, term_color_t color);
/*
* FIXME: Remove vd_bitblt_t and vd_putchar_t, once vd_bitblt_text_t is
* provided by all drivers.
*/
typedef void vd_bitbltchr_t(struct vt_device *vd, const uint8_t *src,
const uint8_t *mask, int bpl, vt_axis_t top, vt_axis_t left,
unsigned int width, unsigned int height, term_color_t fg, term_color_t bg);
typedef void vd_putchar_t(struct vt_device *vd, term_char_t,
vt_axis_t top, vt_axis_t left, term_color_t fg, term_color_t bg);
typedef void vd_bitblt_text_t(struct vt_device *vd, const struct vt_window *vw,
const term_rect_t *area);
typedef void vd_bitblt_bmp_t(struct vt_device *vd, const struct vt_window *vw,
@ -324,7 +315,6 @@ struct vt_driver {
/* Drawing. */
vd_blank_t *vd_blank;
vd_bitbltchr_t *vd_bitbltchr; /* FIXME: Deprecated. */
vd_drawrect_t *vd_drawrect;
vd_setpixel_t *vd_setpixel;
vd_bitblt_text_t *vd_bitblt_text;
@ -336,9 +326,6 @@ struct vt_driver {
/* Framebuffer mmap, if present. */
vd_fb_mmap_t *vd_fb_mmap;
/* Text mode operation. */
vd_putchar_t *vd_putchar; /* FIXME: Deprecated. */
/* Update display setting on vt switch. */
vd_postswitch_t *vd_postswitch;

View File

@ -887,48 +887,16 @@ vt_mark_mouse_position_as_dirty(struct vt_device *vd)
}
#endif
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_curwindow->vw_offset.tp_row;
left = col * vf->vf_width + vd->vd_curwindow->vw_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);
}
}
static void
vt_flush(struct vt_device *vd)
{
struct vt_window *vw;
struct vt_font *vf;
struct vt_bufmask tmask;
unsigned int row, col;
term_rect_t tarea;
term_pos_t size;
term_char_t *r;
#ifndef SC_NO_CUTPASTE
int cursor_was_shown, cursor_moved, bpl, h, w;
int cursor_was_shown, cursor_moved;
#endif
vw = vd->vd_curwindow;
@ -992,50 +960,8 @@ vt_flush(struct vt_device *vd)
vd->vd_flags &= ~VDF_INVALID;
}
if (vd->vd_driver->vd_bitblt_text != NULL) {
if (tarea.tr_begin.tp_col < tarea.tr_end.tp_col) {
vd->vd_driver->vd_bitblt_text(vd, vw, &tarea);
}
} else {
/*
* FIXME: Once all backend drivers expose the
* vd_bitblt_text_t callback, this code can be removed.
*/
for (row = tarea.tr_begin.tp_row; row < tarea.tr_end.tp_row; row++) {
if (!VTBUF_DIRTYROW(&tmask, row))
continue;
r = VTBUF_GET_ROW(&vw->vw_buf, row);
for (col = tarea.tr_begin.tp_col;
col < tarea.tr_end.tp_col; col++) {
if (!VTBUF_DIRTYCOL(&tmask, col))
continue;
vt_bitblt_char(vd, vf, r[col],
VTBUF_ISCURSOR(&vw->vw_buf, row, col), row, col);
}
}
#ifndef SC_NO_CUTPASTE
if (vd->vd_mshown) {
/* Bytes per source line. */
bpl = (vd->vd_mcursor->width + 7) >> 3;
w = vd->vd_mcursor->width;
h = vd->vd_mcursor->height;
if ((vd->vd_mx + vd->vd_mcursor->width) >
(size.tp_col * vf->vf_width))
w = (size.tp_col * vf->vf_width) - vd->vd_mx - 1;
if ((vd->vd_my + vd->vd_mcursor->height) >
(size.tp_row * vf->vf_height))
h = (size.tp_row * vf->vf_height) - vd->vd_my - 1;
vd->vd_driver->vd_bitbltchr(vd,
vd->vd_mcursor->map, vd->vd_mcursor->mask, bpl,
vw->vw_offset.tp_row + vd->vd_my,
vw->vw_offset.tp_col + vd->vd_mx,
w, h, vd->vd_mcursor_fg, vd->vd_mcursor_bg);
}
#endif
if (tarea.tr_begin.tp_col < tarea.tr_end.tp_col) {
vd->vd_driver->vd_bitblt_text(vd, vw, &tarea);
}
}