Re: [sdljava-users] SDLSurface Concerns
Status: Beta
Brought to you by:
ivan_ganza
From: Ivan Z. G. <iva...@ya...> - 2005-02-15 03:23:00
|
Each method in SDLSurface maps 1:1 to a function found in SDL_video.h -- the names are derived directly from the sdl function names to make it easier to figure out how to use sdljava. From SDL_video.h: /* * Makes sure the given list of rectangles is updated on the given screen. * If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire * screen. * These functions should not be called while 'screen' is locked. */ extern DECLSPEC void SDLCALL SDL_UpdateRects (SDL_Surface *screen, int numrects, SDL_Rect *rects); extern DECLSPEC void SDLCALL SDL_UpdateRect (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h); In sdljava we have: public void updateRect(int x,int y, long w, long h) public void updateRect(SDLRect r) throws SDLException public void updateRect() throws SDLException The first two update what you give it. The last updates the entire screen. We are missing: public void updateRects(SDLRect[] rects) because for some reason I remarked it out. I will enable it again. Its not implemented in an efficient way however in that each item in rects results in a call to the C layer and SDL_updateRect (instead of one and only one call to SDL_UpdateRects). Image data is NEVER ever transferred between the C layer and the java layer (except in the case of SDLVideo.createRGBSurfaceFrom() that I know off). If you wanted to access the image data this would be done via NIO buffers -- so no data would actually be copied from C to Java. -Ivan/ Chris Dennett wrote: > I also have a concern about updateRect() in the SDLSurface class -- it > is a method that may be able to handle many data types in the future, > so it should be renamed to 'update()'. At the moment, it can also take > no parameters to update the entire thing, so it is actually currently > ambiguous in this situation. > > Also, what is update() actually doing? Is it transferring the image > from system memory to the graphics card memory, or what? The method > name update() really dosen't really say a lot. Perhaps this needs to > be looked into further to deambiguise things for the user. > > Regards, > Chris > |