diff options
author | Jens Arnold <amiconn@rockbox.org> | 2004-05-14 22:55:05 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2004-05-14 22:55:05 +0000 |
commit | 2d446fef067a8fbf86343160df3799870d65aa6a (patch) | |
tree | 15edae3baf50a3f66f4e4b2407e61f4845d640fb /firmware/font.c | |
parent | c431e227367d18b6b487b7f72aab2653c529450f (diff) | |
download | rockbox-2d446fef067a8fbf86343160df3799870d65aa6a.tar.gz rockbox-2d446fef067a8fbf86343160df3799870d65aa6a.zip |
Fixed lcd_bitmap() to use the bitmap format generated by bmp2rb correctly. Now it works for height > 8. Adapted font transposing & changed some other places to take advantage of that. bounce.c was (apart from fonts) the only routine that used the old format correctly.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4620 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/font.c')
-rw-r--r-- | firmware/font.c | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/firmware/font.c b/firmware/font.c index f1762ba698..7c83923904 100644 --- a/firmware/font.c +++ b/firmware/font.c | |||
@@ -300,6 +300,7 @@ static void rotate_font_bits(struct font* pf) | |||
300 | * Take an bitmap_t bitmap and convert to Rockbox format. | 300 | * Take an bitmap_t bitmap and convert to Rockbox format. |
301 | * Used for converting font glyphs for the time being. | 301 | * Used for converting font glyphs for the time being. |
302 | * Can use for standard X11 and Win32 images as well. | 302 | * Can use for standard X11 and Win32 images as well. |
303 | * See format description in lcd-recorder.c | ||
303 | * | 304 | * |
304 | * Doing it this way keeps fonts in standard formats, | 305 | * Doing it this way keeps fonts in standard formats, |
305 | * as well as keeping Rockbox hw bitmap format. | 306 | * as well as keeping Rockbox hw bitmap format. |
@@ -308,52 +309,44 @@ static void rotleft(unsigned char *dst, bitmap_t *src, unsigned int width, | |||
308 | unsigned int height) | 309 | unsigned int height) |
309 | { | 310 | { |
310 | unsigned int i,j; | 311 | unsigned int i,j; |
311 | unsigned int dst_col = 0; /* destination column*/ | ||
312 | unsigned int dst_shift = 0; /* destination shift amount*/ | ||
313 | unsigned int dst_linelen; /* # bytes per output row*/ | ||
314 | unsigned int src_words; /* # words of input image*/ | 312 | unsigned int src_words; /* # words of input image*/ |
315 | 313 | unsigned int dst_mask; /* bit mask for destination */ | |
316 | /* calc bytes per output row*/ | 314 | bitmap_t src_mask; /* bit mask for source */ |
317 | dst_linelen = (height-1)/8+1; | ||
318 | 315 | ||
319 | /* calc words of input image*/ | 316 | /* calc words of input image*/ |
320 | src_words = BITMAP_WORDS(width) * height; | 317 | src_words = BITMAP_WORDS(width) * height; |
321 | 318 | ||
322 | /* clear background*/ | 319 | /* clear background*/ |
323 | memset(dst, 0, dst_linelen*width); | 320 | memset(dst, 0, ((height + 7) / 8) * width); |
324 | 321 | ||
325 | for (i=0; i < src_words; i++) { | 322 | dst_mask = 1; |
326 | bitmap_t srcmap; /* current src input bit*/ | ||
327 | bitmap_t dstmap; /* current dst output bit*/ | ||
328 | |||
329 | /* calc src input bit*/ | ||
330 | srcmap = 1 << (sizeof(bitmap_t)*8-1); | ||
331 | 323 | ||
332 | /* calc dst output bit*/ | 324 | for (i=0; i < src_words; i++) { |
333 | if (i>0 && (i%8==0)) { | ||
334 | ++dst_col; | ||
335 | dst_shift = 0; | ||
336 | } | ||
337 | dstmap = 1 << dst_shift++; | ||
338 | 325 | ||
326 | /* calc src input bit*/ | ||
327 | src_mask = 1 << (sizeof (bitmap_t) * 8 - 1); | ||
328 | |||
339 | /* for each input column...*/ | 329 | /* for each input column...*/ |
340 | for(j=0; j < width; j++) { | 330 | for(j=0; j < width; j++) { |
341 | 331 | ||
342 | /* calc input bitmask*/ | 332 | /* if set in input, set in rotated output */ |
343 | bitmap_t bit = srcmap >> j; | 333 | if (src[i] & src_mask) |
344 | if (bit==0) { | 334 | dst[j] |= dst_mask; |
345 | srcmap = 1 << (sizeof(bitmap_t)*8-1); | ||
346 | bit = srcmap >> (j % 16); | ||
347 | } | ||
348 | 335 | ||
349 | /* if set in input, set in rotated output*/ | 336 | src_mask >>= 1; /* next input bit */ |
350 | if (bit & src[i]) { | 337 | if (src_mask == 0) /* input word done? */ |
351 | /* input column j becomes output row*/ | 338 | { |
352 | dst[j*dst_linelen + dst_col] |= dstmap; | 339 | src_mask = 1 << (sizeof (bitmap_t) * 8 - 1); |
340 | i++; /* next input word */ | ||
353 | } | 341 | } |
354 | /*debugf((bit & src[i])? "*": ".");*/ | ||
355 | } | 342 | } |
356 | /*debugf("\n");*/ | 343 | |
344 | dst_mask <<= 1; /* next output bit (row) */ | ||
345 | if (dst_mask > (1 << 7)) /* output bit > 7? */ | ||
346 | { | ||
347 | dst_mask = 1; | ||
348 | dst += width; /* next output byte row */ | ||
349 | } | ||
357 | } | 350 | } |
358 | } | 351 | } |
359 | #endif /* HAVE_LCD_BITMAP */ | 352 | #endif /* HAVE_LCD_BITMAP */ |