microsoft/DirectXTex

Using heap allocated ScratchImage on CopyRectangle

YouKnow-sys opened this issue · 2 comments

Hi, basically what I want to do is opening a DDS file and doing some stuff on it, but the thing is I need to first make sure that it isn't compressed, so what I need to do is check If it's compressed and if yes first decompress it and then continue working on it.
But the problem is I'm not sure how to reassign the new created decompressed ScratchImage to top level one so I can continue using it
Here is an example

ScratchImage image;
// ... Load something in it
if (IsCompress(...))
{
    ScratchImage new_image;
    // ... Decompress
    image = new_image; // this won't work because the = overload is on delete...
}

I tried to create the image on heap using new and it did mostly worked, except for some reason it didn't worked on CopyRectangle...
So what should I do in this case?
Sorry if here isn't the right place to ask.

For examples of this kind of operation, see texconv around line 2205+.

thank you, this lead me to the right way.