wsdisplay_glyphcachevar.h revision 1.1 1 /* $NetBSD: wsdisplay_glyphcachevar.h,v 1.1 2012/02/16 17:29:21 macallan Exp $ */
2
3 /*
4 * Copyright (c) 2012 Michael Lorenz
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 /* a simple glyph cache in offscreen memory */
29
30 #ifndef WSDISPLAY_GLYPHCACHEVAR_H
31 #define WSDISPLAY_GLYPHCACHEVAR_H
32
33 typedef struct _glyphcache {
34 /* mapping char codes to cache cells */
35 volatile unsigned int gc_usedcells;
36 int gc_numcells;
37 int gc_map[256];
38 /* geometry */
39 int gc_cellwidth;
40 int gc_cellheight;
41 int gc_cellsperline;
42 int gc_firstline; /* first line in vram to use for glyphs */
43 long gc_attr;
44 /*
45 * method to copy glyphs within vram,
46 * to be initialized before calling glyphcache_init()
47 */
48 void (*gc_bitblt)(void *, int, int, int, int, int, int, int);
49 void *gc_blitcookie;
50 int gc_rop;
51 } glyphcache;
52
53 /* first line, lines, width, cellwidth, cellheight, attr */
54 int glyphcache_init(glyphcache *, int, int, int, int, int, long);
55 /* clear out the cache, for example when returning from X */
56 void glyphcache_wipe(glyphcache *);
57 /* add a glyph to the cache */
58 int glyphcache_add(glyphcache *, int, int, int); /* char code, x, y */
59 /* try to draw a glyph from the cache */
60 int glyphcache_try(glyphcache *, int, int, int, long); /* char code, x, y, attr */
61 #define GC_OK 0 /* glyph was in cache and has been drawn */
62 #define GC_ADD 1 /* glyph is not in cache but can be added */
63 #define GC_NOPE 2 /* glyph is not in cache and can't be added */
64
65 #endif /* WSDISPLAY_GLYPHCACHEVAR_H */