去掉重复的acf_draw

This commit is contained in:
anod 2022-10-02 17:28:40 +08:00
parent d978ed113a
commit e34cf5b885
2 changed files with 2 additions and 29 deletions

View File

@ -25,7 +25,7 @@ static void set_screen_color( acf_callerdata_t data, acf_position_t tx, acf_posi
}
}
static const char *acf_put_text(int x, int y, int width, int height, int maxwidth, u8 color, u8 placement, const char* text)
const char *acf_put_text(int x, int y, int width, int height, int maxwidth, u8 color, u8 placement, const char* text)
{
uint8_t draw_data[sizeof(int)*5];

View File

@ -59,36 +59,9 @@ typedef struct
char *ptrs[MAX_DIR_ENTRIES]; // For fast sorting.
} DirList;
void set_screen_color( acf_callerdata_t data, acf_position_t tx, acf_position_t ty, acf_color_t b )
{
if( b == 0 ) return;
int *draw_data = data;
u16 *frame = consoleGet()->frameBuffer;
int x = tx + draw_data[0];
int y = ty + draw_data[1];
if( 0 <= x && x < draw_data[2] && 0 <= y && y < draw_data[3] ){
frame[ x*draw_data[3] + (draw_data[3]-1-y) ] = (u16)draw_data[4];
}
}
const char *acf_draw(int x, int y, int width, int height, int maxwidth, u16 color, const char* text)
{
uint8_t draw_data[sizeof(int)*5];
int *draw_data_int = (int*)&draw_data;
draw_data_int[0] = x;
draw_data_int[1] = y;
draw_data_int[2] = width;
draw_data_int[3] = height;
draw_data_int[4] = color;
const char *retval = text;
acf_canvas_t canvas = acf_get_canvas(maxwidth, text, NULL, NULL, &retval);
if( !canvas ) return retval;
acf_recycle( acf_use_canvas(canvas, set_screen_color, draw_data) );
return retval;
return atf_put_text(x, y, width, height, maxwidth, color, ATP_PLACEMENT_LEFT, text);
}
static const char *page[] = {