Slowdown with BlitSurface and UpdateRect?

I’m having a problem figuring out whats going on in the included program.
Its basically the shell of an emulator I’m working on, except there is no
work actually being done here (and it is only rough code I did in 10
minutes).

The problem is that the CPU is going at 50% - 100% doing nothing!! It
seems that the problem is linked to the command
’SDL_UpdateRect(screen,0,0,0,0)’.

Compile and run the following program and you’ll see what I mean. You
can press ‘=’ to enlarge the window and ‘Escape’ to exit.

On a Pentium3 667 and 800 (Coppermine) at work, using ATI Rage Pro
graphics cards, the following are the stats:

Normal size, negligible CPU usage
Medium size, approx 50% usage
Large size, 100% usage

On my Athlon 1.8GHz with NVidia GeForce 2MX, the stats are:

Normal, negligible
Medium, negligible
Large, negligible

Problem is that no work is actually being done here. What is the problem?

Also, why does an SDL_BlitSurface command require an SDL_UpdateRect to
actually show the results? The problem seems to be with the
SDL_UpdateRect, so I would like to be able to remove it.

Finally, does the bpp have anything to do with this? If I request a
screen depth other than the default, will SDL use some sort of emulation
mode? For example, if I request 8 bpp on a 16 bit screen, will this slow
things down. I’d like to know this since thats why I’m having problems
in other parts of the code, like converting from 16/32 bit to 8 bit (as I
stated in other posts).

Any help is greatly appreciated because frankly, I’m lost :frowning:

Thanks,
Steve
-------------- next part --------------
A non-text attachment was scrubbed…
Name: weird.cpp
Type: text/x-c++
Size: 2870 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020301/94ae77f8/attachment.bin