void TextLayer_Text_GenerateBMP( LCUI_TextLayer *layer ) /* 为文本图层中的文本生成位图,已存在位图的文字将不重新生成 */ { BOOL refresh = FALSE; LCUI_Pos pos; int i, j, len, rows; Text_RowData *row_ptr; LCUI_CharData *char_ptr; DEBUG_MSG1("enter\n"); DEBUG_MSG1("thread: %lu\n", thread_self()); rows = Queue_Get_Total( &layer->rows_data ); for( pos.y=0,j=0; j<rows; ++j ) { row_ptr = Queue_Get( &layer->rows_data, j ); len = Queue_Get_Total( &row_ptr->string ); DEBUG_MSG1("row %d, len: %d\n", j, len); for( pos.x=0,i=0; i<len; ++i) { char_ptr = Queue_Get( &row_ptr->string, i ); DEBUG_MSG1("generate FontBMP, get char_ptr: %p, char: %c\n", char_ptr, char_ptr->char_code ); if( !char_ptr || !char_ptr->display ) { DEBUG_MSG1("no display\n"); continue; } if( FontBMP_Valid( &char_ptr->bitmap ) ) { DEBUG_MSG1("have FontBMP\n"); if( !refresh ) { pos.x += char_ptr->bitmap.advance.x; continue; } } else { refresh = TRUE; DEBUG_MSG1( "generate FontBMP, char code: %d\n", char_ptr->char_code ); TextLayer_Get_Char_BMP ( &layer->default_data, char_ptr ); } DEBUG_MSG1( "char_data->bitmap.advance.x: %d\n", char_ptr->bitmap.advance.x ); TextLayer_Clear( layer, pos, row_ptr->max_size.h, char_ptr ); char_ptr->need_update = TRUE; pos.x += char_ptr->bitmap.advance.x; } refresh = FALSE; /* 更新当前行的尺寸 */ TextLayer_Update_RowSize( layer, j ); DEBUG_MSG1("row size: %d,%d\n", row_ptr->max_size.w, row_ptr->max_size.h); pos.y += row_ptr->max_size.h; } DEBUG_MSG1("quit\n"); }
void TextLayer_Text_GenerateBMP( LCUI_TextLayer *layer ) /* 为文本图层中的文本生成位图,已存在位图的文字将不重新生成 */ { uint_t i, j, len, rows; Text_RowData *row_ptr; LCUI_CharData *char_ptr; rows = Queue_Get_Total( &layer->rows_data ); for(j=0; j<rows; ++j) { row_ptr = Queue_Get( &layer->rows_data, j ); len = Queue_Get_Total( &row_ptr->string ); for(i=0; i<len; ++i) { char_ptr = Queue_Get( &row_ptr->string, i ); if( char_ptr->display && FontBMP_Valid( &char_ptr->bitmap ) ) { continue; } DEBUG_MSG( "generate FontBMP, char code: %d\n", char_ptr->char_code ); TextLayer_Get_Char_BMP ( &layer->default_data, char_ptr ); } } }