X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=mware%2Ftext.c;h=692119119b32f29f444af74ea7594be07551cb0e;hb=64969cdb6b48f50b642178779baf9e1e317e0645;hp=5bb0df2d563f51b5ff179b36cf8e0bf134620716;hpb=96f0ef786b54356c56cc3d4e4f0838df2505cfcc;p=bertos.git diff --git a/mware/text.c b/mware/text.c index 5bb0df2d..69211911 100755 --- a/mware/text.c +++ b/mware/text.c @@ -1,56 +1,79 @@ /*! * \file * * - * \version $Id$ + * \brief Text graphic routines * + * \version $Id$ * \author Bernardo Innocenti * \author Stefano Fedrigo - * - * \brief Text graphic routines */ -/* - * $Log$ - * Revision 1.2 2004/06/03 11:27:09 bernie - * Add dual-license information. - * - * Revision 1.1 2004/05/23 15:43:16 bernie - * Import mware modules. - * - * Revision 1.17 2004/05/15 16:57:01 aleph - * Fixes for non-DEBUG build - * - * Revision 1.16 2004/04/03 20:42:49 aleph - * Add text_clear() - * - * Revision 1.15 2004/03/24 15:03:45 bernie - * Use explicit include paths; clean Doxygen comments - * - * Revision 1.14 2004/03/19 16:52:28 bernie - * Move printf() like functions from text.c to text_format.c and add PROGMEM versions. - * - * Revision 1.13 2004/03/17 18:23:32 bernie - * Oops. - * - * Revision 1.12 2004/03/17 18:03:22 bernie - * Make diagnostic message shorter - * - * Revision 1.11 2004/03/13 22:52:54 aleph - * documentation fixes - */ +/*#* + *#* $Log$ + *#* Revision 1.11 2005/01/20 18:46:31 aleph + *#* Fix progmem includes. + *#* + *#* Revision 1.10 2005/01/08 09:20:12 bernie + *#* Really make it work on both architectures. + *#* + *#* Revision 1.9 2004/12/31 16:44:29 bernie + *#* Sanitize for non-Harvard processors. + *#* + *#* Revision 1.8 2004/11/16 21:16:28 bernie + *#* Update to new naming scheme in mware/gfx.c. + *#* + *#* Revision 1.7 2004/09/20 03:28:28 bernie + *#* Fix header. + *#* + *#* Revision 1.6 2004/09/14 20:57:15 bernie + *#* Use debug.h instead of kdebug.h. + *#* + *#* Revision 1.5 2004/09/06 21:51:26 bernie + *#* Extend interface to allow any algorithmic style. + *#* + *#* Revision 1.2 2004/06/03 11:27:09 bernie + *#* Add dual-license information. + *#* + *#* Revision 1.1 2004/05/23 15:43:16 bernie + *#* Import mware modules. + *#* + *#* Revision 1.17 2004/05/15 16:57:01 aleph + *#* Fixes for non-DEBUG build + *#* + *#* Revision 1.16 2004/04/03 20:42:49 aleph + *#* Add text_clear() + *#* + *#* Revision 1.15 2004/03/24 15:03:45 bernie + *#* Use explicit include paths; clean Doxygen comments + *#* + *#* Revision 1.14 2004/03/19 16:52:28 bernie + *#* Move printf() like functions from text.c to text_format.c and add PROGMEM versions. + *#* + *#* Revision 1.13 2004/03/17 18:23:32 bernie + *#* Oops. + *#* + *#* Revision 1.12 2004/03/17 18:03:22 bernie + *#* Make diagnostic message shorter + *#* + *#* Revision 1.11 2004/03/13 22:52:54 aleph + *#* documentation fixes + *#*/ #include "gfx.h" #include "font.h" #include "text.h" -#include + +#include + /*! * Flags degli stili algoritmici + * * La routine di rendering del testo e' in grado di applicare * delle semplici trasformazioni al font interno per generare * automaticamente degli stili predefiniti (bold, italic, @@ -89,7 +112,7 @@ void text_setcoord(struct Bitmap *bm, int x, int y) /*! - * Render char c + * Render char \a c on Bitmap \a bm */ static int text_putglyph(char c, struct Bitmap *bm) { @@ -136,7 +159,7 @@ static int text_putglyph(char c, struct Bitmap *bm) /* Per ogni colonna di dot del glyph... */ for (i = 0; i < glyph_width; ++i) { - dots = pgm_read_byte(glyph); + dots = PGM_READ_CHAR(glyph); /* Advance to next column in glyph. * Expand: advances only once every two columns @@ -174,7 +197,7 @@ static int text_putglyph(char c, struct Bitmap *bm) } else /* No style: fast vanilla copy of glyph to line buffer */ while (glyph_width--) - *buf++ = pgm_read_byte(glyph++); + *buf++ = PGM_READ_CHAR(glyph++); return c; } @@ -191,14 +214,14 @@ int text_putchar(char c, struct Bitmap *bm) { switch (c) { - case ANSI_ESC_CLEARSCREEN: - gfx_ClearBitmap(bm); - bm->penX = 0; - bm->penY = 0; - text_style(0, STYLEF_MASK); - break; - DB(default: - kprintf("Unknown ANSI esc code: %x\n", c);) + case ANSI_ESC_CLEARSCREEN: + gfx_bitmapClear(bm); + bm->penX = 0; + bm->penY = 0; + text_style(0, STYLEF_MASK); + break; + DB(default: + kprintf("Unknown ANSI esc code: %x\n", c);) } ansi_mode = false; } @@ -232,6 +255,12 @@ void text_clear(struct Bitmap *bmp) } +void text_clearLine(struct Bitmap *bmp, int line) +{ + gfx_rectClear(bmp, 0, line * FONT_HEIGHT, bmp->width, (line + 1) * FONT_HEIGHT); +} + + /*! * Set/clear algorithmic font style bits. *