Bug fixes:

Generating image previews of image assets was failing

DDS remove redundant check for stream status.

STB requires the file to be free before being written to, move check to make sure we can open the path into gBitmap and remove FileStream checks from everywhere else.
This commit is contained in:
marauder2k7 2023-11-30 10:46:51 +00:00
parent 0b451aa7b5
commit 63682c43ec
11 changed files with 39 additions and 111 deletions

View file

@ -234,20 +234,11 @@ void ScreenShot::_singleCapture( GuiCanvas *canvas )
char filename[256];
dSprintf( filename, 256, "%s.%s", mFilename, mWriteJPG ? "jpg" : "png" );
// Open up the file on disk.
FileStream fs;
if ( !fs.open( filename, Torque::FS::File::Write ) )
Con::errorf( "ScreenShot::_singleCapture() - Failed to open output file '%s'!", filename );
// Write it and close.
if ( mWriteJPG )
bitmap->writeBitmap( "jpg", filename);
else
{
// Write it and close.
if ( mWriteJPG )
bitmap->writeBitmap( "jpg", filename);
else
bitmap->writeBitmap( "png", filename);
fs.close();
}
bitmap->writeBitmap( "png", filename);
// Cleanup.
delete bitmap;