backend update from Raze

* moving large allocations off the stack
* use proper printf formatters for size_t and ptrdiff_t.
* adding some missing 'noexcept'.
This commit is contained in:
Christoph Oelckers 2024-01-06 15:24:10 +01:00
commit 83aa9388ca
29 changed files with 117 additions and 109 deletions

View file

@ -39,6 +39,7 @@
#ifdef HAVE_MMX
#include "hqnx_asm/hqnx_asm.h"
#endif
#include <memory>
#include "xbr/xbrz.h"
#include "xbr/xbrz_old.h"
#include "parallel_for.h"
@ -304,7 +305,8 @@ static unsigned char *hqNxAsmHelper( void (*hqNxFunction) ( int*, unsigned char*
initdone = true;
}
HQnX_asm::CImage cImageIn;
auto pImageIn = std::make_unique<HQnX_asm::CImage>();
auto& cImageIn = *pImageIn;
cImageIn.SetImage(inputBuffer, inWidth, inHeight, 32);
cImageIn.Convert32To17();

View file

@ -510,7 +510,8 @@ bool M_ReadIDAT (FileReader &file, uint8_t *buffer, int width, int height, int p
{
i += bytesPerRowOut * 2;
}
inputLine = (Byte *)alloca (i);
TArray<Byte> inputArray(i, true);
inputLine = inputArray.data();
adam7buff[0] = inputLine + 4 + bytesPerRowOut;
adam7buff[1] = adam7buff[0] + bytesPerRowOut;
adam7buff[2] = adam7buff[1] + bytesPerRowOut;
@ -925,7 +926,8 @@ bool M_SaveBitmap(const uint8_t *from, ESSType color_type, int width, int height
temprow[i] = &temprow_storage[temprow_size * i];
}
Byte buffer[PNG_WRITE_SIZE];
TArray<Byte> array(PNG_WRITE_SIZE, true);
auto buffer = array.data();
z_stream stream;
int err;
int y;

View file

@ -181,7 +181,7 @@ struct FTextureBuffer
}
FTextureBuffer(const FTextureBuffer &other) = delete;
FTextureBuffer(FTextureBuffer &&other)
FTextureBuffer(FTextureBuffer &&other) noexcept
{
mBuffer = other.mBuffer;
mWidth = other.mWidth;
@ -190,7 +190,7 @@ struct FTextureBuffer
other.mBuffer = nullptr;
}
FTextureBuffer& operator=(FTextureBuffer &&other)
FTextureBuffer& operator=(FTextureBuffer &&other) noexcept
{
mBuffer = other.mBuffer;
mWidth = other.mWidth;