# 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;
/*#*
*#* $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.
*#*
#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.
*
/*#*
*#* $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.
*#*
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)
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 */