From owner-svn-src-head@FreeBSD.ORG Sat Aug 23 15:04:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1B6BBA9; Sat, 23 Aug 2014 15:04:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06B153C6B; Sat, 23 Aug 2014 15:04:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7NF4Kmr065162; Sat, 23 Aug 2014 15:04:20 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7NF4KpC065161; Sat, 23 Aug 2014 15:04:20 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201408231504.s7NF4KpC065161@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Sat, 23 Aug 2014 15:04:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270412 - head/sys/dev/fb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Aug 2014 15:04:21 -0000 Author: dumbbell Date: Sat Aug 23 15:04:20 2014 New Revision: 270412 URL: http://svnweb.freebsd.org/changeset/base/270412 Log: creator_fb: Implement vd_bitblt_text_t MFC after: 1 week Modified: head/sys/dev/fb/creator_vt.c Modified: head/sys/dev/fb/creator_vt.c ============================================================================== --- head/sys/dev/fb/creator_vt.c Sat Aug 23 15:00:47 2014 (r270411) +++ head/sys/dev/fb/creator_vt.c Sat Aug 23 15:04:20 2014 (r270412) @@ -45,14 +45,14 @@ __FBSDID("$FreeBSD$"); static vd_probe_t creatorfb_probe; static vd_init_t creatorfb_init; static vd_blank_t creatorfb_blank; -static vd_bitbltchr_t creatorfb_bitbltchr; +static vd_bitblt_text_t creatorfb_bitblt_text; static const struct vt_driver vt_creatorfb_driver = { .vd_name = "creatorfb", .vd_probe = creatorfb_probe, .vd_init = creatorfb_init, .vd_blank = creatorfb_blank, - .vd_bitbltchr = creatorfb_bitbltchr, + .vd_bitblt_text = creatorfb_bitblt_text, .vd_fb_ioctl = vt_fb_ioctl, .vd_fb_mmap = vt_fb_mmap, .vd_priority = VD_PRIORITY_SPECIFIC @@ -176,9 +176,10 @@ creatorfb_blank(struct vt_device *vd, te } static void -creatorfb_bitbltchr(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) +creatorfb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *pattern, const uint8_t *mask, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y, term_color_t fg, term_color_t bg) { struct creatorfb_softc *sc = vd->vd_softc; u_long line; @@ -191,15 +192,15 @@ creatorfb_bitbltchr(struct vt_device *vd b = m = 0; /* Don't try to put off screen pixels */ - if (((left + width) > vd->vd_width) || ((top + height) > + if (((x + width) > vd->vd_width) || ((y + height) > vd->vd_height)) return; - line = (sc->fb.fb_stride * top) + 4*left; + line = (sc->fb.fb_stride * y) + 4*x; for (; height > 0; height--) { for (c = 0; c < width; c++) { if (c % 8 == 0) - b = *src++; + b = *pattern++; else b <<= 1; if (mask != NULL) { @@ -218,3 +219,56 @@ creatorfb_bitbltchr(struct vt_device *vd } } +void +creatorfb_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_offset.tp_col; + y = row * vf->vf_height + vw->vw_offset.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); + + creatorfb_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 + + vw->vw_offset.tp_col; + drawn_area.tr_begin.tp_row = area->tr_begin.tp_row * vf->vf_height + + vw->vw_offset.tp_row; + drawn_area.tr_end.tp_col = area->tr_end.tp_col * vf->vf_width + + vw->vw_offset.tp_col; + drawn_area.tr_end.tp_row = area->tr_end.tp_row * vf->vf_height + + vw->vw_offset.tp_row; + + if (vt_is_cursor_in_area(vd, &drawn_area)) { + creatorfb_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_mcursor_fg, vd->vd_mcursor_bg); + } +#endif +}