⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fbxbench.c

📁 libfxb是linux下只写操作framebuffer的一个轻量级的库。
💻 C
字号:
/* * $Id: fbxbench.c,v 1.7 2001/01/13 22:33:38 lethal Exp $ */#include <time.h>#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <libfbx/libfbx.h>#define NUM_LINES 1024int main(){	fb_surface *blit;	fb_surface *image;	fb_surface *blit2;	int i;	FILE *results;	int start;	int end;	results = fopen("/tmp/fbbench-results.txt", "wt");		fb_init();	fb_handle_signals();	blit = fb_create_surface(fb_screen->width, fb_screen->height);	image = fb_create_surface(fb_screen->width, fb_screen->height);	blit2 = fb_create_surface(fb_screen->width, fb_screen->height);	fb_draw_image(blit, image, 0, 0);	fb_draw_image(blit, blit2, 0, 0);	for(i = 0; i < NUM_LINES; i++)	{		fb_line(rand() % blit->width, rand() % blit->height,			rand() % blit->width, rand() % blit->height,			rand() % 256, rand() % 256, rand() % 256,			blit);	}		fb_cls();	fb_printf(0, 0, "Testing identical blit (memory to screen)...");	fprintf(results, "Testing identical blit (memory to screen)...\n");	sleep(3);	fb_cls();	start = time(0);	for(i = 0; i < 100; i++)	{		fb_draw_image(blit, fb_screen, 0, 0);	}	end = time(0);	fprintf(results, "frames: %i, time: %i, fps: %f\n", i, end - start, (float)i/((float)end - (float)start));	fflush(results);	fb_cls();	fb_printf(0, 0, "Testing offset blit (memory to screen)...");	fprintf(results, "Testing offset blit (memory to screen)...\n");	sleep(3);	fb_cls();	start = time(0);	for(i = 0; i < 100; i++)	{		fb_draw_image(blit, fb_screen, 1, 0);	}	end = time(0);	fprintf(results, "frames: %i, time: %i, fps: %f\n", i, end - start, (float)i/((float)end - (float)start));	fflush(results);	fb_cls();	fb_printf(0, 0, "Testing identical blit (screen to memory)...");	fprintf(results, "Testing identical blit (screen to memory)...\n");	sleep(3);	fb_cls();	start = time(0);	for(i = 0; i < 25; i++)	{		fb_draw_image(fb_screen, blit, 0, 0);	}	end = time(0);	fprintf(results, "frames: %i, time: %i, fps: %f\n", i, end - start, (float)i/((float)end - (float)start));	fb_cls();	fb_printf(0, 0, "Testing offset blit (screen to memory)...");	fprintf(results, "Testing offset blit (screen to memory)...\n");	sleep(3);	fb_cls();	start = time(0);	for(i = 0; i < 25; i++)	{		fb_draw_image(fb_screen, blit, 1, 0);	}	end = time(0);	fprintf(results, "frames: %i, time: %i, fps: %f\n", i, end - start, (float)i/((float)end - (float)start));	fb_cls();	fb_printf(0, 0, "Testing identical blit (memory to memory)...");	fprintf(results, "Testing identical blit (memory to memory)...\n");	sleep(3);	fb_cls();	start = time(0);	for(i = 0; i < 100; i++)	{		fb_draw_image(image, blit, 0, 0);	}	end = time(0);	fprintf(results, "frames: %i, time: %i, fps: %f\n", i, end - start, (float)i/((float)end - (float)start));	fb_cls();	fb_printf(0, 0, "Testing offset blit (memory to memory)...");	fprintf(results, "Testing offset blit (memory to memory)...\n");	sleep(3);	fb_cls();	start = time(0);	for(i = 0; i < 100; i++)	{		fb_draw_image(image, blit, 1, 0);	}	end = time(0);	fprintf(results, "frames: %i, time: %i, fps: %f\n", i, end - start, (float)i/((float)end - (float)start));	fb_cls();	fb_printf(0, 0, "Testing clear (screen)...");	fprintf(results, "Testing clear (screen)...\n");	sleep(3);	fb_cls();	start = time(0);	for(i = 0; i < 25; i++)	{		fb_cls();	}	end = time(0);	fprintf(results, "frames: %i, time: %i, fps: %f\n", i, end - start, (float)i/((float)end - (float)start));	fb_cls();	fb_printf(0, 0, "Testing clear (memory)...");	fprintf(results, "Testing clear (memory)...\n");	sleep(3);	fb_cls();	start = time(0);	for(i = 0; i < 100; i++)	{		fb_scls(blit);	}	end = time(0);	fprintf(results, "frames: %i, time: %i, fps: %f\n", i, end - start, (float)i/((float)end - (float)start));	fclose(results);	fb_cleanup();	return 0;}

⌨️ 快捷键说明

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