Index: hw/fb/vt_fb.c =================================================================== --- hw/fb/vt_fb.c (revision 264111) +++ hw/fb/vt_fb.c (working copy) @@ -53,6 +53,7 @@ .vd_init = vt_fb_init, .vd_blank = vt_fb_blank, .vd_bitbltchr = vt_fb_bitbltchr, + .vd_maskbitbltchr = vt_fb_maskbitbltchr, .vd_drawrect = vt_fb_drawrect, .vd_setpixel = vt_fb_setpixel, .vd_postswitch = vt_fb_postswitch, @@ -189,6 +190,88 @@ uint32_t fgc, bgc, cc, o; int c, l, bpp; u_long line; + uint8_t b; + const uint8_t *ch; + uint8_t glbuf[128]; + uint16_t *glbuf16; + uint32_t *glbuf32; + + glbuf16 = (uint16_t *)glbuf; + glbuf32 = (uint32_t *)glbuf; + + info = vd->vd_softc; + bpp = FBTYPE_GET_BYTESPP(info); + fgc = info->fb_cmap[fg]; + bgc = info->fb_cmap[bg]; + b = 0; + if (bpl == 0) + bpl = (width + 7) >> 3; /* Bytes per sorce line. */ + + /* Don't try to put off screen pixels */ + if (((left + width) > info->fb_width) || ((top + height) > + info->fb_height)) + return; + + line = (info->fb_stride * top) + (left * bpp); + for (l = 0; l < height; l++) { + ch = src; + for (c = 0; c < width; c++) { + if (c % 8 == 0) + b = *ch++; + else + b <<= 1; + o = line + (c * bpp); + cc = b & 0x80 ? fgc : bgc; + + switch(bpp) { + case 1: + glbuf[c] = cc; + break; + case 2: + glbuf16[c] = cc; + break; + case 3: + /* Packed mode, so unaligned. Byte access. */ + glbuf[c * 3] = (cc >> 16) & 0xff; + glbuf[(c * 3) + 1] = (cc >> 8) & 0xff; + glbuf[(c * 3) + 2] = cc & 0xff; + break; + case 4: + glbuf32[c] = cc; + break; + default: + /* panic? */ + break; + } + } + + + switch(bpp) { + case 1: + case 2: + case 3: + case 4: + memcpy((uint8_t *)(info->fb_vbase + line), glbuf32, width * bpp); + default: + /* panic? */ + break; + } + + + line += info->fb_stride; + src += bpl; + } +} + +void +vt_fb_maskbitbltchr(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) +{ + struct fb_info *info; + uint32_t fgc, bgc, cc, o; + int c, l, bpp; + u_long line; uint8_t b, m; const uint8_t *ch; Index: hw/fb/vt_fb.h =================================================================== --- hw/fb/vt_fb.h (revision 264111) +++ hw/fb/vt_fb.h (working copy) @@ -41,6 +41,7 @@ vd_init_t vt_fb_init; vd_blank_t vt_fb_blank; vd_bitbltchr_t vt_fb_bitbltchr; +vd_maskbitbltchr_t vt_fb_maskbitbltchr; vd_postswitch_t vt_fb_postswitch;