Implemented -dumpRGBAToFileNamed: for the SDL builds. Saves a .bmp planet texture file at the directory where Oolite is run from.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2847 127b21dd-08f5-0310-b4b7-95ae10353056
master
Nikos Barkas 2009-12-05 22:47:02 +00:00
parent 9e69f069ac
commit 0182572e90
1 changed files with 7 additions and 1 deletions

View File

@ -1822,7 +1822,13 @@ keys[a] = NO; keys[b] = NO; \
height:(OOUInteger)height
rowBytes:(OOUInteger)rowBytes
{
OOLog(@"dumpRGBA.unimplemented", @"If you had a Mac, you'd be getting some sort of debug image (\"%@\") dumped somewhere.", name);
if (name == nil || bytes == NULL || width == 0 || height == 0 || rowBytes < width * 4) return;
NSString *dumpFileName = [NSString stringWithFormat:@"%@.bmp", name];
SDL_Surface* tmpSurface = SDL_CreateRGBSurfaceFrom(bytes, width, height, 32, rowBytes, 0xFF, 0xFF00, 0xFF0000, 0x0);
SDL_SaveBMP(tmpSurface, [dumpFileName UTF8String]);
SDL_FreeSurface(tmpSurface);
}
#endif