/*
 * Block id, and the release of its space removed from the list and return to
 * the block id (the id may not be the original id)
 */
static __s32 List_Delete_Free_Sprite_Block(__u32 sel, list_head_t *node)
{
	__s32 ret = -1;

	if (node != NULL) {
		List_Delete_Sprite_Block(sel, node);
		ret = node->data->id;
		list_free_node(node);
	}
	return ret;
}
示例#2
0
__s32 BSP_disp_sprite_set_order(__u32 sel, __s32 hid,__s32 dst_hid)//todo
{
	__s32 id = 0, dst_id = 0;
	list_head_t * node = NULL, * dst_node = NULL, *chg_node0 = NULL, *chg_node1 = NULL;
	__disp_sprite_block_para_t para;

	id = Sprite_Hid_To_Id(sel, hid);
	dst_id = Sprite_Hid_To_Id(sel, dst_hid);
	if((gsprite[sel].block_status[id] & SPRITE_BLOCK_USED) 
		&& (dst_id == -1 || (gsprite[sel].block_status[dst_id] & SPRITE_BLOCK_USED)))
	{
		if(id == dst_id)//same block,not need to move
		{
			return DIS_SUCCESS;
		}
		if(dst_id != -1)
		{
			dst_node = List_Find_Sprite_Block(sel, dst_id);
			if(dst_node->next->data->id == id && id != 0)//it is the order,not need to move
			{
				return DIS_SUCCESS;
			}
		}
		else
		{
		    dst_node = NULL;
		}

		node = List_Find_Sprite_Block(sel, id);
		if(id == 0)//the block is the first block
		{
			chg_node0 = node->next;
		}
		else
		{
			chg_node0 = node->prev;
		}
        
		if(dst_id == -1)//move to the front of the list
		{
			chg_node1 = gsprite[sel].header;
		}
		else
		{
			chg_node1 = List_Find_Sprite_Block(sel, dst_id);
		}

		List_Delete_Sprite_Block(sel, node);
		List_Assert_Sprite_Block(sel, dst_node,node);
        
		para.fb.addr[0] = node->data->address;
		para.fb.size.width = node->data->size.width;
		para.src_win.x = node->data->src_win.x;
		para.src_win.y = node->data->src_win.y;
		memcpy(&para.scn_win,&node->data->scn_win,sizeof(__disp_rect_t));
		if(node->data->enable == FALSE)
		{
			para.scn_win.y = -2000;
		}
		sprite_set_sprite_block_para(sel, node->data->id,node->next->data->id,&para);
		
		para.fb.addr[0] = chg_node0->data->address;
		para.fb.size.width = chg_node0->data->size.width;
		para.src_win.x = chg_node0->data->src_win.x;
		para.src_win.y = chg_node0->data->src_win.y;
		memcpy(&para.scn_win,&chg_node0->data->scn_win,sizeof(__disp_rect_t));
		if(chg_node0->data->enable == FALSE)
		{
			para.scn_win.y = -2000;
		}
		sprite_set_sprite_block_para(sel, chg_node0->data->id,chg_node0->next->data->id,&para);

		para.fb.addr[0] = chg_node1->data->address;
		para.fb.size.width = chg_node1->data->size.width;
		para.src_win.x = chg_node1->data->src_win.x;
		para.src_win.y = chg_node1->data->src_win.y;
		memcpy(&para.scn_win,&chg_node1->data->scn_win,sizeof(__disp_rect_t));
		if(chg_node1->data->enable == FALSE)
		{
			para.scn_win.y = -2000;
		}
		sprite_set_sprite_block_para(sel, chg_node1->data->id,chg_node1->next->data->id,&para);

		return DIS_SUCCESS;
	}
	else
	{
		return DIS_OBJ_NOT_INITED;
	}
}