Skip to content

Commit

Permalink
Was attempting to get blob size from an invalid blob (we had already …
Browse files Browse the repository at this point in the history
…moved it to our map)
  • Loading branch information
nooperation committed May 15, 2019
1 parent 14419af commit 765202e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions LibDDS/LibDDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,12 @@ bool ConvertDdsInMemory(
// --- Save result -------------------------------------------------------------
auto blob = DirectX::Blob();
auto img = image->GetImage(0, 0, 0);
auto wic_codec = GetWICCodec(options.codec);
hr = DirectX::SaveToWICMemory(
img,
1,
DirectX::WIC_FLAGS_NONE,
GetWICCodec(options.codec),
wic_codec,
blob
);
if (FAILED(hr))
Expand All @@ -261,6 +262,11 @@ bool ConvertDdsInMemory(

auto blobNeedsToBeReleased = true;

if (outBuffSize != nullptr)
{
*outBuffSize = blob.GetBufferSize();
}

if (outBuff != nullptr)
{
*outBuff = reinterpret_cast<unsigned char *>(blob.GetBufferPointer());
Expand All @@ -277,11 +283,6 @@ bool ConvertDdsInMemory(
outImageProperties->format = originalInfo.format;
}

if (outBuffSize != nullptr)
{
*outBuffSize = blob.GetBufferSize();
}

if (blobNeedsToBeReleased)
{
blob.Release();
Expand Down

0 comments on commit 765202e

Please sign in to comment.