Possible Bug?

Tom Stock tomstock at geocities.com
Sun Jan 31 08:24:33 PST 1999


Hi I've just started using SDL and have come across the following
problem (Linux RedHat 5.2, SDL 0.8.10):

When I have two surfaces, one being the screen (initialized by
SetVideoMode) and the other being a buffer larger than the screen itself
for rendering scrolling backgrounds, etc, I have a problem blitting from
the larger surface to the smaller surface.
The problem is that the Rect gets clipped even though I make sure that
it is the same size as the destination surface.


Example:

In this example, map_buffer  (SDL_Surface) is  740x580 just to show what
I'm talking about (100x100 bigger than the screen surface)

src_rect.x = 100;                     // Offset into the larger surface
by 100
src_rect.y = 100;                     // Offset by Y also
src_rect.w = screen->w;      //  Make the rect the same size as the dest
surface
src_rect.h = screen->h;        // (640x480)

 SDL_MapSurface(map_buffer,screen->format);
 SDL_BlitSurface(map_buffer,&src_rect,screen,NULL);  //This should've
copied a 640x480 rect of data into screen surface

 printf("x=%d,y=%d w=%d
h=%d\n",src_rect.x,src_rect.y,src_rect.w,src_rect.h);

Output shows a smaller area actually drawn, and the src_rect has been
changed:

x=100,y=100 w=540 h=380

This leads me to believe that the source surface was clipped to fit in
the corner of the dest surface,
even though it was exactly the right size to fit on the entire screen
(640x480).  I've tried playing
with SDL_SetClipping(map_buffer,0,0,0,0) with no results.

Am I doing something incorrectly? Any help would be greatly appreciated.

Thanks!
Tom Stock
Galaxy Long Distance Inc.
(813)221-4200

tomstock at geocities.com






More information about the SDL mailing list