Revert "lcd/render.c: save 56 bytes"

This reverts commit ad0c993136.
This commit is contained in:
Stefan `Sec` Zehl 2011-08-03 22:31:46 +02:00
parent 35c73e6266
commit a5f8a9b04f
1 changed files with 12 additions and 18 deletions

View File

@ -8,7 +8,6 @@
#include "fonts/smallfonts.h" #include "fonts/smallfonts.h"
#include "filesystem/ff.h" #include "filesystem/ff.h"
#include "render.h"
/* Global Variables */ /* Global Variables */
const struct FONT_DEF * font = NULL; const struct FONT_DEF * font = NULL;
@ -37,17 +36,10 @@ void setExtFont(const char *fname){
int getFontHeight(void){ int getFontHeight(void){
if(font) if(font)
return font->u8Height; return font->u8Height;
return 8; // XXX: Should be done right. return 8; // XXX: Should be done right.
}; };
static uint8_t read_byte (void)
{
UINT readbytes;
uint8_t byte;
f_read(&file, &byte, sizeof(uint8_t), &readbytes);
return byte;
}
int _getFontData(int type, int offset){ int _getFontData(int type, int offset){
UINT readbytes; UINT readbytes;
@ -59,10 +51,10 @@ int _getFontData(int type, int offset){
if(efont.type == FONT_EXTERNAL){ if(efont.type == FONT_EXTERNAL){
if (type == START_FONT){ if (type == START_FONT){
efont.def.u8Width = read_byte (); res = f_read(&file, &efont.def.u8Width, sizeof(uint8_t), &readbytes);
efont.def.u8Height = read_byte (); res = f_read(&file, &efont.def.u8Height, sizeof(uint8_t), &readbytes);
efont.def.u8FirstChar = read_byte (); res = f_read(&file, &efont.def.u8FirstChar, sizeof(uint8_t), &readbytes);
efont.def.u8LastChar = read_byte (); res = f_read(&file, &efont.def.u8LastChar, sizeof(uint8_t), &readbytes);
res = f_read(&file, &extras, sizeof(uint16_t), &readbytes); res = f_read(&file, &extras, sizeof(uint16_t), &readbytes);
return 0; return 0;
}; };
@ -80,7 +72,9 @@ int _getFontData(int type, int offset){
return 0; return 0;
}; };
if(type == GET_WIDTH || type == GET_DATA){ if(type == GET_WIDTH || type == GET_DATA){
return read_byte (); uint8_t width;
res = f_read(&file, &width, sizeof(uint8_t), &readbytes);
return width;
}; };
if(type == SEEK_DATA){ if(type == SEEK_DATA){
character=offset; character=offset;
@ -93,7 +87,7 @@ int _getFontData(int type, int offset){
}; };
if(type == PEEK_DATA){ if(type == PEEK_DATA){
uint8_t width; uint8_t width;
width = read_byte (); res = f_read(&file, &width, sizeof(uint8_t), &readbytes);
f_lseek(&file,6+ f_lseek(&file,6+
(extras*sizeof(uint16_t))+ (extras*sizeof(uint16_t))+
((extras+font->u8LastChar-font->u8FirstChar)*sizeof(uint8_t))+ ((extras+font->u8LastChar-font->u8FirstChar)*sizeof(uint8_t))+
@ -246,10 +240,10 @@ int DoChar(int sx, int sy, int c){
UINT res; UINT res;
UINT readbytes; UINT readbytes;
uint8_t testbyte; uint8_t testbyte;
testbyte = read_byte (); res = f_read(&file, &testbyte, sizeof(uint8_t), &readbytes);
if(testbyte>>4 ==15){ if(testbyte>>4 ==15){
preblank = read_byte (); res = f_read(&file, &preblank, sizeof(uint8_t), &readbytes);
postblank = read_byte (); res = f_read(&file, &postblank, sizeof(uint8_t), &readbytes);
width-=3; width-=3;
width/=height; width/=height;
res = f_read(&file, charBuf, width*height, &readbytes); res = f_read(&file, charBuf, width*height, &readbytes);