Home | History | Annotate | Download | only in wscons

Lines Matching refs:gc

60 glyphcache_init(glyphcache *gc, int first, int lines, int width,
63 return glyphcache_init_align(gc, first, lines, width, cellwidth, cellheight,
68 glyphcache_init_align(glyphcache *gc, int first, int lines, int width,
74 gc->gc_width = width;
75 gc->gc_cellwidth = -1;
76 gc->gc_cellheight = -1;
77 gc->gc_firstline = first;
78 gc->gc_firstcol = 0;
79 gc->gc_lines = lines;
80 gc->gc_cellalign = alignment;
81 gc->gc_buckets = NULL;
82 gc->gc_numbuckets = 0;
84 gc->gc_buckets = kmem_alloc(sizeof(*gc->gc_buckets) * NBUCKETS,
86 gc->gc_nbuckets = NBUCKETS;
87 return glyphcache_reconfig(gc, cellwidth, cellheight, attr);
92 glyphcache_init_x(glyphcache *gc, int x, int y, int lines, int width,
98 gc->gc_width = width;
99 gc->gc_cellwidth = -1;
100 gc->gc_cellheight = -1;
101 gc->gc_firstline = y;
102 gc->gc_firstcol = x;
103 gc->gc_lines = lines;
104 gc->gc_cellalign = 0;
105 gc->gc_buckets = NULL;
106 gc->gc_numbuckets = 0;
108 gc->gc_buckets = kmem_alloc(sizeof(*gc->gc_buckets) * NBUCKETS,
110 gc->gc_nbuckets = NBUCKETS;
111 return glyphcache_reconfig(gc, cellwidth, cellheight, attr);
116 glyphcache_reconfig(glyphcache *gc, int cellwidth, int cellheight, long attr)
122 if ((gc->gc_cellwidth == cellwidth) &&
123 (gc->gc_cellheight == cellheight) &&
124 ((gc->gc_buckets != NULL) &&
125 (gc->gc_buckets[0].gb_index == attr2idx(attr)))) {
129 gc->gc_cellwidth = cellwidth;
130 if (gc->gc_cellalign != 0) {
132 gc->gc_cellstride =
133 (gc->gc_cellwidth + gc->gc_cellalign - 1) &
134 ~(gc->gc_cellalign - 1);
136 gc->gc_cellstride = cellwidth;
137 gc->gc_cellheight = cellheight;
139 gc->gc_cellsperline = gc->gc_width / gc->gc_cellstride;
141 cache_lines = gc->gc_lines / cellheight;
142 gc->gc_numcells = cache_lines * gc->gc_cellsperline;
145 buckets = (gc->gc_numcells / 223);
146 if ((buckets * 223) < gc->gc_numcells)
156 buckets = uimin(buckets, gc->gc_nbuckets);
157 gc->gc_numbuckets = buckets;
161 b = &gc->gc_buckets[i];
163 b->gb_numcells = uimin(223, gc->gc_numcells - usedcells);
171 gc->gc_attrmap[i] = -1;
177 gc->gc_attrmap[idx] = 0;
178 gc->gc_buckets[0].gb_index = idx;
181 glyphcache_wipe(gc);
183 gc->gc_numcells, gc->gc_firstline, gc->gc_cellsperline);
185 gc->gc_cellwidth, gc->gc_cellheight, gc->gc_cellstride);
192 glyphcache *gc = cookie;
195 if (ri->ri_wsfcookie != gc->gc_fontcookie) {
196 glyphcache_wipe(gc);
197 gc->gc_fontcookie = ri->ri_wsfcookie;
200 glyphcache_reconfig(gc, ri->ri_font->fontwidth,
205 glyphcache_wipe(glyphcache *gc)
210 if ((gc->gc_buckets == NULL) || (gc->gc_numbuckets < 1))
213 idx = gc->gc_buckets[0].gb_index;
216 for (i = 0; i < gc->gc_numbuckets; i++) {
217 b = &gc->gc_buckets[i];
225 gc->gc_attrmap[i] = -1;
229 gc->gc_attrmap[idx] = 0;
230 gc->gc_buckets[0].gb_index = idx;
239 glyphcache_add(glyphcache *gc, int c, int x, int y)
241 gc_bucket *b = gc->gc_next;
249 cy = gc->gc_firstline +
250 (cell / gc->gc_cellsperline) * gc->gc_cellheight;
251 cx = gc->gc_firstcol +
252 (cell % gc->gc_cellsperline) * gc->gc_cellstride;
254 gc->gc_bitblt(gc->gc_blitcookie, x, y, cx, cy,
255 gc->gc_cellwidth, gc->gc_cellheight, gc->gc_rop);
256 if (gc->gc_underline & 1) {
257 glyphcache_underline(gc, x, y, gc->gc_underline);
263 glyphcache_underline(glyphcache *gc, int x, int y, long attr)
265 if (gc->gc_rectfill == NULL)
268 gc->gc_rectfill(gc->gc_blitcookie, x, y + gc->gc_cellheight - 2,
269 gc->gc_cellwidth, 1, attr);
279 glyphcache_try(glyphcache *gc, int c, int x, int y, long attr)
289 bi = gc->gc_attrmap[idx];
293 while ((bi < gc->gc_numbuckets) &&
294 (gc->gc_buckets[bi].gb_index != -1)) {
297 if (bi < gc->gc_numbuckets) {
299 gc->gc_attrmap[idx] = bi;
300 b = &gc->gc_buckets[bi];
313 for (i = 1; i < gc->gc_numbuckets; i++) {
314 if (gc->gc_buckets[i].gb_lastread < moo) {
316 moo = gc->gc_buckets[i].gb_lastread;
321 b = &gc->gc_buckets[oldest];
322 gc->gc_attrmap[b->gb_index] = -1;
325 gc->gc_attrmap[idx] = oldest;
334 b = &gc->gc_buckets[bi];
343 gc->gc_next = b;
344 gc->gc_underline = attr;
351 gc->gc_bitblt(gc->gc_blitcookie, cx, cy, x, y,
352 gc->gc_cellwidth, gc->gc_cellheight, gc->gc_rop);
355 glyphcache_underline(gc, x, y, attr);