SDL 1.2.5 bug on Win32 (blitting from screen surface)

Hi all,

I just downloaded the new SDL 1.2.5 and noticed a problem on
Windows. When I switched back to the 1.2.4 DLL, everything worked
fine again. I can’t show you any code, because the program is way
too big, but this is what happens:

My game draws a custom mouse pointer by blitting a surface to the
main screen surface. Before it does that, it copies the part of the
screen that is under the mouse to a “backing store” surface. At the
beginning of every new frame, the backing store is copied back onto
the screen to erase the mouse pointer and restore the background.
This prevents me from having to redraw the entire screen every
frame.

What goes wrong in 1.2.5 is the copy from the screen to the backing
store surface: the source x and y positions of the blit seem to be
ignored. The rectangle that I get always comes from the top of the
screen. This only happens if the screen is a HWSURFACE; software
surfaces work fine, as do any other flags such as DOUBLEBUF and
RLEACCEL. (The backing store is also a HWSURFACE.) Blits the other
way around, i.e. from other surfaces to the screen, work just fine.

I am using WinXP, NVidia GeForce2 Go, 640x480x32 resolution, Visual
C++ 6, and the 1.2.5 DLL (and headers) that I downloaded half an
hour ago. But like I said, it works fine with 1.2.4.

If you need more info, then please let me know… If this isn’t
something that is easy to look up in the sources, then I’d be happy
to whip up a small example program that demonstrates the bug.–
Matthijs Hollemans
All Your Software
www.allyoursoftware.com

Hi,

File: src/video/SDL_surface.c
Line: 416
Function: SDL_LowerBlit()

/* Figure out which blitter to use */
if ( (src->flags & SDL_HWACCEL) == SDL_HWACCEL ) {
    if ( src == SDL_VideoSurface ) {

// hw_srcrect = *dstrect; <— Ooops!
hw_srcrect = *srcrect;
hw_srcrect.x += current_video->offset_x;
hw_srcrect.y += current_video->offset_y;
srcrect = &hw_srcrect;
}

cheers,
John.> ----- Original Message -----

From: matthijs@allyoursoftware.com (Matthijs Hollemans)
To:
Sent: Monday, October 07, 2002 10:16 AM
Subject: [SDL] SDL 1.2.5 bug on Win32 (blitting from screen surface)

Hi all,

I just downloaded the new SDL 1.2.5 and noticed a problem on
Windows. When I switched back to the 1.2.4 DLL, everything worked
fine again. I can’t show you any code, because the program is way
too big, but this is what happens:

My game draws a custom mouse pointer by blitting a surface to the
main screen surface. Before it does that, it copies the part of the
screen that is under the mouse to a “backing store” surface. At the
beginning of every new frame, the backing store is copied back onto
the screen to erase the mouse pointer and restore the background.
This prevents me from having to redraw the entire screen every
frame.

What goes wrong in 1.2.5 is the copy from the screen to the backing
store surface: the source x and y positions of the blit seem to be
ignored. The rectangle that I get always comes from the top of the
screen. This only happens if the screen is a HWSURFACE; software
surfaces work fine, as do any other flags such as DOUBLEBUF and
RLEACCEL. (The backing store is also a HWSURFACE.) Blits the other
way around, i.e. from other surfaces to the screen, work just fine.

I am using WinXP, NVidia GeForce2 Go, 640x480x32 resolution, Visual
C++ 6, and the 1.2.5 DLL (and headers) that I downloaded half an
hour ago. But like I said, it works fine with 1.2.4.

If you need more info, then please let me know… If this isn’t
something that is easy to look up in the sources, then I’d be happy
to whip up a small example program that demonstrates the bug.

Matthijs Hollemans
All Your Software
www.allyoursoftware.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi,

File: src/video/SDL_surface.c
Line: 416
Function: SDL_LowerBlit()

/* Figure out which blitter to use */
if ( (src->flags & SDL_HWACCEL) == SDL_HWACCEL ) {
    if ( src == SDL_VideoSurface ) {

// hw_srcrect = *dstrect; <— Ooops!
hw_srcrect = *srcrect;

Thanks for catching that! It’s fixed in CVS.

See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment