- SDL_LockSurface() returns 0, or -1 if the surface couldn’t be locked.
There’s no code in the actual function to return anything other than 0. This also means that the following block in SDL_CreateTextureFromSurface could be simplified:
if (SDL_MUSTLOCK(surface)) {
if (SDL_LockSurface(surface) < 0) {
SDL_DestroyTexture(textureID);
return 0;
}
(BTW if the function only has one possible return value, why not just make it a void?)
?* SDL_LockSurface() returns 0, or -1 if the surface couldn’t be locked.
There’s no code in the actual function to return anything other than 0.
This also means that the following block in SDL_CreateTextureFromSurface
could be simplified:
??? if (SDL_MUSTLOCK(surface)) {
??? if (SDL_LockSurface(surface) < 0) {
??? SDL_DestroyTexture(textureID);
??? return 0;
??? }
(BTW if the function only has one possible return value, why not just make
it a void?)
This API needs to be the way it is for backward compatibility with
1.2. Also, there is always the chance that it will be fully
implemented at a later time. I’m not willing to change the
documentation on this one. If Sam wants to change it, deprecate it, or
what ever I leave that decision to him.
Bob PendletonOn Sun, Jul 5, 2009 at 11:11 AM, Mason Wheeler wrote:
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
–
±----------------------------------------------------------