[SDL] RotoZoom is great, but...
SlntHero at aol.com
SlntHero at aol.com
Sat Sep 2 08:26:42 PDT 2006
void Visuals::DisplayBMPonScreenBufferRotoZoom(Sint8 spriteNumber, Sint16
xScreenPos, Sint16 yScreenPos, double angle, double zoom)
{
SDL_Rect destinationRectangle;
destinationRectangle.x = xScreenPos;
destinationRectangle.y = yScreenPos;
SDL_Surface *temp = SpriteBMP[spriteNumber];
SDL_Surface *temp2 = rotozoomSurface(temp, angle, zoom, 0);
temp->clip_rect.x = 0;
temp->clip_rect.y = 0;
temp->clip_rect.w = 640;
temp->clip_rect.h = 480;
temp2->clip_rect.x = 0;
temp2->clip_rect.y = 0;
temp2->clip_rect.w = 640;
temp2->clip_rect.h = 480;
destinationRectangle.w = temp2->w;
destinationRectangle.h = temp2->h;
destinationRectangle.x -= (temp2->w / 2);
destinationRectangle.y -= (temp2->h / 2);
SDL_BlitSurface(temp2, NULL, Screen, &destinationRectangle);
SDL_FreeSurface(temp);
SDL_FreeSurface(temp2);
}
Above compiles and runs, but crashes on 2nd call - any ideas ?
Jesse
_SLNTHERO at AOL.com_ (mailto:SLNTHERO at AOL.com)
_www.SilentHeroProductions.com_ (http://www.SilentHeroProductions.com)
In a message dated 9/2/2006 11:21:59 A.M. Eastern Standard Time,
wizard at syntheticsw.com writes:
Hello !
> I need on-the-fly BMP rotation and scaling, the memory requirements to
> store pre-processed rotations/scaling is TOO LARGE.
>
>
> wizard at syntheticsw.com writes: The problem in your case maybe that
> rotozoom always creates new Surfaces and you never free them.
>
>
> - How do I FREE an SDL surface? (probably stupid question, but I do not
> know the answer)
Look at :
http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fFreeSurface
CU
_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060902/4efaa828/attachment.htm
More information about the SDL
mailing list