This commit is contained in:
Turánszki János
2024-06-06 12:45:08 +02:00
parent a988218755
commit 985f9db68d
2 changed files with 3 additions and 7 deletions
+2 -6
View File
@@ -331,16 +331,12 @@ namespace dds
// returns the width of the texture in pixels
constexpr unsigned width() const
{
if (header.dwFlags & DDSD_WIDTH)
return header.dwWidth;
return 1;
return header.dwWidth < 1 ? 1 : header.dwWidth;
}
// returns the height of the texture in pixels
constexpr unsigned height() const
{
if (header.dwFlags & DDSD_HEIGHT)
return header.dwHeight;
return 1;
return header.dwHeight < 1 ? 1 : header.dwHeight;
}
// returns the depth of the texture in pixels
constexpr unsigned depth() const
+1 -1
View File
@@ -315,7 +315,7 @@ namespace wi
resource->container_filesize = filesize;
resource->container_fileoffset = container_fileoffset;
if (resource->filedata.empty() && (has_flag(flags, Flags::IMPORT_RETAIN_FILEDATA) || has_flag(flags, Flags::IMPORT_DELAY)))
if (filedata != nullptr && resource->filedata.empty() && (has_flag(flags, Flags::IMPORT_RETAIN_FILEDATA) || has_flag(flags, Flags::IMPORT_DELAY)))
{
// resource was loaded with external filedata, and we want to retain filedata
// this must also happen when using IMPORT_DELAY!