• Create Account

Banner advertising on our site currently available from just \$5!

### #ActualTolito

Posted 19 December 2013 - 10:51 PM

if(new_screen_w && new_screen_h && (stored_res_x!=new_screen_w || stored_res_y!=new_screen_h) ) screen=SDL_SetVideoMode( new_screen_w, new_screen_h, 32, SDL_SWSURFACE ),stored_res_x=new_screen_w,stored_res_y=new_screen_h;

That's what I was saying. The problem was probably not occurring because it only had to blit for one fourth of the size of the window. With that line of code enabled, however, it must do four times the blitting, which led to an entire system slowdown.

Instead of scaling and blitting a duplicate, how can I scale the screen itself and use SDL_Flip on that? For example, this:

scale(screen);
SDL_Flip(screen);

SDL_Surface *scaled=scale(screen);
SDL_BlitSurface(scaled,NULL,screen,NULL);
SDL_Flip(screen);

I tried running the code with scaling going on in the background with no re-blitting. There was no lag. Blitting without scaling also results in no lag. With both scaling and blitting, however, the entire system slows down. Thanks again!

### #1Tolito

Posted 19 December 2013 - 10:34 PM

if(new_screen_w && new_screen_h && (stored_res_x!=new_screen_w || stored_res_y!=new_screen_h) ) screen=SDL_SetVideoMode( new_screen_w, new_screen_h, 32, SDL_SWSURFACE ),stored_res_x=new_screen_w,stored_res_y=new_screen_h;

That's what I was saying. The problem was probably not occurring because it only had to blit for one fourth of the size of the window. With that line of code enabled, however, it must do four times the blitting, which led to an entire system slowdown.

Instead of scaling and blitting a duplicate, how can I scale the screen itself and use SDL_Flip on that? For example, this:

scale(screen);
SDL_Flip(screen);

SDL_Surface *scaled=scale(screen);
SDL_Flip(screen);