# Possible Bug?

**URL:** <https://discourse.libsdl.org/t/possible-bug/733>\
**Category:** SDL Development\
**Created:** [January 31, 1999, 4:24pm UTC](https://discourse.libsdl.org/t/possible-bug/733 "1999-01-31T16:24:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Stock](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/t/41988e/32.png) [@Tom\_Stock](https://discourse.libsdl.org/u/Tom_Stock)\
**Post date:** [January 31, 1999, 4:24pm UTC](https://discourse.libsdl.org/t/possible-bug/733/1 "1999-01-31T16:24:33Z")

</div>

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

@Tom_Stock

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [February 1, 1999, 4:46pm UTC](https://discourse.libsdl.org/t/possible-bug/733/2 "1999-02-01T16:46:46Z")

</div>

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

Can you reproduce the problem with SDL 0.9.x?

Thanks!  
-Sam Lantinga (slouken at [devolution.com](http://devolution.com))

## Lead Programmer, Loki Entertainment Software– Author of Simple DirectMedia Layer - [http://www.devolution.com/~slouken/SDL/](http://www.devolution.com/~slouken/SDL/)

---

<div class="post-metadata">

**Author:** ![Tom\_Stock](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/t/41988e/32.png) [@Tom\_Stock](https://discourse.libsdl.org/u/Tom_Stock)\
**Post date:** [February 2, 1999, 12:40pm UTC](https://discourse.libsdl.org/t/possible-bug/733/3 "1999-02-02T12:40:05Z")

</div>

Hi Sam,

Sorry about the earlier report. It was (well hidden) human error on my part  
🙂

One question since I have you here:

Why was SDL\_MapSurface removed in 0.9.x? The documentation still lists it  
as being required before a blit, but the function no longer exists in the  
header files or library. Just curious, no real concern of course.

Thanks!  
-tom

Sam Lantinga wrote:\> \> Hi I’ve just started using SDL and have come across the following

> > problem (Linux RedHat 5.2, SDL 0.8.10):
> 
> Can you reproduce the problem with SDL 0.9.x?
> 
> Thanks!  
> -Sam Lantinga (slouken at [devolution.com](http://devolution.com))
> 
> ## Lead Programmer, Loki Entertainment Software
> 
> ## Author of Simple DirectMedia Layer - [http://www.devolution.com/~slouken/SDL/](http://www.devolution.com/~slouken/SDL/)

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [February 3, 1999, 7:46pm UTC](https://discourse.libsdl.org/t/possible-bug/733/4 "1999-02-03T19:46:57Z")

</div>

> Why was SDL\_MapSurface removed in 0.9.x? The documentation still lists it  
> as being required before a blit, but the function no longer exists in the  
> header files or library. Just curious, no real concern of course.

SDL\_MapSurface is done automatically by SDL when required.  
I’ll update the documentation. 🙂

See ya!  
-Sam Lantinga (slouken at [devolution.com](http://devolution.com))

## Lead Programmer, Loki Entertainment Software– Author of Simple DirectMedia Layer - [http://www.devolution.com/~slouken/SDL/](http://www.devolution.com/~slouken/SDL/)
