Moving bitmap around

For a test program, I’d like to create a window with a bitmap in it.
When the mouse cursor is moving around in the window, the bitmap moves
with the cursor.

However, the bitmap movement always seems to have a lag of anywhere from
half a second to two seconds.

Whenever there’s a SDL_MOUSEMOVEMENT event, I call a function that
contains this code:

src.x = 0;
src.y = 0;
src.w = penguin->w;
src.h = penguin->h;

dest.x = cursor_x_pos - penguin->w / 2;
dest.y = cursor_y_pos - penguin->h / 2;
dest.w = penguin->w;
dest.h = penguin->h;

Uint32 black = SDL_MapRGB(screen->format, 255, 255, 255);
SDL_FillRect(screen, NULL, black);

SDL_BlitSurface(penguin, &src, screen, &dest);
SDL_Flip(screen);

Where src and dest are SDL_Rects.

Any clue why it’s so slow on moving the bitmap (actually, it’s a .gif
file, I’m using IMG_Load to get it) around?

Joe Laughlin
Phantom Works - Integrated Technology Development Labs
The Boeing Company