Thread: [sdljava-users] Aaaaaaargh...
Status: Beta
Brought to you by:
ivan_ganza
From: Rainer K. <ar...@gm...> - 2005-03-21 05:16:53
|
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 |
From: Chris D. <Des...@nt...> - 2005-03-21 06:03:45
|
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. -- |>>> Dessimat0r /`\ | "We cannot turn back time, but we can _ _|_ _ move it forwards with our own hands." |;|_|;|_|;| \\. . / [www: http://codeknight.net ] \\: . / [e-mail: des...@nt... ] ||: U | /`\ [icq: 21477909 ] ||:. | [msn: des...@nt... ] \,/ ||: U.| ||: | \,/ ||: , | ____--`~--- '--~~__ __ ----~ - ~`---, -~--~ ~---__ ,--~' ~~----___ |
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); |
From: Ivan Z. G. <iva...@ya...> - 2005-03-22 02:22:19
|
Rainer, Sorry that you ran into this. I will apply the fix. -Ivan/ Rainer Koschnick wrote: > 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); > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > sdljava-users mailing list > sdl...@li... > https://lists.sourceforge.net/lists/listinfo/sdljava-users |
From: Ivan Z. G. <iva...@ya...> - 2005-03-22 02:59:03
|
The fix has been checked into cvs. Again sorry about this. -Ivan/ Rainer Koschnick wrote: > 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); > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > sdljava-users mailing list > sdl...@li... > https://lists.sourceforge.net/lists/listinfo/sdljava-users |
From: Chris D. <Des...@nt...> - 2005-03-22 03:23:27
|
Ivan Z. Ganza wrote: > The fix has been checked into cvs. Again sorry about this. > > -Ivan/ > I posted a CVS patch to the mailing list as well, which fixed a few bugs -- did you get it? -- |>>> Dessimat0r /`\ | "We cannot turn back time, but we can _ _|_ _ move it forwards with our own hands." |;|_|;|_|;| \\. . / [www: http://codeknight.net ] \\: . / [e-mail: des...@nt... ] ||: U | /`\ [icq: 21477909 ] ||:. | [msn: des...@nt... ] \,/ ||: U.| ||: | \,/ ||: , | ____--`~--- '--~~__ __ ----~ - ~`---, -~--~ ~---__ ,--~' ~~----___ |