Changeset dcdc31d in mainline for kernel/genarch/src/fb/fb.c
- Timestamp:
- 2009-03-24T14:37:39Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4ccdcf6
- Parents:
- ac7c8d12
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/fb/fb.c
rac7c8d12 rdcdc31d 54 54 55 55 static uint8_t *fb_addr; 56 static uint 8_t *backbuf;56 static uint16_t *backbuf; 57 57 static uint8_t *glyphs; 58 58 static uint8_t *bgscan; … … 200 200 * 201 201 */ 202 static void glyph_draw(uint 8_t glyph, unsigned int col, unsigned int row, bool silent)202 static void glyph_draw(uint16_t glyph, unsigned int col, unsigned int row, bool silent) 203 203 { 204 204 unsigned int x = COL2X(col); … … 243 243 for (col = 0, x = 0; col < cols; col++, 244 244 x += FONT_WIDTH) { 245 uint 8_t glyph;245 uint16_t glyph; 246 246 247 247 if (row < rows - 1) { … … 262 262 } 263 263 264 memmove(backbuf, backbuf + cols, cols * (rows - 1));265 memset b(&backbuf[BB_POS(0, rows - 1)], cols, 0);264 memmove(backbuf, &backbuf[BB_POS(0, 1)], cols * (rows - 1) * sizeof(uint16_t)); 265 memsetw(&backbuf[BB_POS(0, rows - 1)], cols, 0); 266 266 } 267 267 … … 269 269 static void cursor_put(bool silent) 270 270 { 271 glyph_draw( CURSOR, position % cols, position / cols, silent);271 glyph_draw(fb_font_glyph(CURSOR), position % cols, position / cols, silent); 272 272 } 273 273 … … 275 275 static void cursor_remove(bool silent) 276 276 { 277 glyph_draw( 0, position % cols, position / cols, silent);277 glyph_draw(fb_font_glyph(0), position % cols, position / cols, silent); 278 278 } 279 279 … … 284 284 * 285 285 */ 286 static void fb_putchar(outdev_t *dev, charch, bool silent)286 static void fb_putchar(outdev_t *dev, wchar_t ch, bool silent) 287 287 { 288 288 spinlock_lock(&fb_lock); … … 306 306 cursor_remove(silent); 307 307 do { 308 glyph_draw( (uint8_t) ' ', position % cols,308 glyph_draw(fb_font_glyph(' '), position % cols, 309 309 position / cols, silent); 310 310 position++; … … 312 312 break; 313 313 default: 314 glyph_draw( (uint8_t) ch, position % cols,314 glyph_draw(fb_font_glyph(ch), position % cols, 315 315 position / cols, silent); 316 316 position++; … … 342 342 { 343 343 /* Prerender glyphs */ 344 u nsigned int glyph;344 uint16_t glyph; 345 345 346 346 for (glyph = 0; glyph < FONT_GLYPHS; glyph++) { … … 353 353 void *dst = &glyphs[GLYPH_POS(glyph, y) + 354 354 x * pixelbytes]; 355 uint32_t rgb = (fb_font[ ROW2Y(glyph) +y] &355 uint32_t rgb = (fb_font[glyph][y] & 356 356 (1 << (7 - x))) ? FG_COLOR : BG_COLOR; 357 357 rgb_conv(dst, rgb); … … 399 399 for (col = 0, x = 0; col < cols; 400 400 col++, x += FONT_WIDTH) { 401 void *d = &fb_addr[FB_POS(x, y + yd)];402 void * s = &glyphs[GLYPH_POS(backbuf[BB_POS(col,403 row)], yd)];404 memcpy(d , s, glyphscanline);401 uint16_t glyph = backbuf[BB_POS(col, row)]; 402 void *dst = &fb_addr[FB_POS(x, y + yd)]; 403 void *src = &glyphs[GLYPH_POS(glyph, yd)]; 404 memcpy(dst, src, glyphscanline); 405 405 } 406 406 } … … 495 495 bgscanbytes = xres * pixelbytes; 496 496 497 unsigned int fbsize = scanline * yres;498 unsigned int bbsize = cols * rows;499 unsigned int glyphsize = FONT_GLYPHS * glyphbytes;500 501 backbuf = (uint 8_t *) malloc(bbsize, 0);497 size_t fbsize = scanline * yres; 498 size_t bbsize = cols * rows * sizeof(uint16_t); 499 size_t glyphsize = FONT_GLYPHS * glyphbytes; 500 501 backbuf = (uint16_t *) malloc(bbsize, 0); 502 502 if (!backbuf) 503 503 panic("Unable to allocate backbuffer."); … … 511 511 panic("Unable to allocate background pixel."); 512 512 513 memset b(backbuf, bbsize, 0);513 memsetw(backbuf, cols * rows, 0); 514 514 515 515 glyphs_render();
Note:
See TracChangeset
for help on using the changeset viewer.