Bug in Windows BlitSurface() (0/1)

Sam: I have included an attachment source file to demo the bug. The bug
is found in the function DrawBG(). All the demo does is blit a tiled background to
the screen. The file that I have sent currently works ok, if I comment out the lines (128 and
129):
dest.w = w; // and
dest.h = h;

under windows, then the tile function works perfectly fine. Under Linux
(if those lines are commented out) the tile only stretches the first row and leaves the rest of
the screen blank. Hopefully you can try this out…

Works fine here. You should probably initialize the dest rectangle before
the blit, like this:

int DrawBG()
{
int h = bitmap->h;
int w = bitmap->w;
SDL_Rect dest;
int i, j;

for( i=0; i<=HEIGHT + h; i+= h )
for( j=0; j<=WIDTH+ w; j+= w )
{
dest.x = j;
dest.y = i;
dest.w = w;
dest.h = h;
SDL_BlitSurface( bitmap, 0, screen, &dest );
}

return 1;
}

Always set the ‘w’ and ‘h’ members of the destination rectangle, because
they are clipped to the actual blit rectangle.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

My point was that the width and height of the blitted rectangle are not
returned back through to the referenced SDL_Rect under windows.

-Ryan

“Sam Lantinga” wrote in message
news:E1467eW-0001LW-00 at roboto.devolution.com

Sam: I have included an attachment source file to demo the bug. The
bug

is found in the function DrawBG(). All the demo does is blit a tiled
background to

the screen. The file that I have sent currently works ok, if I comment
out the lines (128 and

129):
dest.w = w; // and
dest.h = h;

under windows, then the tile function works perfectly fine. Under Linux
(if those lines are commented out) the tile only stretches the first row
and leaves the rest of> > the screen blank. Hopefully you can try this out…

Works fine here. You should probably initialize the dest rectangle before
the blit, like this:

int DrawBG()

int h = bitmap->h;
int w = bitmap->w;
SDL_Rect dest;
int i, j;

for( i=0; i<=HEIGHT + h; i+= h )
for( j=0; j<=WIDTH+ w; j+= w )
{
dest.x = j;
dest.y = i;
dest.w = w;
dest.h = h;
SDL_BlitSurface( bitmap, 0, screen, &dest );
}

return 1;
}

Always set the ‘w’ and ‘h’ members of the destination rectangle, because
they are clipped to the actual blit rectangle.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

My point was that the width and height of the blitted rectangle are not
returned back through to the referenced SDL_Rect under windows.

Can you print output showing the bug, and showing the correct behavior?
Please send it to @slouken

See ya,
-Sam Lantinga, Lead Programmer, Loki Entertainment Software