Ejemplo n.º 1
0
/** 更新数据 */
void TextLayer_Update( LCUI_TextLayer layer, LinkedList *rect_list )
{
	if( layer->task.update_bitmap ) {
		TextLayer_InvalidateRowsRect( layer, 0, -1 );
		TextLayer_ReloadCharBitmap( layer );
		TextLayer_InvalidateRowsRect( layer, 0, -1 );
		layer->task.update_bitmap = FALSE;
		layer->task.redraw_all = TRUE;
	}
	if( layer->task.update_typeset ) {
		TextLayer_TextTypeset( layer, layer->task.typeset_start_row );
		layer->task.update_typeset = FALSE;
		layer->task.typeset_start_row = 0;
	}
	layer->width = TextLayer_GetWidth( layer );
	/* 如果坐标偏移量有变化,记录各个文本行区域 */
	if( layer->new_offset_x != layer->offset_x
	 || layer->new_offset_y != layer->offset_y ) {
		TextLayer_InvalidateRowsRect( layer, 0, -1 );
		layer->offset_x = layer->new_offset_x;
		layer->offset_y = layer->new_offset_y;
		TextLayer_InvalidateRowsRect( layer, 0, -1 );
		layer->task.redraw_all = TRUE;
	}
	if( rect_list ) {
		LinkedList_Concat( rect_list, &layer->dirty_rect );
	 }
}
Ejemplo n.º 2
0
/** 更新数据 */
void TextLayer_Update( LCUI_TextLayer* layer, LinkedList *rect_list )
{
	if( layer->task.update_bitmap ) {
		TextLayer_InvalidateAllRowRect( layer );
		TextLayer_ReloadCharBitmap( layer );
		TextLayer_InvalidateAllRowRect( layer );
		layer->task.update_bitmap = FALSE;
		layer->task.redraw_all = TRUE;
	}

	if( layer->task.update_typeset ) {
		TextLayer_TextTypeset( layer, layer->task.typeset_start_row );
		layer->task.update_typeset = FALSE;
		layer->task.typeset_start_row = 0;
	}

	/* 如果坐标偏移量有变化,记录各个文本行区域 */
	if( layer->new_offset_x != layer->offset_x
	 || layer->new_offset_y != layer->offset_y ) {
		TextLayer_InvalidateAllRowRect( layer );
		layer->offset_x = layer->new_offset_x;
		layer->offset_y = layer->new_offset_y;
		TextLayer_InvalidateAllRowRect( layer );
		layer->task.redraw_all = TRUE;
	}
	
	if( rect_list ) {
		int n;
		void *data_ptr;

		n = LinkedList_GetTotal( &layer->dirty_rect );
		LinkedList_Goto( &layer->dirty_rect, 0 );
		/* 转移脏矩形记录,供利用 */
		while(n--) {
			data_ptr = LinkedList_Get( &layer->dirty_rect );
			LinkedList_AddDataCopy( rect_list, data_ptr );
			LinkedList_ToNext( &layer->dirty_rect );
		}
	 } 
}