svn commit: r317198 - head/sys/dev/syscons

Bruce Evans bde at FreeBSD.org
Thu Apr 20 16:34:11 UTC 2017


Author: bde
Date: Thu Apr 20 16:34:09 2017
New Revision: 317198
URL: https://svnweb.freebsd.org/changeset/base/317198

Log:
  When the character width is 9, remove vertical lines in the mouse cursor
  corresponding to the gaps between characters.  This fixes distortion
  of the cursor due to expanding it across the gaps.
  
  Again for character width 9, when the cursor characters are not in the
  graphics range (0xb0-0xdf), the gaps were always there (filled in the
  background color for the previous char).  They still look strange, but
  don't cause distortion.  When the cursor characters are in the graphics
  range, the gaps are filled by repeating the previous line.  This gives
  distortion with cilia.  Removing vertical lines reduces the distortion
  to vertical cilia.
  
  Move the default for the cursor characters out of the graphics range.
  With character width 9, this gives gaps instead of distortion and
  other problems.  With character width 8, it just fixes a smaller set
  of other problems.  Some distortion and other problems can be recovered
  using vidcontrol -M.  Presumably the default was to fill the gaps
  intentionally, but it is much better to leave gaps.  The gaps can even
  be considered as a feature for text processing -- they give sub-pointers
  to character boundaries.  The other problems are: (1) with character
  width 9, characters near the cursor are moved into the graphics range
  and thus distorted if any of their 8th bits is set; (2) conflicts with
  national characters in the graphics range.
  
  The default range for the graphics cursor characters is now 8-11.  This
  doesn't conflict with anything, since the glyphs for the characters in
  this range are unreachable.
  
  Use the 10x16 mouse cursor in text mode too (if the font size is >= 14).
  
  When the character width is 9, removal of 1 or 2 vertical lines makes
  10x16 cursor no wider than the 9x13 one usually was.  We could even
  handle cursors 1 pixel wider in 2 character cells and gaps without
  more clipping than given by the gaps (the worst case is 1 pixel in the
  left cell, 1 removed in the middle gap, 8 in the right cell and 1
  removed in the right gap.  The pixel in the right gap is removed so
  it doesn't matter if it is in the font).
  
  When the character width is 8, we now clip the 10-wide cursor by 1
  pixel in the worst case.  This clipping is usually invisible since it
  is of the border and and the border usually merges with the background
  so is invisible.  There should be an option to use reverse video to
  highlight the border and its tip instead of the interior (graphics
  mode can do better using separate colors).  This needs the 9x13 cursor
  again.
  
  Ideas from: ache (especially about the bad default character range)

Modified:
  head/sys/dev/syscons/scvgarndr.c
  head/sys/dev/syscons/syscons.h

Modified: head/sys/dev/syscons/scvgarndr.c
==============================================================================
--- head/sys/dev/syscons/scvgarndr.c	Thu Apr 20 15:53:20 2017	(r317197)
+++ head/sys/dev/syscons/scvgarndr.c	Thu Apr 20 16:34:09 2017	(r317198)
@@ -173,8 +173,7 @@ static const struct mousedata mouse9x13 
 	0x0c00, 0x0c00, 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, },
 	9, 13,
 };
-#endif
-#if defined(SC_PIXEL_MODE)
+
 static const struct mousedata mouse10x16 = { {
 	0xc000, 0xa000, 0x9000, 0x8800, 0x8400, 0x8200, 0x8100, 0x8080,
 	0x8040, 0x83c0, 0x9200, 0xa900, 0xc900, 0x0480, 0x0480, 0x0300, }, {
@@ -412,6 +411,7 @@ draw_txtmouse(scr_stat *scp, int x, int 
 #ifndef SC_ALT_MOUSE_IMAGE
     if (ISMOUSEAVAIL(scp->sc->adp->va_flags)) {
 	const struct mousedata *mdp;
+	uint32_t border, interior;
 	u_char font_buf[128];
 	u_short cursor[32];
 	u_char c;
@@ -420,7 +420,7 @@ draw_txtmouse(scr_stat *scp, int x, int 
 	int crtc_addr;
 	int i;
 
-	mdp = &mouse9x13;
+	mdp = (scp->font_size < 14) ? &mouse9x13 : &mouse10x16;
 
 	/* prepare mousepointer char's bitmaps */
 	pos = (y/scp->font_size - scp->yoff)*scp->xsize + x/8 - scp->xoff;
@@ -443,9 +443,23 @@ draw_txtmouse(scr_stat *scp, int x, int 
 	xoffset = x%8;
 	yoffset = y%scp->font_size;
 	for (i = 0; i < 16; ++i) {
-		cursor[i + yoffset] =
-	    		(cursor[i + yoffset] & ~(mdp->md_border[i] >> xoffset))
-	    		| (mdp->md_interior[i] >> xoffset);
+		border = mdp->md_border[i] << 8; /* avoid right shifting out */
+		interior = mdp->md_interior[i] << 8;
+		border >>= xoffset;		/* normalize */
+		interior >>= xoffset;
+		if (scp->sc->adp->va_flags & V_ADP_CWIDTH9) {
+			/* skip gaps between characters */
+			border = (border & 0xff0000) |
+				 (border & 0x007f80) << 1 |
+				 (border & 0x00003f) << 2;
+			interior = (interior & 0xff0000) |
+				   (interior & 0x007f80) << 1 |
+				   (interior & 0x00003f) << 2;
+		}
+		border >>= 8;			/* back to normal position */
+		interior >>= 8;
+		cursor[i + yoffset] = (cursor[i + yoffset]  & ~border) |
+				      interior;
 	}
 	for (i = 0; i < scp->font_size; ++i) {
 		font_buf[i] = (cursor[i] & 0xff00) >> 8;

Modified: head/sys/dev/syscons/syscons.h
==============================================================================
--- head/sys/dev/syscons/syscons.h	Thu Apr 20 15:53:20 2017	(r317197)
+++ head/sys/dev/syscons/syscons.h	Thu Apr 20 16:34:09 2017	(r317198)
@@ -68,11 +68,11 @@
 #endif
 
 #ifndef SC_CURSOR_CHAR
-#define SC_CURSOR_CHAR	(0x07)
+#define SC_CURSOR_CHAR	7
 #endif
 
 #ifndef SC_MOUSE_CHAR
-#define SC_MOUSE_CHAR	(0xd0)
+#define SC_MOUSE_CHAR	8
 #endif
 
 #if SC_MOUSE_CHAR <= SC_CURSOR_CHAR && SC_CURSOR_CHAR < (SC_MOUSE_CHAR + 4)


More information about the svn-src-all mailing list