mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Merge pull request #735 from Areloch/ImagePreviewGenFix
Fixes handling of loading non-DDS images to better handle pointer references with the GBitmap resources.
This commit is contained in:
commit
916121a1bd
1 changed files with 8 additions and 2 deletions
|
|
@ -1368,6 +1368,11 @@ DefineEngineFunction(saveScaledImage, bool, (const char* bitmapSource, const cha
|
||||||
{
|
{
|
||||||
bool isDDS = false;
|
bool isDDS = false;
|
||||||
|
|
||||||
|
if (bitmapSource == 0 || bitmapSource[0] == '\0' || bitmapDest == 0 || bitmapDest[0] == '\0')
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//First, gotta check the extension, as we have some extra work to do if it's
|
//First, gotta check the extension, as we have some extra work to do if it's
|
||||||
//a DDS file
|
//a DDS file
|
||||||
const char* ret = dStrrchr(bitmapSource, '.');
|
const char* ret = dStrrchr(bitmapSource, '.');
|
||||||
|
|
@ -1381,7 +1386,7 @@ DefineEngineFunction(saveScaledImage, bool, (const char* bitmapSource, const cha
|
||||||
return false; //no extension? bail out
|
return false; //no extension? bail out
|
||||||
}
|
}
|
||||||
|
|
||||||
GBitmap* image;
|
GBitmap* image = NULL;
|
||||||
if (isDDS)
|
if (isDDS)
|
||||||
{
|
{
|
||||||
Resource<DDSFile> dds = DDSFile::load(bitmapSource, 0);
|
Resource<DDSFile> dds = DDSFile::load(bitmapSource, 0);
|
||||||
|
|
@ -1397,7 +1402,8 @@ DefineEngineFunction(saveScaledImage, bool, (const char* bitmapSource, const cha
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
image = GBitmap::load(bitmapSource);
|
Resource<GBitmap> resImage = GBitmap::load(bitmapSource);
|
||||||
|
image = new GBitmap(*resImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!image)
|
if (!image)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue