From: bernie Date: Wed, 22 Mar 2006 09:50:46 +0000 (+0000) Subject: Use the same format for fonts and rasters. X-Git-Tag: 1.0.0~658 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=13a373300e871787938e2d647dd8dd048294a2f0;p=bertos.git Use the same format for fonts and rasters. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@583 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/fonts/convbdf b/fonts/convbdf index 82e5edf7..8b53ed9c 100755 --- a/fonts/convbdf +++ b/fonts/convbdf @@ -111,9 +111,9 @@ while () { # GLYPH DATA if ($IMAGE_VERTICAL) { - for (my $x = 0; $x < $width; $x++) { - my $bitstring = ""; - for (my $k = 0; $k < int(($ch_height + $IMAGE_BITS - 1) / $IMAGE_BITS); $k++) { + my $bitstring = ""; + for (my $k = 0; $k < int(($ch_height + $IMAGE_BITS - 1) / $IMAGE_BITS); $k++) { + for (my $x = 0; $x < $width; $x++) { my $v = 0; for (my $y = 0; $y < $IMAGE_BITS && ($y + $k * $IMAGE_BITS < $ch_height); ++$y) { my $bit = ($bm[$k * $IMAGE_BITS + $y][int($x / $IMAGE_BITS)] & (1 << ($IMAGE_BITS - ($x % $IMAGE_BITS) - 1))) ? 1 : 0; diff --git a/gfx/gfx_p.h b/gfx/gfx_p.h index 101eb12c..0df75718 100755 --- a/gfx/gfx_p.h +++ b/gfx/gfx_p.h @@ -15,6 +15,9 @@ /*#* *#* $Log$ + *#* Revision 1.4 2006/03/22 09:50:37 bernie + *#* Use the same format for fonts and rasters. + *#* *#* Revision 1.3 2006/02/15 09:10:15 bernie *#* Implement prop fonts; Fix algo styles. *#* @@ -32,25 +35,20 @@ #if CONFIG_BITMAP_FMT == BITMAP_FMT_PLANAR_H_MSB - //TODO: Collapse with RAST_* macros - #define BM_ADDR(bm, x, y) ((bm)->raster + (y) * (bm)->stride + ((x) / 8)) - #define BM_MASK(bm, x, y) (1 << (7 - (x) % 8)) - #define RAST_ADDR(raster, x, y, stride) ((raster) + (y) * (stride) + (x) / 8) #define RAST_MASK(raster, x, y) (1 << (7 - (x) % 8)) #elif CONFIG_BITMAP_FMT == BITMAP_FMT_PLANAR_V_LSB - #define BM_ADDR(bm, x, y) ((bm)->raster + ((y) / 8) * (bm)->stride + (x)) - #define BM_MASK(bm, x, y) (1 << ((y) % 8)) - - // FIXME: not the same format of bitmaps! - #define RAST_ADDR(raster, x, y, stride) ((raster) + (y) / 8 + (x) * (stride)) + #define RAST_ADDR(raster, x, y, stride) ((raster) + ((y) / 8) * (stride) + (x)) #define RAST_MASK(raster, x, y) (1 << ((y) % 8)) #else #error Unknown value of CONFIG_BITMAP_FMT #endif /* CONFIG_BITMAP_FMT */ +#define BM_ADDR(bm, x, y) RAST_ADDR((bm)->raster, (x), (y), (bm)->stride) +#define BM_MASK(bm, x, y) RAST_MASK((bm)->raster, (x), (y)) + /*! * Plot a pixel in bitmap \a bm. * diff --git a/gfx/text.c b/gfx/text.c index f8705cc4..08d3ae61 100755 --- a/gfx/text.c +++ b/gfx/text.c @@ -15,6 +15,9 @@ /*#* *#* $Log$ + *#* Revision 1.8 2006/03/22 09:50:37 bernie + *#* Use the same format for fonts and rasters. + *#* *#* Revision 1.7 2006/03/20 17:51:55 bernie *#* Cleanups. *#* @@ -213,7 +216,7 @@ static int text_putglyph(char c, struct Bitmap *bm) src_col /= 2; /* Fetch a column of dots from glyph. */ - dots = PGM_READ_CHAR(glyph + src_col * glyph_height_bytes + row); + dots = PGM_READ_CHAR(RAST_ADDR(glyph, src_col, row * 8, glyph_width)); /* Italic: get lower 4 dots from previous column */ if (styles & STYLEF_ITALIC) @@ -249,7 +252,7 @@ static int text_putglyph(char c, struct Bitmap *bm) else { /* No style: fast vanilla copy of glyph to bitmap */ - gfx_blitRaster(bm, bm->penX, bm->penY, glyph, glyph_width, glyph_height, glyph_height_bytes); + gfx_blitRaster(bm, bm->penX, bm->penY, glyph, glyph_width, glyph_height, glyph_width); } /* Update current pen position */