Example #1
0
UINT16 * gp_get_dog_dispInfo(void)
{
    //如果使用独立线程就要开启
#if 1
    dispGetResolution(hDisp, &lcd_size);	
    gp_dogDispBuf= (UINT16*)dispGetFramebuffer(hDisp);
#endif
     return (UINT16 *)gp_dogDispBuf;
}
/**
 * jpeg file : need to updata pdvr->disp_bitmap to display;
 * video: need to call dispFlip();
 **/
int dvr_thmb_dispFullScreen(cdvr_thmb_t *pdvr, char *disp_pData)
{
	int ret = -1;
	SINT64 stime, etime;
	gp_bitmap_t *pbitmap= NULL;
	if(!pdvr) {
		return -1;
	}
	char *purl = NULL;
	int type = -1;
	dvr_thmb_setDispFullMode(pdvr);

	if(DispBufManage.DispDev == C_DISP_BUFFER) {
		pdvr->upFrame =  (unsigned char *)get_idle_buffer(0);
		clean_buffer(pdvr->upFrame, 0);
	}
	else {
		pdvr->upFrame = (char *)dispGetFramebuffer(pdvr->hDisp);
	}
	
	pdvr->pUrl = FilelistGetFilePath(pdvr->pFile, dvr_thmb_getCurIdxOfFile(pdvr));
	pdvr->fileType = checkFileType(pdvr->pUrl);
	printf("[%s:%d]curIdx %d curPage %d pageNum %d type %d\n", __FUNCTION__, __LINE__, pdvr->cur_idx, pdvr->cur_page, pdvr->cur_pageNum, pdvr->fileType);
	purl = pdvr->pUrl;
	type = pdvr->fileType;
	photo_uninit(pdvr->pPhotoInfo); //for jpeg->video->jpeg
	pdvr->pPhotoInfo = NULL;
	if(purl) {
		stime = sysGetCurTime(); 
		ret = -1;

		if(type == GP_FILE_TYPE_VIDEO) {
			pbitmap= &pdvr->disp_bitmap;
			pbitmap->pData = (unsigned char*)pdvr->upFrame;
			ret = mcpGetThumbnail(pbitmap, purl, 0);
		}
		else if(type == GP_FILE_TYPE_JPEG) {
			pdvr->pPhotoInfo = photo_init(purl, &pdvr->disp_bitmap);
			if(pdvr->pPhotoInfo) {
				pdvr->pPhotoInfo->bitmap->pData = (unsigned char*)pdvr->upFrame;
				ret = image_scale(pdvr->pPhotoInfo);
				if(ret == -1) {
				}
			}
		}
		etime = sysGetCurTime();
		printf("thumbnail used time %lld - %lld = %lldms ret %d\n", etime, stime, etime - stime, ret);
		if(ret == -1) {
			//dispCleanFramebuffer(pdvr->hDisp);
			if(DispBufManage.DispDev == C_DISP_BUFFER) {
				pdvr->upFrame =  (unsigned char *)get_idle_buffer(0);
				clean_buffer(pdvr->upFrame, 0);
			}
			else {
				pdvr->upFrame = (char *)dispGetFramebuffer(pdvr->hDisp);
				dispCleanFramebuffer(pdvr->hDisp);
			}
			printf("WARNNING: get fulscreen error!!!!!!!\n");
		}

	}
	dvr_thmb_dispFlip(pdvr);
	return ret;
}
int dvr_thmb_setFileNumber(cdvr_thmb_t *pdvr, int file_num, int reset)
{
	
	if(!pdvr) {
		return -1;
	}

	//int lastFileNum = pdvr->file_number;
	int idx = dvr_thmb_getCurIdxOfFile(pdvr);
	printf("f:%d idx %d\n",pdvr->file_number, idx);
	if(pdvr->file_number == idx) { //delete last file
		reset = 1;
	}
	pdvr->file_number = file_num;

	pdvr->disp_page = file_num/(pdvr->disp_number);
	if(file_num%(pdvr->disp_number)) {
		pdvr->disp_page++;
	}


#if 0
	if(pdvr->cur_idx == -1) {
		pdvr->cur_idx = 0;
	}
	else if(pdvr->cur_idx >= pdvr->file_number) {
		pdvr->cur_idx = 0;
		pdvr->cur_page = 0;
	}
	if(pdvr->cur_page == -1) {
		pdvr->cur_page = pdvr->disp_page-1;
	}
	if(pdvr->cur_page == pdvr->disp_page-1) {
		pdvr->cur_pageNum = pdvr->file_number % pdvr->disp_number;
		pdvr->cur_pageNum = pdvr->cur_pageNum?pdvr->cur_pageNum:pdvr->disp_number;
	}
	else {
		pdvr->cur_pageNum = pdvr->disp_number;
	}
#else
	if(pdvr->disp_page) {

		if(reset) {
			pdvr->cur_page = pdvr->disp_page-1;
			pdvr->cur_pageNum = pdvr->file_number%pdvr->disp_number;
			pdvr->cur_pageNum = pdvr->cur_pageNum?pdvr->cur_pageNum:pdvr->disp_number;
			pdvr->cur_idx = pdvr->cur_pageNum-1;
		}
		else { //not reset and not delete the last file
 			//if(pdvr->cur_idx-1)
			//pdvr->cur_page = pdvr->disp_page-1;
			//pdvr->cur_pageNum = pdvr->file_number%pdvr->disp_number;
			//pdvr->cur_pageNum = pdvr->cur_pageNum?pdvr->cur_pageNum:pdvr->disp_number;
		}

		//pdvr->cur_idx = pdvr->cur_pageNum-1;

		if(fileMode && pdvr->file_number > 1) {
			idx = dvr_thmb_getCurIdxOfFile(pdvr);
			if(FileNameMatch(FilelistGetFilePath(pdvr->pFile, idx), FilelistGetFilePath2(pdvr->pFile, idx-1)) >= 0) {
				dvr_thmb_preIdx(pdvr);
			}
		}
	}
#endif
	printf("[%s:%d]curIdx %d curPage %d pageNum %d \n", __FUNCTION__, __LINE__, pdvr->cur_idx, pdvr->cur_page, pdvr->cur_pageNum);




	pdvr->dispMode = DISP_FULL_SCREEN;
	if(!pdvr->disp_page) {
		pdvr->dispMode = DISP_NO_FILE;
		if(DispBufManage.DispDev == C_DISP_BUFFER) {
			pdvr->upFrame =  (unsigned char *)get_idle_buffer(0);
			clean_buffer(pdvr->upFrame, 0);
		}
		else {
			pdvr->upFrame = (char *)dispGetFramebuffer(pdvr->hDisp);
			dispCleanFramebuffer(pdvr->hDisp);
		}
		pdvr->disp_page = -1;
		pdvr->cur_idx = -1;
		pdvr->cur_page = -1;
		pdvr->cur_pageNum = -1;
		dvr_thmb_dispFlip(pdvr);
	}
	else {
		pdvr->pUrl = FilelistGetFilePath(pdvr->pFile, dvr_thmb_getCurIdxOfFile(pdvr));
	}
	return 0;
}
Example #4
0
/*==========================================================
dv background UI draw function
===========================================================*/
void DC_UI_foreground(void)
{
	STRING_INFO sub_str;
	STRING_ASCII_INFO ascii_str;
	t_STRING_TABLE_STRUCT str_res;
	gp_size_t resolution;
	UINT16 *fb;
	UINT16* addr1;
	if(dv_set.change_disp != 0)
		return;
	dispGetResolution(hDisp, &resolution);	
	addr1 = fb = (UINT16*)dispGetFramebuffer(hDisp);
	for (int y = 0; y <resolution.height; y++) {		
		for (int x = 0; x < resolution.width; x++) {			
			*addr1++ = TRANSPARENT_COLOR;		
		}	
	}		
	//printf("flip_flag = %d\n",flip_flag);
	if(dv_set.ui_show == 0)
	{
		printf("dv_set.no_power_flag = %d\n",dv_set.no_power_flag);
		dispFlip(hDisp);
		return;
	}
	if(dv_set.no_power_flag == 2)	
	{
		printf("dv_set.no_power_flag = %d\n",dv_set.no_power_flag);
		gp_Icon_draw(fb, (resolution.width-Icon_Manager[ICON_NOFILE].icon_width*HDMIxNum)/2,(resolution.height-Icon_Manager[ICON_NOFILE].icon_height*HDMIxNum)/2,resolution.width, resolution.height,ICON_NOFILE,Icon_Manager[ICON_NOFILE].tran_color);
		sub_str.font_type = 0;	
		sub_str.font_color = FONT_COLOR;
		sub_str.buff_w = resolution.width;
		sub_str.buff_h = resolution.height;	
		sub_str.language = setting_config_get(SET_LANGUAGE);
		sub_str.str_idx = STR_NO_POWER;		
		ap_state_resource_string_resolution_get(&sub_str,&str_res);
		sub_str.pos_x = (resolution.width -str_res.string_width) /2;
		sub_str.pos_y = (resolution.height -str_res.string_height) /2;
		ap_state_resource_string_draw((INT16U *)fb, &sub_str);		
		dispFlip(hDisp);
		return;		
	}
	else if((dv_set.sd_check == 2)||(dv_set.sdc_error2 == 1))
	{	
		gp_Icon_draw(fb, (resolution.width-Icon_Manager[ICON_NOFILE].icon_width*HDMIxNum)/2,(resolution.height-Icon_Manager[ICON_NOFILE].icon_height*HDMIxNum)/2,resolution.width, resolution.height,ICON_NOFILE,Icon_Manager[ICON_NOFILE].tran_color);
		sub_str.font_type = 0;	
		sub_str.font_color = FONT_COLOR;
		sub_str.buff_w = resolution.width;
		sub_str.buff_h = resolution.height;	
		sub_str.language = setting_config_get(SET_LANGUAGE);
		sub_str.str_idx = STR_INSERT_SDC;		
		ap_state_resource_string_resolution_get(&sub_str,&str_res);
		sub_str.pos_x = (resolution.width -str_res.string_width) /2;
		sub_str.pos_y = (resolution.height -str_res.string_height) /2;
		ap_state_resource_string_draw((INT16U *)fb, &sub_str);		
		dispFlip(hDisp);
		return;		
	}	
	else if(dv_set.sdc_full == 2)
	{	
		gp_Icon_draw(fb, (resolution.width-Icon_Manager[ICON_NOFILE].icon_width*HDMIxNum)/2,(resolution.height-Icon_Manager[ICON_NOFILE].icon_height*HDMIxNum)/2,resolution.width, resolution.height,ICON_NOFILE,Icon_Manager[ICON_NOFILE].tran_color);
		sub_str.font_type = 0;	
		sub_str.font_color = FONT_COLOR;
		sub_str.buff_w = resolution.width;
		sub_str.buff_h = resolution.height;	
		sub_str.language = setting_config_get(SET_LANGUAGE);
		sub_str.str_idx = STR_SD_FULL;		
		ap_state_resource_string_resolution_get(&sub_str,&str_res);
		sub_str.pos_x = (resolution.width -str_res.string_width) /2;
		sub_str.pos_y = (resolution.height -str_res.string_height) /2;
		ap_state_resource_string_draw((INT16U *)fb, &sub_str);		
		dispFlip(hDisp);
		return;		
	}
	else if(dv_set.sdc_error== 1)
	{	
		gp_Icon_draw(fb, (resolution.width-Icon_Manager[ICON_NOFILE].icon_width*HDMIxNum)/2,(resolution.height-Icon_Manager[ICON_NOFILE].icon_height*HDMIxNum)/2,resolution.width, resolution.height,ICON_NOFILE,Icon_Manager[ICON_NOFILE].tran_color);
		sub_str.font_type = 0;	
		sub_str.font_color = FONT_COLOR;
		sub_str.buff_w = resolution.width;
		sub_str.buff_h = resolution.height;	
		sub_str.language = setting_config_get(SET_LANGUAGE);
		sub_str.str_idx = STR_SDC_ERROR;		
		ap_state_resource_string_resolution_get(&sub_str,&str_res);
		sub_str.pos_x = (resolution.width -str_res.string_width) /2;
		sub_str.pos_y = (resolution.height -str_res.string_height) /2;
		ap_state_resource_string_draw((INT16U *)fb, &sub_str);		
		dispFlip(hDisp);
		return;		
	}	
	//resolution string
	ascii_str.font_color = FONT_COLOR;
	ascii_str.font_type = 0;
	ascii_str.buff_w = resolution.width;
	ascii_str.buff_h = resolution.height;
	ascii_str.str_ptr = str_dc_resolution[DC_config_get(DC_RESOLUTION)];
	ap_state_resource_string_ascii_resolution_get(ascii_str.str_ptr,&str_res);
	if(dv_set.display_mode == SP_DISP_OUTPUT_HDMI)
	{
		ascii_str.pos_x = resolution.width - ICON_LEFT_X_POS -str_res.string_width-Y_STEP ;
		ascii_str.pos_y = ICON_LEFT_Y_POS+Y_STEP*HDMIxNum;			
	}
	else
	{
		ascii_str.pos_x = resolution.width - ICON_LEFT_X_POS -str_res.string_width ;
		ascii_str.pos_y = ICON_LEFT_Y_POS+Y_STEP;			
	}	
	ap_state_resource_string_ascii_draw((UINT16 *)fb, &ascii_str);
	

	//pic FREE
	ascii_str.font_color = FONT_COLOR;
	ascii_str.font_type = 0;
	ascii_str.buff_w = resolution.width;
	ascii_str.buff_h = resolution.height;
	if(dv_set.sd_check == 0||dv_set.sdc_full != 0)
	{
		pic_free[0] = 0 + 0x30;
		pic_free[1] = 0 + 0x30;
		pic_free[2] = 0 + 0x30;
		pic_free[3] = 0 + 0x30;
		pic_free[4] = 0 + 0x30;
	}
	else
	{
		if(free_size_flag == 1)
		{
			free_size = SDC_FreeSize()-5*1024;
			free_size = free_size/pic_size[DC_config_get(DC_QUALITY)][DC_config_get(DC_RESOLUTION)];
			free_size_flag = 0;
		}
		pic_free[4] = free_size%10+0x30;
		pic_free[3] = (free_size/10)%10+0x30;
		pic_free[2] = (free_size/100)%10+0x30;
		pic_free[1] = (free_size/1000)%10+0x30;
		pic_free[0] = (free_size/10000)%10+0x30;
	}
	ascii_str.str_ptr = pic_free;
	ap_state_resource_string_ascii_resolution_get(&pic_free[0],&str_res);
	if(dv_set.display_mode == SP_DISP_OUTPUT_HDMI)
	{
		ascii_str.pos_x = resolution.width - str_res.string_width - ICON_LEFT_X_POS-Y_STEP;
		ascii_str.pos_y = ICON_LEFT_Y_POS;			
	}
	else
	{
		ascii_str.pos_x = resolution.width - str_res.string_width - ICON_LEFT_X_POS;
		ascii_str.pos_y = ICON_LEFT_Y_POS;		
	}		
	ap_state_resource_string_ascii_draw((UINT16 *)fb, &ascii_str);		

	//quality
	gp_Icon_draw(fb, resolution.width-Icon_Manager[ICON_STAR_3-DC_config_get(DC_QUALITY)].x_pos*HDMIxNum,Icon_Manager[ICON_STAR_3-DC_config_get(DC_QUALITY)].y_pos*HDMIxNum,resolution.width, resolution.height,ICON_STAR_3-DC_config_get(DC_QUALITY),Icon_Manager[ICON_STAR_3-DC_config_get(DC_QUALITY)].tran_color);
	
	//play mode icon
	gp_Icon_draw(fb, Icon_Manager[ICON_CAPTURE].x_pos*HDMIxNum,Icon_Manager[ICON_CAPTURE].y_pos*HDMIxNum,resolution.width, resolution.height,ICON_CAPTURE,Icon_Manager[ICON_CAPTURE].tran_color);
	
	//capture mode
	if(DC_config_get(DC_CAPTURE_MODE)>0)
	{
		if(dv_set.dc_ctrl == 0)
		gp_Icon_draw(fb, Icon_Manager[ICON_CAP_2S_TIMER+DC_config_get(DC_CAPTURE_MODE)-1].x_pos*HDMIxNum,Icon_Manager[ICON_CAP_2S_TIMER+DC_config_get(DC_CAPTURE_MODE)-1].y_pos*HDMIxNum,resolution.width, resolution.height,ICON_CAP_2S_TIMER+DC_config_get(DC_CAPTURE_MODE)-1,Icon_Manager[ICON_CAP_2S_TIMER+DC_config_get(DC_CAPTURE_MODE)-1].tran_color);
		else if(dv_set.dc_ctrl == 1)
		{
			if(time_num !=  10)
			{
				ascii_str.str_ptr = (char *)(&time_num);
				time_num += 0x30;
				ap_state_resource_string_ascii_resolution_get(&time_num,&str_res);
				ascii_str.pos_x = (ICON_LEFT_X_POS + ICON_WIDTH + ICON_WIDTH/2)*HDMIxNum - str_res.string_width/2;
				ascii_str.pos_y = (ICON_LEFT_Y_POS + ICON_WIDTH/2)*HDMIxNum - str_res.string_height/2;
				ap_state_resource_string_ascii_draw((UINT16 *)fb, &ascii_str);
				time_num -= 0x30;	
			}
			else
			{
				ascii_str.str_ptr = &cap_time[0];
				cap_time[0] = 1 + 0x30;
				cap_time[1] = 0x30;
				ap_state_resource_string_ascii_resolution_get(&cap_time,&str_res);
				ascii_str.pos_x = (ICON_LEFT_X_POS + ICON_WIDTH + ICON_WIDTH/2)*HDMIxNum - str_res.string_width/2;
				ascii_str.pos_y = (ICON_LEFT_Y_POS + ICON_WIDTH/2)*HDMIxNum - str_res.string_height/2;
				ap_state_resource_string_ascii_draw((UINT16 *)fb, &ascii_str);
			}
		
		}
	}
	
	//anti shaking
	gp_Icon_draw(fb, Icon_Manager[ICON_NO_ANTI_SHAKING-DC_config_get(DC_ANTI_SHAKING)].x_pos*HDMIxNum,Icon_Manager[ICON_NO_ANTI_SHAKING-DC_config_get(DC_ANTI_SHAKING)].y_pos*HDMIxNum,resolution.width, resolution.height,ICON_NO_ANTI_SHAKING-DC_config_get(DC_ANTI_SHAKING),Icon_Manager[ICON_NO_ANTI_SHAKING-DC_config_get(DC_ANTI_SHAKING)].tran_color);

	//sequence
	if(DC_config_get(DC_SEQUENCE)>0)
	gp_Icon_draw(fb, Icon_Manager[ICON_SEQUENCE_F].x_pos*HDMIxNum,Icon_Manager[ICON_SEQUENCE_F].y_pos*HDMIxNum,resolution.width, resolution.height,ICON_SEQUENCE_F,Icon_Manager[ICON_SEQUENCE_F].tran_color);

	//exporse
	gp_Icon_draw(fb, Icon_Manager[ICON_EXPOSURE_P2_0+DC_config_get(DC_EXPOSURE)].x_pos*HDMIxNum,(Icon_Manager[ICON_EXPOSURE_P2_0+DC_config_get(DC_EXPOSURE)].y_pos-2*ICON_HEIGHT)*HDMIxNum,resolution.width, resolution.height,ICON_EXPOSURE_P2_0+DC_config_get(DC_EXPOSURE),Icon_Manager[ICON_EXPOSURE_P2_0+DC_config_get(DC_EXPOSURE)].tran_color);

	//awb
	gp_Icon_draw(fb, Icon_Manager[ICON_AWB_F+DC_config_get(DC_WHITE_BALANCE)].x_pos*HDMIxNum,Icon_Manager[ICON_AWB_F+DC_config_get(DC_WHITE_BALANCE)].y_pos*HDMIxNum,resolution.width, resolution.height,ICON_AWB_F+DC_config_get(DC_WHITE_BALANCE),Icon_Manager[ICON_AWB_F+DC_config_get(DC_WHITE_BALANCE)].tran_color);

	//iso
	gp_Icon_draw(fb, Icon_Manager[ICON_ISO_AUTO+DC_config_get(DC_ISO)].x_pos*HDMIxNum,Icon_Manager[ICON_ISO_AUTO+DC_config_get(DC_ISO)].y_pos*HDMIxNum,resolution.width, resolution.height,ICON_ISO_AUTO+DC_config_get(DC_ISO),Icon_Manager[ICON_ISO_AUTO+DC_config_get(DC_ISO)].tran_color);
	
	//sdc
	gp_Icon_draw(fb, resolution.width-Icon_Manager[ICON_INT-dv_set.sd_check].x_pos*HDMIxNum,resolution.height -Icon_Manager[ICON_INT-dv_set.sd_check].y_pos*HDMIxNum,resolution.width, resolution.height,ICON_INT-dv_set.sd_check,Icon_Manager[ICON_INT-dv_set.sd_check].tran_color);

	//charge and battery 0: no power  1: zero battery 	2: one battery 3:two battery 4:three battery 5:charge  
	if(dv_set.battery_state == 0)
	{
			printf("No show charge\n");
			gp_Icon_draw(fb, resolution.width-Icon_Manager[ICON_BATTERYX].x_pos*HDMIxNum,resolution.height-Icon_Manager[ICON_BATTERYX].y_pos*HDMIxNum,resolution.width, resolution.height,ICON_BATTERYX,Icon_Manager[ICON_BATTERYX].tran_color);		
	}
	else if(dv_set.battery_state == 5)
	{
		if(flip_flag1 == 0)
		{
			gp_Icon_draw(fb, resolution.width-Icon_Manager[ICON_CHARGE].x_pos*HDMIxNum,resolution.height-Icon_Manager[ICON_CHARGE].y_pos*HDMIxNum,resolution.width, resolution.height,ICON_CHARGE,Icon_Manager[ICON_CHARGE].tran_color);
			//printf("show charge\n");
		}
		else
		{
			fill_rectangle(fb,resolution.width-Icon_Manager[ICON_CHARGE].x_pos*HDMIxNum,resolution.height-Icon_Manager[ICON_CHARGE].y_pos*HDMIxNum ,resolution.width,resolution.height,Icon_Manager[ICON_CHARGE].icon_width*HDMIxNum,Icon_Manager[ICON_CHARGE].icon_height*HDMIxNum,TRANSPARENT_COLOR);
			//printf("No show charge\n");
		}		
	}
	else
	{
		if(dv_set.battery_state > 5)
		gp_Icon_draw(fb, resolution.width-Icon_Manager[ICON_CHARGE+4].x_pos*HDMIxNum,resolution.height-Icon_Manager[ICON_CHARGE+4].y_pos*HDMIxNum,resolution.width, resolution.height,ICON_CHARGE+4,Icon_Manager[ICON_CHARGE+4].tran_color);
		else
		gp_Icon_draw(fb, resolution.width-Icon_Manager[ICON_CHARGE+dv_set.battery_state].x_pos*HDMIxNum,resolution.height-Icon_Manager[ICON_CHARGE+dv_set.battery_state].y_pos*HDMIxNum,resolution.width, resolution.height,ICON_CHARGE+dv_set.battery_state,Icon_Manager[ICON_CHARGE+dv_set.battery_state].tran_color);
	}


	if(dv_set.zoom_num != 0)
	{
		zoom[1] = dv_set.zoom_num/10+1+0x30;
		zoom[3] =  dv_set.zoom_num%10+0x30;
		ascii_str.str_ptr = zoom;
		ap_state_resource_string_ascii_resolution_get(&zoom[0],&str_res);	
		ascii_str.pos_x = Icon_Manager[ICON_WDR_F].x_pos*HDMIxNum;
		ascii_str.pos_y = resolution.height - str_res.string_height - ICON_LEFT_Y_POS*HDMIxNum-Y_STEP*HDMIxNum;
		ap_state_resource_string_ascii_draw((UINT16 *)fb, &ascii_str);		
	}
	/*//date and time
	//RTC_get();
	ap_setting_date_time_string_process(0xFF);
	ascii_str.str_ptr = dt_str;
	ap_state_resource_string_ascii_resolution_get(&dt_str[0],&str_res);	
	ascii_str.pos_x = resolution.width/2 -  str_res.string_width/2;
	ascii_str.pos_y = resolution.height - str_res.string_height + STR_DATETIME_POS_Y;
	//printf("x=%d,y=%d\n",str_res.string_width,str_res.string_height);
	ap_state_resource_string_ascii_draw((UINT16 *)fb, &ascii_str);	*/

	if((cur_draw_flag ==DV_SETTING_MODE)||(cur_draw_flag ==DV_EXIT_MODE))
	{
		disp_OSD0_Set_Alpha(hDisp,100);
		cur_draw_flag =DV_EXIT_MODE+1;
	}	
	dispFlip(hDisp);

}