Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Aug 2014 10:49:52 +0000 (UTC)
From:      Jean-Sebastien Pedron <dumbbell@FreeBSD.org>
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
Message-ID:  <201408221049.s7MAnqrU067084@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408221049.s7MAnqrU067084>