Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/wscons no need to convert cell number to coordinates...
details: https://anonhg.NetBSD.org/src/rev/207cf917b5eb
branches: trunk
changeset: 778892:207cf917b5eb
user: macallan <macallan%NetBSD.org@localhost>
date: Thu Apr 19 08:46:17 2012 +0000
description:
no need to convert cell number to coordinates every time we draw a glyph
from cache - just stick the coordinates directly into the map
diffstat:
sys/dev/wscons/wsdisplay_glyphcache.c | 9 ++++-----
sys/dev/wscons/wsdisplay_glyphcachevar.h | 4 ++--
2 files changed, 6 insertions(+), 7 deletions(-)
diffs (51 lines):
diff -r fca495661f1d -r 207cf917b5eb sys/dev/wscons/wsdisplay_glyphcache.c
--- a/sys/dev/wscons/wsdisplay_glyphcache.c Thu Apr 19 06:58:55 2012 +0000
+++ b/sys/dev/wscons/wsdisplay_glyphcache.c Thu Apr 19 08:46:17 2012 +0000
@@ -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 @@
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 @@
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;
diff -r fca495661f1d -r 207cf917b5eb sys/dev/wscons/wsdisplay_glyphcachevar.h
--- a/sys/dev/wscons/wsdisplay_glyphcachevar.h Thu Apr 19 06:58:55 2012 +0000
+++ b/sys/dev/wscons/wsdisplay_glyphcachevar.h Thu Apr 19 08:46:17 2012 +0000
@@ -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 @@
/* 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;
Home |
Main Index |
Thread Index |
Old Index