gu_draw.c.svn-base

来自「psp播放器PPA源码,在MSYS/CYGWIN环境下编译(GNU-C)」· SVN-BASE 代码 · 共 1,041 行 · 第 1/3 页

SVN-BASE
1,041
字号
			texture_subdivision_get(&texture_subdivision);
			if ( output_inversion )
				pmp_gu_draw_sprite_180(&texture_subdivision, 480, 272);
			else
				pmp_gu_draw_sprite(&texture_subdivision);
			}
		while (texture_subdivision.output_last == 0);
	}


	pmp_gu_load_luminosity_texture(luminosity_textures + 64 * luminosity_boost);
	texture_subdivision_constructor(&texture_subdivision, 4, 4, 16, vertex_width, vertex_height, vertex_x, vertex_y);
	do
		{
		texture_subdivision_get(&texture_subdivision);
		pmp_gu_draw_sprite(&texture_subdivision);
		}
	while (texture_subdivision.output_last == 0);
		if (info_count)		{		info_count--;		gu_font_print( (476-gu_font_width_get(info_string,0)), 2, 0, info_string, output_inversion );		previous_info = 1;		}		if (show_subtitle )
		{		int flags = 0;		int pwidth = 0;
		struct subtitle_frame_struct *frame = 0;
		if (subtitle_parse_get_frame(&subtitle_parser[show_subtitle-1], &frame, frame_number)==0)			{				if (frame!=0)					{					if ((subtitle_format==1) && (gufont_haveflags&GU_FONT_HAS_UNICODE_CHARMAP))						{						flags = FLAG_UTF8;						pwidth = gu_font_utf8_width_get(frame->p_string,0);						}					else						pwidth = gu_font_width_get(frame->p_string,0);
					unsigned int sub_distance = gu_font_distance_get();
					if ( gu_font_align_get() > 0 ) 						gu_font_print( (480-pwidth)/2, 272-(frame->p_num_lines)*gu_font_height()-sub_distance, flags | FLAG_ALIGN_CENTER, frame->p_string, output_inversion);
					else
						gu_font_print( (480-pwidth)/2, sub_distance, flags | FLAG_ALIGN_CENTER, frame->p_string, output_inversion);
					//gu_font_print( (480-pwidth)/2, gu_font_height(), flags | FLAG_ALIGN_CENTER, frame->p_string);										previous_subtitle = 1;//(pwidth<=vertex_width?(vertex_height<272?1:0):1);					}			}
		}	
	if (show_interface)
		{
		pmp_gu_load_interface_texture(background_8888);
		texture_subdivision_constructor(&texture_subdivision, 480, interface_height, 16, output_width, interface_height*output_height/272, output_left, output_top);
		do
			{
			texture_subdivision_get(&texture_subdivision);
			pmp_gu_draw_sprite(&texture_subdivision);
			}
		while (texture_subdivision.output_last == 0);
		}
	
	sceGuCopyImage(GU_PSM_8888, 0, 0, 480, 272, 512, pmp_gu_draw_buffer, 0, 0, 512, video_frame_buffer);
	sceGuTexSync();
	
	sceGuFinish();
	}

void pmp_gu_draw_psplcd(unsigned int aspect_ratio, unsigned int zoom, unsigned int luminosity_boost, unsigned int show_interface, unsigned int show_subtitle, unsigned int subtitle_format, unsigned int frame_number, void *video_frame_buffer)
	{
	short texture_width  = aspect_ratios[0].width;
	short texture_height = aspect_ratios[0].height;

	int vertex_width  = aspect_ratios[aspect_ratio].psp_width;
	int vertex_height = aspect_ratios[aspect_ratio].psp_height;

	vertex_width  = zoom * vertex_width  / 100;
	vertex_height = zoom * vertex_height / 100;

	int vertex_x = output_left + (output_width >> 1) - (vertex_width  >> 1);
	int vertex_y = output_top + (output_height >> 1) - (vertex_height >> 1);

	int filter;
	if ((texture_width == vertex_width) && (texture_height == vertex_height))
		{
		filter = GU_NEAREST;
		}
	else
		{
		filter = GU_LINEAR;
		}
		
		
	sceGuStart(GU_DIRECT, pmp_gu_list);
	if ((previous_aspect_ratio != aspect_ratio) || (previous_zoom != zoom) || (previous_interface != show_interface) ||	    ((vertex_width < output_width || vertex_height < output_height) && (previous_subtitle || previous_info)))		{		sceGuClearColor(0);
		sceGuClear(GU_COLOR_BUFFER_BIT);		previous_aspect_ratio = aspect_ratio;		previous_zoom         = zoom;		previous_subtitle     = 0;		previous_info         = 0;
		previous_interface = show_interface;		}


	struct texture_subdivision_struct texture_subdivision;


	if ( texture_width > 512 ) {
		short texture_x = 0;
		if ( texture_width == 720 && texture_height == 480 ) {
			texture_width = 704;
			texture_x = 8;
		}
		int part_width = 512 * vertex_width / texture_width;
		
		pmp_gu_load(pmp_gu_rgb_buffer+texture_x*4, 768, filter);
		texture_subdivision_constructor(&texture_subdivision, 512, texture_height, 16, part_width, vertex_height, vertex_x, vertex_y);
		do
			{
			texture_subdivision_get(&texture_subdivision);
			if ( output_inversion )
				pmp_gu_draw_sprite_180(&texture_subdivision, 480, 272);
			else
				pmp_gu_draw_sprite(&texture_subdivision);
			}
		while (texture_subdivision.output_last == 0);
		
		pmp_gu_load(pmp_gu_rgb_buffer+(texture_x+512)*4, 768, filter);
		texture_subdivision_constructor(&texture_subdivision, texture_width-512, texture_height, 16, vertex_width-part_width, vertex_height, vertex_x+part_width, vertex_y);
		do
			{
			texture_subdivision_get(&texture_subdivision);
			if ( output_inversion )
				pmp_gu_draw_sprite_180(&texture_subdivision, 480, 272);
			else
				pmp_gu_draw_sprite(&texture_subdivision);
			}
		while (texture_subdivision.output_last == 0);
		
	}
	else {
		pmp_gu_load(pmp_gu_rgb_buffer, 512, filter);
		texture_subdivision_constructor(&texture_subdivision, texture_width, texture_height, 16, vertex_width, vertex_height, vertex_x, vertex_y);
		do
			{
			texture_subdivision_get(&texture_subdivision);
			if ( output_inversion )
				pmp_gu_draw_sprite_180(&texture_subdivision, 480, 272);
			else
				pmp_gu_draw_sprite(&texture_subdivision);
			}
		while (texture_subdivision.output_last == 0);
	}
	



	pmp_gu_load_luminosity_texture(luminosity_textures + 64 * luminosity_boost);
	texture_subdivision_constructor(&texture_subdivision, 4, 4, 16, vertex_width, vertex_height, vertex_x, vertex_y);
	do
		{
		texture_subdivision_get(&texture_subdivision);
		pmp_gu_draw_sprite(&texture_subdivision);
		}
	while (texture_subdivision.output_last == 0);
		if (info_count)		{		info_count--;		gu_font_print( (476-gu_font_width_get(info_string,0)), 2, 0, info_string, output_inversion );		previous_info = 1;		}		if (show_subtitle )
		{		int flags = 0;		int pwidth = 0;
		struct subtitle_frame_struct *frame = 0;
		if (subtitle_parse_get_frame(&subtitle_parser[show_subtitle-1], &frame, frame_number)==0)			{				if (frame!=0)					{					if ((subtitle_format==1) && (gufont_haveflags&GU_FONT_HAS_UNICODE_CHARMAP))						{						flags = FLAG_UTF8;						pwidth = gu_font_utf8_width_get(frame->p_string,0);						}					else						pwidth = gu_font_width_get(frame->p_string,0);
					unsigned int sub_distance = gu_font_distance_get();
					if ( gu_font_align_get() > 0 ) 						gu_font_print( (480-pwidth)/2, 272-(frame->p_num_lines)*gu_font_height()-sub_distance, flags | FLAG_ALIGN_CENTER, frame->p_string, output_inversion);
					else
						gu_font_print( (480-pwidth)/2, sub_distance, flags | FLAG_ALIGN_CENTER, frame->p_string, output_inversion);
					//gu_font_print( (480-pwidth)/2, gu_font_height(), flags | FLAG_ALIGN_CENTER, frame->p_string);										previous_subtitle = 1;//(pwidth<=vertex_width?(vertex_height<272?1:0):1);					}			}
		}
	
	if (show_interface)
		{
		pmp_gu_load_interface_texture(background_8888);
		texture_subdivision_constructor(&texture_subdivision, 480, interface_height, 16, output_width, interface_height*output_height/272, output_left, output_top);
		do
			{
			texture_subdivision_get(&texture_subdivision);
			pmp_gu_draw_sprite(&texture_subdivision);
			}
		while (texture_subdivision.output_last == 0);
		}
		
	sceGuCopyImage(GU_PSM_8888, 0, 0, 480, 272, 768, pmp_gu_draw_buffer, 0, 0, 768, video_frame_buffer);
	sceGuTexSync();
	
	sceGuFinish();
	
	}

void pmp_gu_draw_tvout_interlace(unsigned int aspect_ratio, unsigned int zoom, unsigned int luminosity_boost, unsigned int show_interface, unsigned int show_subtitle, unsigned int subtitle_format, unsigned int frame_number, void *video_frame_buffer)
	{
	short texture_width  = aspect_ratios[0].width;
	short texture_height = aspect_ratios[0].height;

	int vertex_width  = aspect_ratios[aspect_ratio].psp_width;
	int vertex_height = aspect_ratios[aspect_ratio].psp_height;

	vertex_width  = zoom * vertex_width  / 100;
	vertex_height = zoom * vertex_height / 100;

	int vertex_x = output_left + (output_width >> 1) - (vertex_width  >> 1);
	int vertex_y = output_top + (output_height >> 1) - (vertex_height >> 1);

	int filter;
	if ((texture_width == vertex_width) && (texture_height == vertex_height))
		{
		filter = GU_NEAREST;
		}
	else
		{
		filter = GU_LINEAR;
		}
		
		
	sceGuStart(GU_DIRECT, pmp_gu_list);
	if ((previous_aspect_ratio != aspect_ratio) || (previous_zoom != zoom) || (previous_interface != show_interface) ||	    ((vertex_width < output_width || vertex_height < output_height) && (previous_subtitle || previous_info)))		{
		sceGuClearColor(0);		sceGuClear(GU_COLOR_BUFFER_BIT);		previous_aspect_ratio = aspect_ratio;		previous_zoom         = zoom;		previous_subtitle     = 0;		previous_info         = 0;
		previous_interface = show_interface;		}


	struct texture_subdivision_struct texture_subdivision;

	if ( texture_width > 512 ) {
		short texture_x = 0;
		if ( texture_width == 720 && texture_height == 480 ) {
			texture_width = 704;
			texture_x = 8;
		}
		int part_width = 512 * vertex_width / texture_width;
		
		pmp_gu_load(pmp_gu_rgb_buffer+texture_x*4, 768, filter);
		texture_subdivision_constructor(&texture_subdivision, 512, texture_height, 16, part_width, vertex_height, vertex_x, vertex_y);
		do
			{
			texture_subdivision_get(&texture_subdivision);
			pmp_gu_draw_sprite(&texture_subdivision);
			}
		while (texture_subdivision.output_last == 0);
		
		pmp_gu_load(pmp_gu_rgb_buffer+(texture_x+512)*4, 768, filter);
		texture_subdivision_constructor(&texture_subdivision, texture_width-512, texture_height, 16, vertex_width-part_width, vertex_height, vertex_x+part_width, vertex_y);
		do
			{
			texture_subdivision_get(&texture_subdivision);
			pmp_gu_draw_sprite(&texture_subdivision);
			}
		while (texture_subdivision.output_last == 0);
		
	}
	else {

		pmp_gu_load(pmp_gu_rgb_buffer, 512, filter);
		texture_subdivision_constructor(&texture_subdivision, texture_width, texture_height, 16, vertex_width, vertex_height, vertex_x, vertex_y);
		do
			{
			texture_subdivision_get(&texture_subdivision);
			pmp_gu_draw_sprite(&texture_subdivision);
			}
		while (texture_subdivision.output_last == 0);
	
	}



	pmp_gu_load_luminosity_texture(luminosity_textures + 64 * luminosity_boost);
	texture_subdivision_constructor(&texture_subdivision, 4, 4, 16, vertex_width, vertex_height, vertex_x, vertex_y);
	do
		{
		texture_subdivision_get(&texture_subdivision);
		pmp_gu_draw_sprite(&texture_subdivision);
		}
	while (texture_subdivision.output_last == 0);
		if (info_count)		{		info_count--;		gu_font_print( (476-gu_font_width_get(info_string,0)), 2, 0, info_string, 0 );		previous_info = 1;		}		if (show_subtitle )
		{		int flags = 0;		int pwidth = 0;
		struct subtitle_frame_struct *frame = 0;
		if (subtitle_parse_get_frame(&subtitle_parser[show_subtitle-1], &frame, frame_number)==0)			{				if (frame!=0)					{					if ((subtitle_format==1) && (gufont_haveflags&GU_FONT_HAS_UNICODE_CHARMAP))						{						flags = FLAG_UTF8;						pwidth = gu_font_utf8_width_get(frame->p_string,0);						}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?