Troubleshooting blitting crash on MinGW

Hi there,
I’m using MinGW on Windows2000 with MSYS. I’ve decided to get rid
of the OpenGL code and use only SDL for my program. All I need is to
blit parts of an image surface onto the screen at different places.

Here’s the code:
/*****************
SDL_Rect srcrect = { […4 values here, separated by comas…] };
SDL_Rect dstrect = { […2 values here…], 0,0 };
int r = SDL_BlitSurface(myimage, &srcrect, theWindow, &dstrect);
*****************/

This code crashes just while SDL_BlitSurface runs and never returns.
I make my program print the values from the two Rects and all values
are within the two surfaces.

I’m not very familiar with windows and this MSYS, (I’m a linux
developer) so I was wondering if I was doing something wrong with this
blit function.

Thanks,
Simon

Hmm… I dunno. Looks right to me. Are you sure both SDL surfaces have
been initialized properly?

ChrisOn 2/13/06, Simon <simon.xhz at gmail.com> wrote:

Hi there,
I’m using MinGW on Windows2000 with MSYS. I’ve decided to get rid
of the OpenGL code and use only SDL for my program. All I need is to
blit parts of an image surface onto the screen at different places.

Here’s the code:
/*****************
SDL_Rect srcrect = { […4 values here, separated by comas…] };
SDL_Rect dstrect = { […2 values here…], 0,0 };
int r = SDL_BlitSurface(myimage, &srcrect, theWindow, &dstrect);
*****************/

This code crashes just while SDL_BlitSurface runs and never returns.
I make my program print the values from the two Rects and all values
are within the two surfaces.


E-Mail: Chris Nystrom
http://www.newio.org/
AIM: nystromchris

Here’s how the two surfaces are created:
/* window /
ScreenSurfaceType = SDL_SWSURFACE | SDL_RESIZABLE;
int r = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
theWindow = SDL_SetVideoMode(wWidth, wHeight, bpp, ScreenSurfaceType);
/
myimage */
SDL_Surface *myimage = IMG_Load(path);
// the image pointed to is a PNG-RGBA made by TheGIMP

Do you have any ideas? I’ll be able to work on this a lot starting
tonight (in about 5 hours) and for the next two days.

Thanks for the help.
SimonOn 2/13/06, Chris Nystrom wrote:

On 2/13/06, Simon <@Simon3> wrote:

Hi there,
I’m using MinGW on Windows2000 with MSYS. I’ve decided to get rid
of the OpenGL code and use only SDL for my program. All I need is to
blit parts of an image surface onto the screen at different places.

Here’s the code:
/*****************
SDL_Rect srcrect = { […4 values here, separated by comas…] };
SDL_Rect dstrect = { […2 values here…], 0,0 };
int r = SDL_BlitSurface(myimage, &srcrect, theWindow, &dstrect);
*****************/

This code crashes just while SDL_BlitSurface runs and never returns.
I make my program print the values from the two Rects and all values
are within the two surfaces.

Hmm… I dunno. Looks right to me. Are you sure both SDL surfaces have
been initialized properly?

Chris


E-Mail: Chris Nystrom
http://www.newio.org/
AIM: nystromchris


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

What data type do you have for “theWindow”?

When you run the program are you getting an SDL window? How much do
you see before it crashes?

Also, for one or both of the co-ordinates have you tried replacing
them with NULL just for debusgging to see what happens? This might
tell you if the problem is with the cordinates or with the surfaces.

ChrisOn 2/13/06, Simon <simon.xhz at gmail.com> wrote:

Here’s how the two surfaces are created:
/* window /
ScreenSurfaceType = SDL_SWSURFACE | SDL_RESIZABLE;
int r = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
theWindow = SDL_SetVideoMode(wWidth, wHeight, bpp, ScreenSurfaceType);
/
myimage */
SDL_Surface *myimage = IMG_Load(path);
// the image pointed to is a PNG-RGBA made by TheGIMP

Do you have any ideas? I’ll be able to work on this a lot starting
tonight (in about 5 hours) and for the next two days.


E-Mail: Chris Nystrom
http://www.newio.org/
AIM: nystromchris