summaryrefslogtreecommitdiffstats
path: root/sys/dev/vt
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/vt')
-rw-r--r--sys/dev/vt/hw/fb/vt_fb.c28
-rw-r--r--sys/dev/vt/hw/ofwfb/ofwfb.c35
2 files changed, 30 insertions, 33 deletions
diff --git a/sys/dev/vt/hw/fb/vt_fb.c b/sys/dev/vt/hw/fb/vt_fb.c
index 3cae588..ddec76d 100644
--- a/sys/dev/vt/hw/fb/vt_fb.c
+++ b/sys/dev/vt/hw/fb/vt_fb.c
@@ -263,17 +263,16 @@ vt_fb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw,
b = m = 0;
bpl = (width + 7) >> 3; /* Bytes per source line. */
- /* Don't try to put off screen pixels */
- if (((x + width) > info->fb_width) || ((y + height) >
- info->fb_height))
- return;
-
KASSERT((info->fb_vbase != 0), ("Unmapped framebuffer"));
line = (info->fb_stride * y) + (x * bpp);
- for (l = 0; l < height; l++) {
+ for (l = 0;
+ l < height && y + l < vw->vw_draw_area.tr_end.tp_row;
+ l++) {
ch = pattern;
- for (c = 0; c < width; c++) {
+ for (c = 0;
+ c < width && x + c < vw->vw_draw_area.tr_end.tp_col;
+ c++) {
if (c % 8 == 0)
b = *ch++;
else
@@ -353,20 +352,17 @@ vt_fb_bitblt_text(struct vt_device *vd, const struct vt_window *vw,
term_rect_t drawn_area;
- drawn_area.tr_begin.tp_col = area->tr_begin.tp_col * vf->vf_width +
- vw->vw_draw_area.tr_begin.tp_col;
- drawn_area.tr_begin.tp_row = area->tr_begin.tp_row * vf->vf_height +
- vw->vw_draw_area.tr_begin.tp_row;
- drawn_area.tr_end.tp_col = area->tr_end.tp_col * vf->vf_width +
- vw->vw_draw_area.tr_begin.tp_col;
- drawn_area.tr_end.tp_row = area->tr_end.tp_row * vf->vf_height +
- vw->vw_draw_area.tr_begin.tp_row;
+ 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, vd->vd_my_drawn,
+ 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
diff --git a/sys/dev/vt/hw/ofwfb/ofwfb.c b/sys/dev/vt/hw/ofwfb/ofwfb.c
index 835a07d..75d42b5 100644
--- a/sys/dev/vt/hw/ofwfb/ofwfb.c
+++ b/sys/dev/vt/hw/ofwfb/ofwfb.c
@@ -110,7 +110,7 @@ ofwfb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw,
struct fb_info *sc = vd->vd_softc;
u_long line;
uint32_t fgc, bgc;
- int c;
+ int c, l;
uint8_t b, m;
union {
uint32_t l;
@@ -121,13 +121,13 @@ ofwfb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw,
bgc = sc->fb_cmap[bg];
b = m = 0;
- /* Don't try to put off screen pixels */
- if (((x + width) > vd->vd_width) || ((y + height) >
- vd->vd_height))
- return;
-
line = (sc->fb_stride * y) + x * sc->fb_bpp/8;
if (mask == NULL && sc->fb_bpp == 8 && (width % 8 == 0)) {
+ /* Don't try to put off screen pixels */
+ if (((x + width) > vd->vd_width) || ((y + height) >
+ vd->vd_height))
+ return;
+
for (; height > 0; height--) {
for (c = 0; c < width; c += 8) {
b = *pattern++;
@@ -160,8 +160,12 @@ ofwfb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw,
line += sc->fb_stride;
}
} else {
- for (; height > 0; height--) {
- for (c = 0; c < width; c++) {
+ for (l = 0;
+ l < height && y + l < vw->vw_draw_area.tr_end.tp_row;
+ l++) {
+ for (c = 0;
+ c < width && x + c < vw->vw_draw_area.tr_end.tp_col;
+ c++) {
if (c % 8 == 0)
b = *pattern++;
else
@@ -231,20 +235,17 @@ ofwfb_bitblt_text(struct vt_device *vd, const struct vt_window *vw,
term_rect_t drawn_area;
- drawn_area.tr_begin.tp_col = area->tr_begin.tp_col * vf->vf_width +
- vw->vw_draw_area.tr_begin.tp_col;
- drawn_area.tr_begin.tp_row = area->tr_begin.tp_row * vf->vf_height +
- vw->vw_draw_area.tr_begin.tp_row;
- drawn_area.tr_end.tp_col = area->tr_end.tp_col * vf->vf_width +
- vw->vw_draw_area.tr_begin.tp_col;
- drawn_area.tr_end.tp_row = area->tr_end.tp_row * vf->vf_height +
- vw->vw_draw_area.tr_begin.tp_row;
+ 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)) {
ofwfb_bitblt_bitmap(vd, vw,
vd->vd_mcursor->map, vd->vd_mcursor->mask,
vd->vd_mcursor->width, vd->vd_mcursor->height,
- vd->vd_mx_drawn, vd->vd_my_drawn,
+ 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
OpenPOWER on IntegriCloud