|Posted: 02 June 2004 at 09:24 | IP Logged
how to calculte the cost of time :bliting a picture to screen ?
below is two pieces of code , one is wrote with sdl , and the other with allegro.
after running the code i got the result:
the one with sdl is working with 20fps , and the allegro is working with 50fps
same envionment , same picture , same 640x480x16 mode
(linux 2.4.26 with rivafb driver)
i wonder to know why , is allegro faster then sdl ? or my code is mistake ?
SDL_Surface *pbmp = IMG_Load(abc.bmp); // abc.bmp is a 640x480x16bit picture
SDL_Surface * pScreen = SDL_GetVideoSurface();
for(int i=0;i<times;++i) // times = 1000
while the code running , my moniter working at:37.5K/75hz
so, 46s / 1000 is 21.7fps
BITMAP * the_image = load_bitmap(abc.bmp,the_palette);
while the code running , my monitor working at:31.5k/60hz
so 19seconds/1000frames is: 52.6fps