From owner-svn-src-head@FreeBSD.ORG Fri Aug 22 10:49:52 2014 Return-Path: Delivered-To: svn-src-head@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 56043105; Fri, 22 Aug 2014 10:49:52 +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 416E830CB; Fri, 22 Aug 2014 10:49:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7MAnqiH067085; Fri, 22 Aug 2014 10:49:52 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7MAnqrU067084; Fri, 22 Aug 2014 10:49:52 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201408221049.s7MAnqrU067084@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Fri, 22 Aug 2014 10:49:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270324 - 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-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: Fri, 22 Aug 2014 10:49:52 -0000 Author: dumbbell Date: Fri Aug 22 10:49:51 2014 New Revision: 270324 URL: http://svnweb.freebsd.org/changeset/base/270324 Log: vt_vga: Clip the draw area to never draw offscreen This fixes a bug when two windows use different fonts, but a longer-term solution is required. The dirty area should be stored as pixels, not character cells, because such coordinates don't have the same meaning in all windows, when using different fonts. MFC after: 1 week Modified: head/sys/dev/vt/hw/vga/vt_vga.c Modified: head/sys/dev/vt/hw/vga/vt_vga.c ============================================================================== --- head/sys/dev/vt/hw/vga/vt_vga.c Fri Aug 22 10:31:57 2014 (r270323) +++ head/sys/dev/vt/hw/vga/vt_vga.c Fri Aug 22 10:49:51 2014 (r270324) @@ -741,6 +741,19 @@ vga_bitblt_text_gfxmode(struct vt_device y2 = row * vf->vf_height + vd->vd_offset.tp_row; /* + * Clip the area to the screen size. + * + * FIXME: The problem with handling the dirty area in character + * cells is that when using different fonts, the dirty area was + * possibly calculated with a different font than the one we use + * here, leading to out-of-screen coordinates. The dirty area + * should be stored in pixels. + */ + + x2 = min(x2, vd->vd_width - 1); + y2 = min(y2, vd->vd_height - 1); + + /* * Now, we take care of N pixels line at a time (the first for * loop, N = font height), and for these lines, draw one pixels * block at a time (the second for loop), not a character at a