From owner-svn-src-all@FreeBSD.ORG Fri Feb 7 12:39:58 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E49D637D; Fri, 7 Feb 2014 12:39:58 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CF78E16E4; Fri, 7 Feb 2014 12:39:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s17Cdw0F007684; Fri, 7 Feb 2014 12:39:58 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s17CdwIH007683; Fri, 7 Feb 2014 12:39:58 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201402071239.s17CdwIH007683@svn.freebsd.org> From: Aleksandr Rybalko Date: Fri, 7 Feb 2014 12:39:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261585 - head/sys/dev/vt/hw/vga X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Feb 2014 12:39:59 -0000 Author: ray Date: Fri Feb 7 12:39:58 2014 New Revision: 261585 URL: http://svnweb.freebsd.org/changeset/base/261585 Log: Implement vd_drawrect and vd_setpixel for vt(9)'s VGA driver. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/hw/vga/vga.c Modified: head/sys/dev/vt/hw/vga/vga.c ============================================================================== --- head/sys/dev/vt/hw/vga/vga.c Fri Feb 7 11:40:50 2014 (r261584) +++ head/sys/dev/vt/hw/vga/vga.c Fri Feb 7 12:39:58 2014 (r261585) @@ -74,6 +74,8 @@ struct vga_softc { static vd_init_t vga_init; static vd_blank_t vga_blank; static vd_bitbltchr_t vga_bitbltchr; +static vd_drawrect_t vga_drawrect; +static vd_setpixel_t vga_setpixel; static vd_putchar_t vga_putchar; static vd_postswitch_t vga_postswitch; @@ -81,6 +83,8 @@ static const struct vt_driver vt_vga_dri .vd_init = vga_init, .vd_blank = vga_blank, .vd_bitbltchr = vga_bitbltchr, + .vd_drawrect = vga_drawrect, + .vd_setpixel = vga_setpixel, .vd_putchar = vga_putchar, .vd_postswitch = vga_postswitch, .vd_priority = VD_PRIORITY_GENERIC, @@ -139,6 +143,31 @@ vga_bitblt_put(struct vt_device *vd, u_l } } +static void +vga_setpixel(struct vt_device *vd, int x, int y, term_color_t color) +{ + + vga_bitblt_put(vd, (y * VT_VGA_WIDTH / 8) + (x / 8), color, + 0x80 >> (x % 8)); +} + +static void +vga_drawrect(struct vt_device *vd, int x1, int y1, int x2, int y2, int fill, + term_color_t color) +{ + int x, y; + + for (y = y1; y <= y2; y++) { + if (fill || (y == y1) || (y == y2)) { + for (x = x1; x <= x2; x++) + vga_setpixel(vd, x, y, color); + } else { + vga_setpixel(vd, x1, y, color); + vga_setpixel(vd, x2, y, color); + } + } +} + static inline void vga_bitblt_draw(struct vt_device *vd, const uint8_t *src, u_long ldst, uint8_t shift, unsigned int width, unsigned int height,