Re: [sdljava-users] Aaaaaaargh...
Status: Beta
Brought to you by:
ivan_ganza
From: Rainer K. <ar...@gm...> - 2005-03-21 06:12:02
|
Chris Dennett wrote: > Rainer Koschnick wrote: > >> I've been checking my code over and over again for a bug (or rather >> undocumented feature?) which is actually in the native binding :/ >> This costed me hours and hours. >> >> Why isn't this documented? SDLBlitSurface doesn't behave as it should >> due to those changes below. >> >> int SWIG_SDL_BlitSurface_FAST(SDL_Surface * src, int sX, int sY, int >> sWidth, int sHeight, SDL_Surface *dst, int dX, int dY, int dWidth, int >> dHeight) { >> srcBlitRect.x = (sX > -1 ? sX : 0); >> srcBlitRect.y = (sY > -1 ? sY : 0); >> srcBlitRect.w = (sWidth > -1 ? sWidth : 0); >> srcBlitRect.h = (sHeight > -1 ? sHeight : 0); >> >> dstBlitRect.x = (dX > -1 ? dX : 0); >> dstBlitRect.y = (dY > -1 ? dY : 0); >> dstBlitRect.w = (dWidth > -1 ? dWidth : 0); >> dstBlitRect.h = (dHeight > -1 ? dHeight: 0); >> >> return SDL_BlitSurface(src, &srcBlitRect, dst, &dstBlitRect); >> } >> >> Positions _CAN_ be negative. Otherwise how are you supposed to move a >> sprite or image outside of the screen if it is nailed to position 0? >> >> srcBlitRect.x = sX; >> srcBlitRect.y = sY; >> srcBlitRect.w = (sWidth > -1 ? sWidth : 0); >> srcBlitRect.h = (sHeight > -1 ? sHeight : 0); >> >> dstBlitRect.x = dX; >> dstBlitRect.y = dY; >> dstBlitRect.w = (dWidth > -1 ? dWidth : 0); >> dstBlitRect.h = (dHeight > -1 ? dHeight: 0); >> >> Rainer > > > Erk, that might be a bit of a problem. See if you can make a patch based > on the CVS source, and then submit it to this mailing list. > Yes, indeed. Never used diff, but let's see how Turtoise can handle this :) RCS file: /cvsroot/sdljava/sdljava/src/sdljava/native/SDLVideo.i,v retrieving revision 1.28 diff -u -r1.28 SDLVideo.i --- native/SDLVideo.i 18 Feb 2005 04:21:27 -0000 1.28 +++ native/SDLVideo.i 21 Mar 2005 06:10:19 -0000 @@ -32,14 +32,13 @@ // also note that we use pre-allocated SDL_Rects so no new memory needs to be allocated // during the blit! This means only one thread should be doing the blits! int SWIG_SDL_BlitSurface_FAST(SDL_Surface * src, int sX, int sY, int sWidth, int sHeight, SDL_Surface *dst, int dX, int dY, int dWidth, int dHeight) { - - srcBlitRect.x = (sX > -1 ? sX : 0); - srcBlitRect.y = (sY > -1 ? sY : 0); + srcBlitRect.x = sX; + srcBlitRect.y = sY; srcBlitRect.w = (sWidth > -1 ? sWidth : 0); srcBlitRect.h = (sHeight > -1 ? sHeight : 0); - dstBlitRect.x = (dX > -1 ? dX : 0); - dstBlitRect.y = (dY > -1 ? dY : 0); + dstBlitRect.x = dX; + dstBlitRect.y = dY; dstBlitRect.w = (dWidth > -1 ? dWidth : 0); dstBlitRect.h = (dHeight > -1 ? dHeight: 0); |