1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 12:00:06 +00:00

ScratchImage Initialize zero-fills image data (#308)

This commit is contained in:
Chuck Walbourn 2023-01-27 11:36:27 -08:00 committed by GitHub
parent 278e708f25
commit 371643fce2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -367,7 +367,9 @@ HRESULT ScratchImage::Initialize(const TexMetadata& mdata, CP_FLAGS flags) noexc
Release();
return E_OUTOFMEMORY;
}
memset(m_memory, 0, pixelSize);
m_size = pixelSize;
if (!SetupImageArray(m_memory, pixelSize, m_metadata, flags, m_image, nimages))
{
Release();
@ -435,7 +437,9 @@ HRESULT ScratchImage::Initialize2D(DXGI_FORMAT fmt, size_t width, size_t height,
Release();
return E_OUTOFMEMORY;
}
memset(m_memory, 0, pixelSize);
m_size = pixelSize;
if (!SetupImageArray(m_memory, pixelSize, m_metadata, flags, m_image, nimages))
{
Release();
@ -489,6 +493,7 @@ HRESULT ScratchImage::Initialize3D(DXGI_FORMAT fmt, size_t width, size_t height,
Release();
return E_OUTOFMEMORY;
}
memset(m_memory, 0, pixelSize);
m_size = pixelSize;
if (!SetupImageArray(m_memory, pixelSize, m_metadata, flags, m_image, nimages))