Module Name:    src
Committed By:   macallan
Date:           Thu Apr 19 08:46:17 UTC 2012

Modified Files:
        src/sys/dev/wscons: wsdisplay_glyphcache.c wsdisplay_glyphcachevar.h

Log Message:
no need to convert cell number to coordinates every time we draw a glyph
from cache - just stick the coordinates directly into the map


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/wscons/wsdisplay_glyphcache.c \
    src/sys/dev/wscons/wsdisplay_glyphcachevar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/wscons/wsdisplay_glyphcache.c
diff -u src/sys/dev/wscons/wsdisplay_glyphcache.c:1.1 src/sys/dev/wscons/wsdisplay_glyphcache.c:1.2
--- src/sys/dev/wscons/wsdisplay_glyphcache.c:1.1	Thu Feb 16 17:29:21 2012
+++ src/sys/dev/wscons/wsdisplay_glyphcache.c	Thu Apr 19 08:46:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_glyphcache.c,v 1.1 2012/02/16 17:29:21 macallan Exp $	*/
+/*	$NetBSD: wsdisplay_glyphcache.c,v 1.2 2012/04/19 08:46:17 macallan Exp $	*/
 
 /*
  * Copyright (c) 2012 Michael Lorenz
@@ -82,10 +82,10 @@ glyphcache_add(glyphcache *gc, int c, in
 	if (gc->gc_usedcells >= gc->gc_numcells)
 		return ENOMEM;
 	cell = atomic_add_int_nv(&gc->gc_usedcells, 1) - 1;
-	gc->gc_map[c] = cell;
 	cy = gc->gc_firstline +
 	    (cell / gc->gc_cellsperline) * gc->gc_cellheight;
 	cx = (cell % gc->gc_cellsperline) * gc->gc_cellwidth;
+	gc->gc_map[c] = (cx << 16) | cy;
 	gc->gc_bitblt(gc->gc_blitcookie, x, y, cx, cy,
 	    gc->gc_cellwidth, gc->gc_cellheight, gc->gc_rop);
 	return 0;
@@ -109,9 +109,8 @@ glyphcache_try(glyphcache *gc, int c, in
 	cell = gc->gc_map[c];
 	if (cell == -1)
 		return GC_ADD;
-	cy = gc->gc_firstline +
-	    (cell / gc->gc_cellsperline) * gc->gc_cellheight;
-	cx = (cell % gc->gc_cellsperline) * gc->gc_cellwidth;
+	cy = cell & 0xffff;
+	cx = (cell >> 16) & 0xffff;
 	gc->gc_bitblt(gc->gc_blitcookie, cx, cy, x, y,
 	    gc->gc_cellwidth, gc->gc_cellheight, gc->gc_rop);
 	return GC_OK;
Index: src/sys/dev/wscons/wsdisplay_glyphcachevar.h
diff -u src/sys/dev/wscons/wsdisplay_glyphcachevar.h:1.1 src/sys/dev/wscons/wsdisplay_glyphcachevar.h:1.2
--- src/sys/dev/wscons/wsdisplay_glyphcachevar.h:1.1	Thu Feb 16 17:29:21 2012
+++ src/sys/dev/wscons/wsdisplay_glyphcachevar.h	Thu Apr 19 08:46:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_glyphcachevar.h,v 1.1 2012/02/16 17:29:21 macallan Exp $	*/
+/*	$NetBSD: wsdisplay_glyphcachevar.h,v 1.2 2012/04/19 08:46:17 macallan Exp $	*/
 
 /*
  * Copyright (c) 2012 Michael Lorenz
@@ -34,7 +34,7 @@ typedef struct _glyphcache {
 	/* mapping char codes to cache cells */
 	volatile unsigned int gc_usedcells;
 	int gc_numcells;
-	int gc_map[256];
+	uint32_t gc_map[256];
 	/* geometry */
 	int gc_cellwidth;
 	int gc_cellheight;

Reply via email to